Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #13459
| From | G B <g.c.b.at.home@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Differencing two equations |
| Date | 2013-02-12 08:23 +0000 |
| Message-ID | <kfcu5k$srh$1@smc.vnet.net> (permalink) |
| References | <kf7m3q$fgi$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
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.
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Differencing two equations g.c.b.at.home@gmail.com - 2013-02-10 08:35 +0000 Re: Differencing two equations Ray Koopman <koopman@sfu.ca> - 2013-02-11 09:36 +0000 Re: Differencing two equations G B <g.c.b.at.home@gmail.com> - 2013-02-12 08:23 +0000 Re: Differencing two equations David Bailey <dave@removedbailey.co.uk> - 2013-02-12 08:23 +0000 Re: Differencing two equations "djmpark" <djmpark@comcast.net> - 2013-02-13 09:47 +0000 Re: Differencing two equations Best Gregory <g.c.b.at.home@gmail.com> - 2013-02-13 09:47 +0000 Re: Differencing two equations John Doty <noqsiaerospace@gmail.com> - 2013-02-14 07:09 +0000 Re: Differencing two equations Youngjoo Chung <ychung12@gmail.com> - 2013-09-08 06:56 +0000
csiph-web