ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 04 Dec 2014 07:46:29 -0600Substitute variable in expressionhttp://ask.sagemath.org/question/25119/substitute-variable-in-expression/ Hello, I have to do a substitution in an expression: i want to substitute diff(psi) with omega, where i declared psi as psi =
function('psi',t)
I tried doing expr.substitute(diff(psi)==omega) but it doesn't work.
What do I have to do?
Thank you very much.SilviaThu, 04 Dec 2014 07:46:29 -0600http://ask.sagemath.org/question/25119/Substitution of a list of variableshttp://ask.sagemath.org/question/10606/substitution-of-a-list-of-variables/I wish substituting a list of variables, without having to substitute them 1 by 1.
Here is an example with an attempt which doesn't work :
sage: V=[var('x_%d' % i) for i in range(10)]; V
[x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9]
sage: S=[sum(V),prod(V)]; S
[x_0 + x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 + x_8 + x_9,
x_0*x_1*x_2*x_3*x_4*x_5*x_6*x_7*x_8*x_9]
sage: for i in range(10):
....: S.subs(V[i]=i)
....:
File "<ipython-input-99-7670392e3358>", line 2
SyntaxError: keyword can't be an expression
How can we do this ?
Sébastien PalcouxSun, 13 Oct 2013 12:44:43 -0500http://ask.sagemath.org/question/10606/Change of variable in an integrationhttp://ask.sagemath.org/question/8679/change-of-variable-in-an-integration/How to indicate a change of variable to Sage in an integration when Sage seems clueless?Green diodSat, 28 Jan 2012 11:59:27 -0600http://ask.sagemath.org/question/8679/