On 04/09/12 22:18, ancienthart wrote:
> Hah. Thanks Michael and P. I first learnt Python in the 1.5 era, so
> there's a few of the nice new syntax features I'm still not up to speed on.
> Any reason why .subs doesn't accept multiple arguments? Would there be
> any point in requesting .subs_expr become the new default on trac?
`subs` accepts multiple arguments too, and will generally work like a
function call with named arguments if you want it to.
sage: x,y,z = var('x,y,z')
sage: f = x + y + z
sage: f(x=1, y=2, z=3)
6
sage: f.subs(x=1, y=2, z=3)
6
sage: f.subs({x: 1, y: 2, z: 3})
6
Passing it one equation does work,
sage: f.subs(x == 1)
y + z + 1
But more than one doesn't,
sage: f.subs(x == 1, y == 2)
...
TypeError: substitute() takes at most 1 positional argument (2 given)
I guess all that's missing is the ability to pass it multiple equations,
like `subs_expr`. It would probably be easy to add that ability to
`subs` if you want to create a ticket for something.
--
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
URL: http://www.sagemath.org