I am trying to apply a lot of multivariate derivatives to a complex vector 
and I'm attempting to break apart my answer into sub-expressions to reduce 
the number of terms.
To support this in Sage 7.3,  I need to identify subexpressions that can be 
simplified back into my original set of variables.

In this toy example I have a radius variable r,  the norm of the vector 
(x,y,z) .  A simple direct substitution for r works, but it fails when even 
the simplest operations are performed on the variables.

An example follows:


var('x y z', domain='real')  
var('r', domain='positive')  
r2 = x^2 + y^2 + z^2
show(r2.subs(r2 == r^2))
q = (r2 - 3 * r^2)/ (r^3)
show(q)
qr = q.subs(r2 == r^2)
show(qr.simplify())

The result is:

r2
−3r2−x2−y2−z2r3
−3r2−x2−y2−z2r3


So the first substitution of x^2+y^2+z^2 directly for r^2 works fine,  but 
the second case,  which involves a simple rational combination of terms 
fails miserably.  
Is there any way to make this work?  Apparently subs is unable to identify 
the simplest subexpressions.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to