[sage-support] Re: Updating variables or recursive substitution

2013-09-26 Thread jorges
On Thursday, 26 September 2013 17:13:28 UTC-3, Nils Bruin wrote: <...> > The problem is that subs expects the keys for its dictionary to be > symbolic variables, not strings. If you do > > sage: P2={SR(k):v for k,v in params.iteritems()} > sage: (sols[0][0].rhs()).subs(P2) > > it should work.

[sage-support] Re: Updating variables or recursive substitution

2013-09-26 Thread Nils Bruin
On Thursday, September 26, 2013 10:52:56 AM UTC-7, jorges wrote: > > > - > > sage: a1=1; b1=-2; c1=3 > sage: na1=1; nb1=-2; nc1=3 > sage: params=dict(a1=a1, b1=b1, c1=c1) > sage: params1=dict(a1=na1, b1=nb1, c1=nc1) > sage: params2=dict(a1=1, b1=-2, c1=3) > sage: (sols[0][0].rhs()).subs(param

Re: [sage-support] Evaluate all expressions

2013-09-26 Thread Michael Orlitzky
On 09/25/2013 03:24 PM, Bassie wrote: > Hello > > Can you evaluate all expressions at one? Like say, if i made a > mistake 5 expressions before my last expression, and this mistake is > reapeated in all the 5 last expressions, do I have to evaluate all 5 > expressions? > When you have enough cod

[sage-support] Re: Updating variables or recursive substitution

2013-09-26 Thread jorges
On Thursday, 26 September 2013 13:11:12 UTC-3, kcrisman wrote: > > > This is just a thought - would creating a dictionary of your parameters > help? Then you can just substitute the dictionary once you've created it, > eliminating at least a little tedium or error potential... In your second

[sage-support] Re: Updating variables or recursive substitution

2013-09-26 Thread kcrisman
On Thursday, September 26, 2013 10:46:15 AM UTC-4, jorges wrote: > > Hi, > I am working on the analytical solution to a specific problem. Nothing > special, I guess, just a few 2nd order differential equations. The real > burden, and thus the motivation for using sage, is that the resulting >

[sage-support] Re: Updating variables or recursive substitution

2013-09-26 Thread jorges
Sorry, I left the references out: [1] http://ask.sagemath.org/question/1981/how-to-recursively-substitute-from-global-name [2] http://ask.sagemath.org/question/2545/is-there-a-way-to-update-an-expression-with-new On Thursday, 26 September 2013 11:46:15 UTC-3, jorges wrote: > > Hi, > I am worki

[sage-support] Updating variables or recursive substitution

2013-09-26 Thread jorges
Hi, I am working on the analytical solution to a specific problem. Nothing special, I guess, just a few 2nd order differential equations. The real burden, and thus the motivation for using sage, is that the resulting equations are long and thus the possibility of introducing small typos or erro

Re: [sage-support] Re: Evaluate all expressions

2013-09-26 Thread Jori Mantysalo
On Wed, 25 Sep 2013, kcrisman wrote: This is pretty vague, but ... assuming that you are using the expression like a = 2 print a print a+1 print a+2 print a+3 and a should have been 4, then yes, you would have to evaluate them all. Sage uses readline, like bash. In bash I can use ! -command: