emendes

335 Reputation

6 Badges

4 years, 335 days

MaplePrimes Activity


These are questions asked by emendes

Hello

I need to find all the variants (I am not sure if this is the correct term to be used but I hope this will be clear in the example) of a specific indeterminate in a given expression.  Here is an example:

alpha[3, 5]*xi[1]*xi[8] + alpha[3, 5]*xi[4]*xi[5] + alpha[3, 3]

For this particular example, xi[1], xi[8], xi[4], and xi[5] are the variables I am looking for. The indexes of xi change depending on the previous calculation.  Also, in some cases, I need the alpha variables instead, that is, alpha[3,5], and alpha[3,3].  

I could not figure out how to use indets in this case.

Many thanks for your help. 

Hello

Consider

alias(x=x(t),y=y(t),phi1=phi1(x(t),y(t)));

phi:=[x,ph1];



I need to calculate the Jacobian of phi in relation to x and y (and finally to t)  but using VectorCalculus[Jacobian] does not work. I guess it is because of the time dependence.   What am I missing?  

Can the Physics package be used?

Many thanks.

 

 

 

 

Hello

I have a couple of large lists that will be further processed.  One of the steps is to index a list using another list (a list of indices).  A short example will be something like

L:=[2,1,4,3,7,6,8,3,4,5];
ind:=[2,2,3,3,5,6,7,1,4,10];

The solution 

L1:=L[ind]:

does not seem to be a good choice since it takes longer than the following solution

 

L1:=Threads:-Map(w->L[w],ind):

 

Since I am not a Maple expert, it is very likely that is a faster solution.   

 

Many thanks

 

Hello

I am trying to use Grid:-Seq to speed up some calculations.  To this end, I wrote the following procedure:

fun:=proc(model1::list,model2::list,vars::list,conds::set,tlim::numeric)
description "This function returns models with matching structures":
local ans1,ans2,res:=NULL:
if evalb(expand(model1)<>expand(model2)) then
     (ans1,ans2):=UtilsIORelation:-findMatchingStructures(subs(conds,model1),subs(conds,model2),vars,tlim):
     if nops(ans1) > 1 then
        res:=model1:
     end if:
end if:
return(res):
end proc:

I checked if the procedure works by issuing the following command

 

aux:=[seq](fun(modelX[i],model,vars,conds,2),i=1..nops(modelX)):

and it did work. The result is what I needed. 

But when I try it using Grid:-Seq instead of seq, I got the following error message:

infolevel[Grid:-Seq]:=3:
Grid:-Set(fun,findMatchingStructures,'model','vars','conds');
aux:=[Grid:-Seq](fun(modelX[i],model,vars,conds,2),i=1..nops(modelX)):

 

Error, (in fun) findMatchingStructures is not a command in the UtilsIORelation package.

 

What am I missing?   

Many thanks

 

 

 

Hello 

I need a procedure that given two lists of sets A and returns a list of lists such that L[i] is the list of j such that A[i] subset B[j]. Here is an example:

ans6 := [{alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 8], alpha[3, 6], alpha[3, 9]}, {alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 8], alpha[3, 3], alpha[3, 6]}, {alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 7], alpha[3, 6], alpha[3, 8]}, {alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 7], alpha[3, 3], alpha[3, 8]}, {alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 7], alpha[3, 3], alpha[3, 6]}, {alpha[1, 8], alpha[2, 2], alpha[2, 4], alpha[2, 5], alpha[3, 3], alpha[3, 6]}, {alpha[1, 8], alpha[2, 1], alpha[2, 2], alpha[2, 5], alpha[3, 3], alpha[3, 6]}, {alpha[1, 8], alpha[2, 0], alpha[2, 2], alpha[2, 5], alpha[3, 3], alpha[3, 6]}, {alpha[1, 5], alpha[2, 8], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 8]}]:

ans7 := [{alpha[1, 8], alpha[2, 2], alpha[2, 5], alpha[2, 7], alpha[3, 3], alpha[3, 6], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 5], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 5], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 3], alpha[3, 4], alpha[3, 5], alpha[3, 6], alpha[3, 7]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 6], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 5], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 5], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 5], alpha[3, 6], alpha[3, 7], alpha[3, 8]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 4], alpha[3, 7], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 4], alpha[3, 6], alpha[3, 8], alpha[3, 9]}, {alpha[1, 5], alpha[2, 8], alpha[3, 2], alpha[3, 4], alpha[3, 6], alpha[3, 7], alpha[3, 9]}]:

and my procedure

SubsetPairs:= (A::list(set), B::list(set))->
    map(z-> [ListTools:-SearchAll](true, map(w-> z subset w, B)), A)
:
SubsetPairs(ans6, ans7);

The result of applying SubsetPairs is:

[[], [], [1], [1], [1], [], [], [], [2, 3, 8, 23], [2, 4, 9, 24], [2, 5, 10, 25], [2, 6, 11, 26], [2, 7, 12, 27], [3, 4, 13, 28], [3, 5, 14, 29], [3, 6, 15, 30], [3, 7, 16], [4, 5, 17], [4, 6, 18], [4, 7, 19]]

When it is used for long lists, it takes a long time to return the results.  I wonder if a more time- and memory-efficient code can be implemented (perhaps Threads or Grid can be used).

In addition to that, how can a diagram (figure, plot, ...) be drawn to show which subset of the first list is linked to which subsets of the second list (including no link as well).  The length of the first list is always smaller than the length of the second list.  

Many thanks

 

1 2 3 4 5 6 7 Last Page 1 of 12