       Re: Differencing two equations

• To: mathgroup at smc.vnet.net
• Subject: [mg129769] Re: Differencing two equations
• From: G B <g.c.b.at.home at gmail.com>
• Date: Tue, 12 Feb 2013 03:24:02 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-newout@smc.vnet.net
• Delivered-to: mathgroup-newsend@smc.vnet.net
• References: <kf7m3q\$fgi\$1@smc.vnet.net>

```Thanks for all of the suggestions.

It looks like this idiom is best for me:  Inner[Subtract, a == r, b ==
= s, Equal]

Aesthetically I slightly prefer the syntax of "Equal @@ Subtract @@@ {a == r, b == s}" but it doesn't work consistently on more complex expressions-- I sometimes wind up with a-s==r-b (which is correct, of course, but not what I wanted).

I may wind up with a variant of this in the end:
eqnOperate[eqn1_, eqn2_, f_] :=
Equal @@ f @@ {List @@ eqn1, List @@ eqn2};

Maybe there's a mathematical reason why simple operations on equations aren't handled as I'd expect.  Mathematica is clearly a powerful tool, but the few times I've tried picking it up in the past I wind up getting stymied by the obtuse syntax for certain simple operations.

In this case, I could probably use the power of the tool all at once by simply treating my set of equations as a unit and asking Mathematica to reason about them as a group and solve my problem directly.  The problem is that I, and my audience, could probably gain some insight into the problem by working through a few of the intermediate results.  By treating my equations lexically, rather than mathematically, I'm forgoing Mathematica's expertise and only allowing it to ensure I don't make transcription errors.

On Sunday, February 10, 2013 12:35:06 AM UTC-8, G B 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.

```

• Prev by Date: Factoring a polynomial with many variables
• Next by Date: Re: Differencing two equations
• Previous by thread: Re: Differencing two equations
• Next by thread: Re: Differencing two equations