Opened 5 years ago

Last modified 7 weeks ago

#23445 needs_work defect

maxima parser not smart enough

Reported by: vdelecroix Owned by:
Priority: major Milestone: sage-9.7
Component: interfaces Keywords: symbolic
Cc: Merged in:
Authors: Frédéric Chapoton Reviewers:
Report Upstream: N/A Work issues:
Branch: u/chapoton/23445 (Commits, GitHub, GitLab) Commit: c34e15559179b5151af87b5db398c1ef9a1c0c4a
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 (13)

comment:1 Changed 5 years ago by vdelecroix

  • Description modified (diff)

comment:2 Changed 4 years ago by egourgoulhon

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

comment:3 Changed 21 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 21 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

comment:5 Changed 4 months ago by chapoton

  • Milestone changed from sage-8.1 to sage-9.6
  • Status changed from needs_info to needs_review

comment:6 Changed 4 months ago by vdelecroix

What about a doctest?

comment:7 Changed 4 months ago by git

  • Commit changed from fd3436bd3c3fc0b7d09a235c7ca90f15cedf45e0 to c34e15559179b5151af87b5db398c1ef9a1c0c4a

Branch pushed to git repo; I updated commit sha1. New commits:

759a65dMerge branch 'u/chapoton/23445' in 9.6.rc0
c34e155add doctest

comment:8 Changed 4 months ago by chapoton


mais il reste un probleme de non-oubli (permanence) de la fonction g

comment:9 Changed 3 months ago by mkoeppe

  • Milestone changed from sage-9.6 to sage-9.7

comment:10 Changed 2 months ago by mkoeppe

author name

comment:11 Changed 2 months ago by slelievre

  • Authors set to Frédéric Chapoton

comment:12 Changed 2 months ago by chapoton

as said in comment:8, there remains a problem about not forgetting g, which causes a failing doctest

comment:13 Changed 7 weeks ago by chapoton

  • Status changed from needs_review to needs_work
Note: See TracTickets for help on using tickets.