Ticket #2025 (assigned defect)

Opened 10 months ago

Last modified 9 months ago

bug in applying functions to a symbolic matrix

Reported by: was Assigned to: gfurnish (accepted)
Priority: major Milestone: sage-3.2.2
Component: calculus Keywords:
Cc:

Description

Note below that the stupid constant term of the taylor expansion inside the matrix keeps getting pushed off to the far right!

sage: m = matrix(1,[-x/(2*x-4)])
sage: m.apply_map(lambda e: taylor(e,x,0,4))
[x^4/32 + x^3/16 + x^2/8 + x/4]
sage: m.apply_map(lambda e: taylor(e,x,0,4))
[x^4/32 + x^3/16 + x^2/8 + x/4]
sage: m.apply_map(lambda e: taylor(e,x,1,4))
[x + (x - 1)^4 + (x - 1)^3 + (x - 1)^2 - 1/2]
sage: m.apply_map(lambda e: taylor(e,x,2,4))
[-1/(x - 2) - 1/2]
sage: m.apply_map(lambda e: taylor(e,x,3,4))
[x - (x - 3)^4 + (x - 3)^3 - (x - 3)^2 - 9/2]
sage: m[0,0].taylor(x,3,4)
-3/2 + x - 3 - (x - 3)^2 + (x - 3)^3 - (x - 3)^4

Change History

02/01/2008 06:30:57 PM changed by mhansen

This is caused by the following.

sage: a = -x/(2*x-4)
sage: e = lambda e: taylor(e,x,3,4)
sage: b = e(a)._maxima_(); b
x-(x-3)^4+(x-3)^3-(x-3)^2-9/2

I don't know a good/easy way to prevent this from happening.

02/01/2008 06:41:06 PM changed by mhansen

Note that this issue arises from using Maxima internally for symbolic matrices. If we use Sage's generic matrices over SR, then this isn't an issue.

One possible fix would be to add a simplify=False option to tell maxima not to use any simplification rules when constructing the object.

03/16/2008 01:10:56 PM changed by gfurnish

  • owner changed from was to gfurnish.
  • status changed from new to assigned.