#12834: Modify subs so that it can accept multiple equations just like subs_expr
-------------------------------------+-------------------------------------
       Reporter:  JoalHeagney        |        Owner:  AlexGhitza
           Type:  enhancement        |       Status:  needs_work
       Priority:  minor              |    Milestone:  sage-6.4
      Component:  algebra            |   Resolution:
       Keywords:  subs algebra       |    Merged in:
  solving                            |    Reviewers:  Vincent Delecroix,
        Authors:  Michael Orlitzky,  |  Michael Orlitzky
  Vincent Delecroix                  |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  24b98a061c140e9f76b171eb3dd1be0fa44d36b8
  u/mjo/ticket/12834                 |     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------
Changes (by vdelecroix):

 * status:  needs_review => needs_work


Comment:

 Hello,

 I do not agree with your `05492f4` and `0d34382`. First of all, if
 something is wrong, then it is not a big deal to go through the
 dictionaries again. Your version is way much too complicated. Please do
 something along
 {{{
 dup = [k for k in d2 if k in d1]
 if dup:
     k = min(dup)
     msg = "duplicate substitution for {}, got values {} and {}"
     raise ValueError(msg.format(k, d1[k], d2[k]))
 }}}
 And you can remark that I iterated over `d2` and this was intentional. The
 dictionary `d1` is intended to be large compared to `d2` (think about
 `expr.subs(u == 18, v == 15, w == 19, x == 1, y == 2, z == 3)`). In your
 commit you reversed that. And you should know that to get the minimum of a
 list you do not need to sort it ;-) Was the call to `sorted` intentional
 compared to `min`?

 If you have access to `Maple/Mathematica` I would be curious to know what
 they do for
 {{{
 sage: (x + x^2 + x^4).subs(x + x^2 == 2)
 }}}

 The other changes are fine to me.

 Vincent

--
Ticket URL: <http://trac.sagemath.org/ticket/12834#comment:23>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to