Opened 12 years ago

Closed 12 years ago

#6376 closed defect (duplicate)

serious bug in _maxima_init_ method for formal derivatives with new symbolics

Reported by: was Owned by: burcin
Priority: critical Milestone: sage-duplicate/invalid/wontfix
Component: calculus Keywords:
Cc: gmhossain, mhansen Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

sage: f(x) = function('f',x)
sage: g = f(-x).diff(x); g
-D[0](f)(-x)
sage: g._maxima_init_()
"(diff('f(x), x, 1))*(-1)"

Notice that the -x inside f is totally ignored! This is because of code in the derivative method around line 454 of sage/symbolic/expression_conversion.py

Changing the line

args = ex.args()

to

args = ex.operands()

"fixes" the problem, in that a NotImplementedError? gets raised, instead of a wrong result returned. This is way better than the current situation, and we better fix this asap.

A better fix of course is to implement proper conversion. mhansen wrote this code, so maybe it would be easy for him.

Change History (6)

comment:1 Changed 12 years ago by gmhossain

  • Cc gmhossain added

comment:2 Changed 12 years ago by burcin

  • Cc mhansen added

Mike, do you have any time to look at this?

Thanks.

Burcin

comment:3 Changed 12 years ago by robert.marik

fixed with patch at #7401 which waits for review.

sage: f(x) = function('f',x)
sage: g = f(-x).diff(x); g
-D[0](f)(-x)
sage: g._maxima_init_()
"(at(diff('f(dummy_var_der), dummy_var_der,1),dummy_var_der=-x))*(-1)"

comment:4 Changed 12 years ago by robert.marik

  • Status changed from new to needs_review

The patch is attached to #7401

#6376 is not doctested, since I did not know about this issue when finished patch for #7401. It could be easily doctested, but doctests in #7401 are equivalent to #6376.

comment:5 Changed 12 years ago by kcrisman

  • Status changed from needs_review to positive_review

Okay, this seems okay.

To release manager: please close this as fixed once #6376 is merged.

comment:6 Changed 12 years ago by mhansen

  • Milestone changed from sage-4.3 to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.