JVLB

15 Reputation

One Badge

10 years, 323 days

MaplePrimes Activity


These are replies submitted by JVLB

@acer 

So if I understand correctly:

D[3,2,2] is done recursively first D[2] another D[2] and lastly D[3].
The nops(d) in the `D/A` procedure is thus unneeded as nops(d) will always evaluate to 1.

 

Referring back to your first answer. You argued the motivation for this question was unclear and asked why I would not use eval(diff()).

I've cleaned up my code a little and this is kind of the whole idea: example.mw

Explanation:

Given is function A(z1,z2) of which we a priori only know that A(1,1)=1. (===>this A procedure is not related to the A in my previous example)
Function Y(z) is implicitly defined Y(z)=A(z,Y(z)) and thus Y(1)=1. These knowns are expressed in the equations in the variable 'defset'

The Vm procedure corresponds to the A procedure in my earlier example. Depending on the arguments for the procedure Vm(z1,z2,m) the numer and denominator will be zero and l'hopitals rule needs to be used. Maple cannot do this automatically because of the unknown and implicitly defined functions Y en A. That is why I added the procedure 'dev' which checks how much times numer and denominator have to be differentiated to get rid of the 0/0 situation.

I use subs to be able to use 'defset' as this doest not work with eval as I remember when I tested it. Furthermore I use convert(,D) as otherwise subs(z=1,defset,diff(Y(z),z)) gets converted to diff(1,1) which produces errors again.

Maybe it is just this mixture of diff en subs en convert that makes things difficult. However I did not find another way to incorporate the knowledge contained in defset, which significantly (and necessarily) simplifies the procedures and expressions.

@acer 

That is also what I assumed. However when I tested this, it did not seem to be that way. So I was unclear how maple handles for instance: D[3,2,2](A)

See example

sometoyD.mw

@acer 

Thank you for your response. The answer seems simpler then expected.

Can you clarify (or give me apropriate references about) the datastructure 'd', the argument of the custom 'D/A' procedure.

And also the expression subs(__d=d[],'D[__d](A)');

@Carl Love 

 

So there is no way to speed this up? Or can I sort of create my own "Map" procedure which creates threads explicitly. I was not able to find a thread safe version of diff either.

 

Why are they not thread safe? Do they internally use the same memory space (or global variable) to store intermediate results? (in which case manually programming a "Map" procedure would not work either) Because the arguments I use to invoke these procedures are not in the slightest related. I can't really directly see why the derivation of x and x^2 should not happen in parallel...

Thanks for your quick response!

muldiff:=proc(expr,j,var,substitutionset)
subs(op(substitutionset),convert(diff(expr,[var$j]),D));
end proc:

lhopital:=proc(expr,j,var,substitutionset)
local tt,res;
tt:=Array([op(expand(expr))]):
printf("Finished expand\n");
#unassign('expr');
Map[inplace](muldiff,tt,j,var,substitutionset):
printf("Finished Map\n");
tt:=Add(i,i=tt):
tt;
end proc:

I use the above two procedures. The procedure 'lhopital' is evaluated on a large expression. (just diff'ing the whole expression and substituting the values was unfeasable because of memory restrictions)
Other numeric approaches are not possible because the expression contains an implicit function of which only the evaluation in a certain point is known. For instance we have to evaluate the 7'th derivative of the expression in z=1 and we know that the implicitly defined function A(z) equals 1 in A(1).

The problem is that the Map and Add functions in this case only seem to use a single thread...

Page 1 of 1