Ask Your Question

simplify_full() and symbolic vectors

asked 2011-09-20 10:37:30 -0500

__jacques__ gravatar image

updated 2011-09-20 10:38:22 -0500

First, the question:

Suppose I've constructed some vectors with symbolic entries, call them P0 and P1. Calling simplify_full on them will -- apparently by changes introduced in the latest version (#11335 and #11381)! -- do an elementwise simplification. Great!

Suppose I construct a new symbolic vector by, say, interpolating between P0 and P1:

Pt = (1-t)*P0 + t*P1




Traceback (click to the left of this block for traceback)
object has no attribute 'simplify_full'





work just fine. Somehow the symbolic vector-ness is forgotten in the construction of Pt.

Am I doing something wrong?

Then, the disclaimer:

A friend pointed me to Sage today, and this is the first thing I'm trying to do with it -- I do have background in some other symbolic tools, but this may just be a Stupid User Error despite giving this my best shot and looking at documentation.

Anyway, I'm very impressed with what I'm seeing when I look at Sage.

(For completeness' sake, here's a full example:

P0=vector([0, C1*w/(C1*w+C0) - w/(w+C0/C1)])
P1=vector([cos(x)/sin(x)*tan(x)-1, 0])

Now both


return (0,0) as they should. But


returns the above error.)

edit retag flag offensive close merge delete

3 answers

Sort by » oldest newest most voted

answered 2011-09-20 12:39:42 -0500

parzan gravatar image

updated 2011-09-20 12:41:40 -0500

Here is a workaround:


It seems that the Vector_symbolic_dense class is quite new (judging by the content of Even basic operations are not yet implemented:

sage: type(P0)
<class 'sage.modules.vector_symbolic_dense.Vector_symbolic_dense'>
sage: type(P0+P0)
<type 'sage.modules.free_module_element.FreeModuleElement_generic_dense'>
sage: type(2*P0)
<type 'sage.modules.free_module_element.FreeModuleElement_generic_dense'>

(I think addition and scalar multiplication are desirable for a class implementing vectors). For some reason vector needs a list as input (or a tuple, but not a symbolic vector) in order to produce a symbolic vector:

sage: type(vector(P0+P0))
<type 'sage.modules.free_module_element.FreeModuleElement_generic_dense'>
sage: type(vector(list(P0+P0)))
<class 'sage.modules.vector_symbolic_dense.Vector_symbolic_dense'>
edit flag offensive delete link more


That indeed works. Awesome, thanks a lot! Judging from what you're saying, this could be worth a feature request. I'll dig around for where I can file one.

__jacques__ gravatar image__jacques__ ( 2011-09-20 21:56:36 -0500 )edit

See for this. Yes, please do file this - and as a BUG, not an enhancement, since it is certainly a bug that this doesn't work.

kcrisman gravatar imagekcrisman ( 2011-09-21 02:29:42 -0500 )edit

answered 2011-09-20 11:14:26 -0500

kcrisman gravatar image

Here is the problem.

sage: type(P0)
<class 'sage.modules.vector_symbolic_dense.Vector_symbolic_dense'>
sage: Pt=(1-t)*P0+t*P1
sage: type(P1)
<class 'sage.modules.vector_symbolic_dense.Vector_symbolic_dense'>
sage: type(Pt)
<type 'sage.modules.free_module_element.FreeModuleElement_generic_dense'>

I don't have time to look for a workaround now, but this is why you get that AttributeError. I don't know how easy it would be to make Pt get back in the vector type.

edit flag offensive delete link more


Thanks; makes sense!

__jacques__ gravatar image__jacques__ ( 2011-09-20 21:56:15 -0500 )edit

answered 2011-09-21 10:00:39 -0500

This was fixed by #11549. The fix will be available in Sage 4.7.2.

You can apply the changes on that ticket to your copy of Sage using these instructions from the developer guide.

edit flag offensive delete link more


Awesome, thanks for the pointer. For some reason this didn't come up in my original search.

__jacques__ gravatar image__jacques__ ( 2011-09-23 23:34:32 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-09-20 10:37:30 -0500

Seen: 741 times

Last updated: Sep 21 '11