#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      |          Keywords:  subs algebra solving
Work issues:               |   Report Upstream:  N/A                 
  Reviewers:               |           Authors:  Michael Orlitzky    
  Merged in:               |      Dependencies:                      
   Stopgaps:               |  
---------------------------+------------------------------------------------
 This came up as a method of passing solutions from solve back into
 symbolic equations:


 {{{
     f(x,y) = (1-x)^2 + 100*(y - x^2)^2

     solution = solve([f.diff(ar) for ar in f.args()],f.args())[0]


 Gives me a list of solutions as:

     [x=1;y=1]


 Is there any way to programatically substitute this list of equalities
 back into f?
 }}}

 The solution provided by Michael Orlitzky was

 {{{
 f(x,y).subs_expr(*solution)
 }}}

 Anycase, as noted by Michael, it would be nice if subs had the same
 behaviour:

 {{{
 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.
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12834>
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.

Reply via email to