Dear all,
I noticed that some of my old code does not work any more with sage
4.0.
I used to assign the solutions of equations by referring to them in
the following way:
----------------------------------------------------------------------
| Sage Version 4.0, Release Date: 2009-05-29 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: var('x y')
(x, y)
sage: soln = solve(y == x^3 -2, x)
sage: x1 = soln[0][2]
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/Users/sschym/<ipython console> in <module>()
TypeError: 'sage.symbolic.expression.Expression' object is unindexable
This works now:
sage: x1 = soln[0].rhs()
sage: x1
1/2*(I*sqrt(3) - 1)*(y + 2)^(1/3)
Is there a way to make soln[0][2] work again? Otherwise I would have
to change most of my notebooks!
Another issue is that the substitute command now expects dictionary
entries without quotations, so that my previous use of the subs
command does not work any more:
sage: pars = dict(y=2)
sage: pars
{'y': 2}
sage: x1.subs(pars)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
...
This works now:
sage: x1.subs({y:2})
1/2*(I*sqrt(3) - 1)*4^(1/3)
Is there an easy way of getting my old notebooks to work with Sage
4.0? Is there an easy way to create dictionaries without the
quotations for use in subs()??
Thanks for your help!
Stan
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---