Opened 4 years ago

Last modified 13 months ago

#23445 needs_info defect

maxima parser not smart enough

Reported by: vdelecroix Owned by:
Priority: major Milestone: sage-8.1
Component: interfaces Keywords: symbolic
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: u/chapoton/23445 (Commits, GitHub, GitLab) Commit: fd3436bd3c3fc0b7d09a235c7ca90f15cedf45e0
Dependencies: Stopgaps:

Status badges

Description (last modified by vdelecroix)

As found in this post on the function desolve_system can fail with weird error message

sage: t = var('t')
sage: f = function('f')(t)
sage: g = function('g')(t)
sage: de1 = diff(f,t) == f*sin(t)
sage: de2 = diff(g,t) == 0
sage: desolve_system([de1, de2], [f,g])
Traceback (most recent call last):
<ipython-input-1-58fe9994eeb3> in <module>()
      2 de1 = diff(f,t) == f*sin(t);
      3 de2 = diff(g,t) == Integer(0);
----> 4 desolve_system([de1, de2], [f,g])

.../sage/calculus/desolvers.pyc in desolve_system(des, vars, ics, ivar)
    838     for i, sol in enumerate(soln):
    839         print(sol)
--> 840         soln[i] = sol.sage()
    841     if ics is not None:
    842         ivar_ic = ics[0]
ValueError: The name "+" is not a valid Python identifier.

The reason is that the .sage() method is not able to convert the maxima's answer back into Sage

f(_SAGE_VAR_t) = ilt((%i laplace(f(_SAGE_VAR_t), _SAGE_VAR_t, g2579 + %i)
 - %i laplace(f(_SAGE_VAR_t), _SAGE_VAR_t, g2579 - %i) + 2 f(0))/(2 g2579), 
g2579, _SAGE_VAR_t)

Change History (4)

comment:1 Changed 4 years ago by vdelecroix

  • Description modified (diff)

comment:2 Changed 3 years ago by egourgoulhon

The bug seems to be still there, see this recent ask.sagemath question.

comment:3 Changed 13 months ago by chapoton

simpler way to trigger the same error:

        sage: from sage.calculus.calculus import dummy_laplace
        sage: s,t = var('s,t')
        sage: f = function('f')
        sage: dummy_laplace(f(t),t,s+1)

comment:4 Changed 13 months ago by chapoton

  • Branch set to u/chapoton/23445
  • Commit set to fd3436bd3c3fc0b7d09a235c7ca90f15cedf45e0
  • Status changed from new to needs_info

not totally convinced by the "fix"

New commits:

fd3436bthird args in laplace and inverse_laplace
Note: See TracTickets for help on using tickets.