Open rwst opened 6 years ago
The workaround would be to not use simplify_full
but the specific simplify_
functions that have an effect with this expression.
Well no. With simplify_rectform
or just simplify
I get the same. So this happens in the interface / conversion.
You may be running into the limitations of string-based interface conversions. We can do better with maxima_lib and this may be an example where this really pays off:
from sage.interfaces.maxima_lib import max_to_sr, sr_to_max
dex=ex.diff(x)
f=maxima_calculus(sr_to_max(dex))
fr=f.rectform()
g=max_to_sr(fr.ecl())
seems to work OK (I didn't wait for the last command to finish, though). It's still very slow, though, because while max_to_sr and sr_to_max will convert expression-trees directly, the max_to_sr one will use the standard function constructors for many of the functions (we have nothing else in sage), which may well call into maxima again for simplification operations (which is what we're just coming from, so no benefit will be obtained). Also, some of those calls could end up calling maxima via the string interface again.
The expression-tree conversion tools have been available for ages. They are used in some specific spots (integration, limits, etc.), but the need didn't seem to be there to use it everywhere, and it's a bit of a chore to go through all the calculus/sr machinery to change the way conversions to maxima_lib are done. There used to be a slight advantage that sticking with strings would allow us to move back to an expect-based maxima for calculus, in case ecl would be abandoned. I don't think we need to consider that anymore.
UPDATE: it looks like the result in fr is rather big. Just printing it already causes the error to happen, so indeed trying to convert it from maxima to sage via producing and then parsing a string will fail. It seems that converting the expression through max_to_sr is also quite challenging, but it did complete using less than 6Gb of resident memory. It's not clear to me anything useful can be done with the expression afterwards...
This on a 32GB machine after about six minutes:
Interrupting after a few minutes:
Component: symbolics
Issue created by migration from https://trac.sagemath.org/ticket/25789