Ask Your Question

Substitution of parameters

asked 2015-12-04 10:05:49 +0200

daniele gravatar image

I would like to understand what is the correct and more efficient way for performing sostitution of parameters in objects of some category.

For example, a typical problem for me is the following. I have a 1-form in an ExteriorAlgebra, whose coefficients depends on some variable, let's say t. I find conditions on such parameters, let's say, t should be zero in order that some property holds. (In general, i will have solutions of linear systems.) I try to use "substitute" for setting the parameter to be 0, but this does not work to me..

E.<x,y> = ExteriorAlgebra(SR)
theta = 3*x+t*y
print "theta = ", theta
theta2 = theta.substitute({t:0})
print "modified theta = ", theta2

Another solution I tried is the following. I assume t==0 at a certain point. But this seems to me to force the substitution before too.

E.<x,y> = ExteriorAlgebra(SR)
theta = 3*x+t*y
print "theta = ", theta
theta2 = theta
print "modified theta = ", theta2

Thanks in advance for any suggestions!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-12-04 11:41:53 +0200

slelievre gravatar image

updated 2015-12-06 16:57:39 +0200

The substitution needs to happen in each coefficient.

The following works.

sage: E.<x,y> = ExteriorAlgebra(SR)
sage: _ = var('t')
sage: theta = 3*x+t*y
sage: print "theta =", theta
theta = 3*x + t*y
sage: theta.map_coefficients(lambda c: c.substitute({t:0}))
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2015-12-04 10:05:49 +0200

Seen: 299 times

Last updated: Dec 06 '15