#12834: Modify subs so that it can accept multiple equations just like subs_expr
----------------------------------------+-----------------------------------
Reporter: JoalHeagney | Owner: AlexGhitza
Type: enhancement | Status: new
Priority: minor | Milestone: sage-5.0
Component: algebra | Resolution:
Keywords: subs algebra solving | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Michael Orlitzky | Merged in:
Dependencies: | Stopgaps:
----------------------------------------+-----------------------------------
Comment (by nbruin):
`subs_expr` is already just doing a bit of preprocessing and then calling
`subs`, so if the interface of `subs` is changed to accept a wider variety
of input then subs_expr can simply be done away with. I'd say
{{{
subs(self,*args,**kwargs):
for k in args:
if is_symbolic_equation(k):
kwargs[k.lhs()]=k.rhs() # but signal an error if key k is
already present
elif is_dict(k):
add entries of k to kwargs # but signal error any key in k is
already in kwargs.
elif is_iterable(k):
for e in k:
if is_symbolic_equation(e):
same as before
else:
error
else:
error
...
}}}
Note that behaviour at the moment is a bit random:
{{{
sage: x.subs({x:1})
1
sage: x.subs({x:1},x=2)
2
sage: x.subs(x==1,x=2)
1
sage: x.subs(x=1,x=2)
SyntaxError: keyword argument repeated
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12834#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
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-trac?hl=en.