Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Differencing two equations
Replies: 8   Last Post: Aug 5, 2013 11:07 PM

 Messages: [ Previous | Next ]
 Murray Eisenberg Posts: 16 Registered: 4/14/10
Re: Differencing two equations
Posted: Feb 11, 2013 4:36 AM

Yeah, Mathematica stubbornly refuses to thread Equal over the difference. I seem to recall that there are good design reasons for that.

The following works, but of course is more involved than one might like:

Equal @@ Subtract @@@ {a == r, b == s}

Which is an abbreviated form of:

Apply[Equal, Apply[Subtract, {a == r, b == s}, 1]]

Essentially, you're taking out the equalities and after subtractions putting an equality back.

On Feb 10, 2013, at 3:24 AM, g.c.b.at.home@gmail.com wrote:

> I'm brand new to Mathematica, so I apologize for the naive questions...
>
> I'm trying to figure out how to difference two equations. Basically if I have:
> a==r
> b==s
>
> I'd like to get:
> a-b == r-s
>
> What I'm getting is more like (a==r) - (b==s). I'm not sure how that's a useful result, but is there a function to do what I'm looking for?
>
> A quick search of the archives seem to bring up ways of doing this from using transformation rules to swap heads to unlocking the Equals operator and hacking its behavior. I'd like to avoid doing that kind of rewiring for a simple operation, and I'd like to keep the syntax clean.
>
> The Core Language documentation makes a big point of how everything is basically a list with different heads. In this case, what I'm trying to do would work if it were treated as a list ({a,b}-{r,s} returns {a-b,r-s}) but doesn't work under Equal.
>
> Thanks for any suggestions.

---
Murray Eisenberg murray@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2838 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305

Date Subject Author
2/11/13 Bob Hanlon
8/4/13 Nasser M. Abbasi
8/4/13 Nasser M. Abbasi
2/11/13 Murray Eisenberg
8/5/13 David Bailey
8/5/13 David Park
8/5/13 Bob Hanlon