#16594: symbolic_expression_from_maxima_string() much too slow
-------------------------+-------------------------------------------------
Reporter: rws | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-6.3
Component: | Keywords: maxima, conversion,
interfaces | optimization, speed
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
-------------------------+-------------------------------------------------
{{{
sage: from sage.calculus.calculus import
symbolic_expression_from_maxima_string as sefms
sage: var('v1,v2,v3')
(v1, v2, v3)
sage: ex=-1/3*(pi + 1)*(3*(euler_gamma - e)*(pi - 3*v1 - v1/arcsech(1) +
e^(-1)/pi) - 6*v3^2*arcsinh(-v1 + e)/v2 - v2 - 3*log_gamma(v1*v3)/v2 -
3*e^(-254) + 3)*(-catalan/v3)^(twinprime*pi - 1/2*v1 -
1/2*v2)*inverse_jacobi_cs(1, v3)/jacobi_sc(1/arccos(-1/(v1*csc(v3))),
v3/v1 + e) - 1/4*(2*v3^2*(e + 1) +
((e*log_integral(arcsech(exp_integral_e1(v2^mertens - 1) - 4)) + 15*v1 +
jacobi_dn(v2, pi))*v1*e^(-1) + golden_ratio*pi^v1*(1/v3^12 +
jacobi_ds(-10, csc(v3^2)))^(v2 - 1/2/v2)*sinh(v2*e)/((v1 + v2 + v3 +
1)*v2))/(v1^2*inverse_jacobi_nc(v1, -e)) - 2*bessel_Y(v3, v2))/v2 +
v3/inverse_jacobi_sc(1, v2) - (v1 + 1)/((v2 + v3)*(2*(v1 + e)*(v3 - 1)/(pi
+ v1) + (-v3*sech(v1*v3)/v2)^(-e/v1))) + inverse_jacobi_cn(pi + v1*v3, pi
- v3) + jacobi_sn(e, arctanh(-(-log_integral(2) +
log_integral(jacobi_ds(-1, v3)))^v2*e)^(1/7*(18*v2 - v3)*(14*v2 +
e)/(v3*arctan(1/v2)*kronecker_delta(v1, v3))))
sage: timeit('sefms(str(ex))')
5 loops, best of 3: 2.19/2.14/2.15 s per loop (without #6882)
5 loops, best of 3: 2.13/2.11/2.12 s per loop (with #6882)
}}}
It calls 120 times the function `MaximaLib._eval_line()` which takes 17ms
in average = 2 seconds. 17 ms is an eternity. A lot of simplification
attempts are going on in `_eval_line`. For this expression I count ten
calls to `trigsimp`, `trigexpand`, `radcan`, `fullratsimp`. Why would we
want to call Maxima when converting *from Maxima, at all? And if it's
necessary to build the expression, why simplify when it's supposed to be
already simplified?
--
Ticket URL: <http://trac.sagemath.org/ticket/16594>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.