Ticket #2341 (assigned defect)

Opened 10 months ago

Last modified 8 months ago

vector subs over symbolic does not work

Reported by: was Assigned to: gfurnish (accepted)
Priority: major Milestone: sage-3.4
Component: linear algebra Keywords:
Cc:

Description

Ricardo Massaro to sage-devel
	
show details 8:28 PM (18 minutes ago)
	
	
Reply
	
	

Hello all,

First of all, I'd like to thank you for Sage, it's really helping me a
lot.

I found a strange behavior that i *think* it's a bug, but I'm not
sure, since I'm a completely newbie to Sage and Python:

sage: a = var('a')
sage: m = matrix(SR, 2, [a,a,a,a])
sage: v = vector(SR, 2, [a,a])

Then,

sage: m.subs(a=1)
[1 1]
[1 1]

but

sage: v.subs(a=1)
(a, a)

I *think* the problem is in the Element.subs() method in devel/sage/
sage/structure/element.pyx. It seems to assume that the generators are
symbols, which is not true in the example vector.

Am I missing something, or is it really a bug?

Here's a dirty fix that apparently fixes this problem, but will likely
beak something else:

   def subs(self, in_dict=None, **kwds):
       v = [a.subs(in_dict, **kwds) for a in self.list()]
       return self.parent()(v)

Thanks,
Ricardo

Change History

04/09/2008 09:38:36 PM changed by gfurnish

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

05/21/2008 09:46:46 AM changed by gfurnish

Fixed in symbolics rewrite.