I have a particularly nasty expression (many of them),
Full simplify is also not an option.
Ideally, I would like to evaluate this function (preferably fast) for around 1500 different values its argument. The problem is that, if I first construct the numerical list of the arguments and then use
func./list
the evaluation takes too long. Also, alternatively, I've tried to evaluate the function in a table, but also much too long.
EDIT:
More information:
Frenorm[Px_, Py_, Pz_] :=
a1s (Px^2 + Py^2) + a3s Pz^2 + a11s (Px^4 + Py^4) + a33s Pz^4 +
a13s (Px^2 Pz^2 + Py^2 Pz^2) +
a12s (Px^2 Py^2) + alpha111 (Px^6 + Py^6 +
Pz^6) + alpha112 (Px^4 (Py^2 + Pz^2) + Pz^4 (Px^2 + Py^2) +
Py^4 (Px^2 + Pz^2)) + alpha123 Px^2 Py^2 Pz^2 + mu
acPhaseSolSet = {Sqrt[p1], Sqrt[p3]} /. Solve[{Expand[D[Frenorm[Sqrt[p1], 0, Sqrt[p3]], p1]] == 0, Expand[D[Frenorm[Sqrt[p1], 0, Sqrt[p3]], p3]] == 0}, {p1, p3}]
acPhaseEnergy = Table[Frenorm[Px, 0, Pz] /. {Px -> acPhaseSolSet[[j]][[1]], Pz -> acPhaseSolSet[[j]][[2]]}, {j, 1, Length[acPhaseSolSet]}]
Here, acPhaseEnergy
, yields a result (there are five solutions) that is so long (above) that won't let you efficiently (and rapidly) input a list value of {a1s, a3s, ...}. I would like to put in 1500 lists of different numbers of a1s, etc and get a grid of energy values.
Ie, for example, maybe these values would be
list = {a1s -> -4.01483*10^8, a3s -> -1.92393*10^8, a11s -> 3.3416*10^8,
a33s -> 4.99091*10^7, a13s -> 8.10182*10^8, alpha111->-4.0*10^7, alpha112->35.0*10^6, alpha123->-3.0*10^7,
a12s -> 1.09218*10^9, mu -> 1.81818*10^7}
so one could try
acPhaseEnergy/.list
Compile
. I would have expanded on this if you only had provided copyable code. $\endgroup$Dispatch
onlist
? $\endgroup$Block
, as inBlock[{a1s=1, a11s=2, ..}, func]
. $\endgroup$