I have a list of differentiated expression of the form {f[0,0,0],(f^(a,b,c))[0,0,0],...}
where I have left the function as a general f[x,y,z]
, and (f^(a,b,c))[0,0,0]
is the derivative w.r.t. x a
times evaluated at [x,y,z]=[0,0,0]
. The list itself is output from a power series expansion
Tn[n_] := Normal[Series[f[x,y,z],{x,0,n},{y,0,n},{z,0,n}]]
TnList[n_]:=List@@Tn[n]
After some additional operations that reduce the number of terms I'm using, I want to substitute and evaluate the list for a specific function. I have tried numerous options, mainly of the form
fMap[n_] := Map[ReplaceAll[f-> Function[{x,y,z},Exp[-U[x,y,z]]], TnList[n]]
However, if I try going past say a 3rd order expansion (n=3
), the time to evaluate the list starts drastically increasing. I have also tried
Parallelize[fMap[n]]
but have seen very minimal change, such that I can't even tell if it's doing anything different. Sadly, CUDAMap doesn't work on symbols, so that's also ruled out.
Can anyone suggest a method to speed up this process? It's the only bottleneck in my notebook, and I'd like to fix it.
U
? It's not the replacement that takes long, it's the evaluation of the derivatives which is the bottleneck. $\endgroup$ – halirutan♦ Oct 12 '17 at 3:27U[x,y,z] := A(x^2 y^2 + x^2 z^2 + y^2 z^2) +B(x^2 y^2 z^2)
$\endgroup$ – jpdomann Oct 12 '17 at 11:09