I have 8 very long symbolic expressions (each having around 200,000 summands) - Simplify
will run forever, so that is unfortunately not an option. Each of those summands is in principle pretty simple, so only fractions of the six variables with different exponents are involved - nothing trigonometric, no roots etc. My goal is to determine values for those six variables by e.g. calling NMinimize
.
But simply evaluating one of the expressions takes roughly 3-5 minutes, so that would be all but time-efficient.
Can you give me some general advice on how to approach that kind of problem with respect to be time-efficient? I do have 128GB of memory, so that should not be an issue.
I was thinking about using Compile
to maybe achieve some speed up. For this, I will probably be going along this direction. If Compile
is advisable, then how can I compile expressions like this:
tmp = a1 + a2
where a1
and a2
are my variables. The problem is that tmp
is not a function, it is just a variable and cannot be compiled (easily?). I could rerun lots of computation and turn tmp
into a function that can easily be compiled, but I would prefer a way without doing the latter.
Update
Please find the first five summands of one term here at pastebin. If you want a longer expression, you can download a compressed (.7z, 9MB) .m
file here or alternatively a zip archive here which only contains the relevant terms itself (as a list), so you will need to assign the Import
to some variable and apply Total
to the imported file (importing takes around 3.5min for me). Consider for example those values for the fixed (for each optimization) parameters:
Δ = 2*π*(-35/100);
δ = 2*π*(45/1000);
tg = 30;
a11,a21,a31,a12,a22,a32
are my function variables.