Re: Differencing two equations
- To: mathgroup at smc.vnet.net
- Subject: [mg129792] Re: Differencing two equations
- From: "mathgroup " <fizzymath at knology.net>
- Date: Thu, 14 Feb 2013 02:09:18 -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: <20130213095011.E736468E5@smc.vnet.net>
and much more comprehensible than f@@@Equal@@@, etc.etc.etc. jb -----Original Message----- From: Alexei Boulbitch Sent: Wednesday, February 13, 2013 3:50 AM To: mathgroup at smc.vnet.net Subject: [mg129792] Re: Differencing two equations Dear community, I have seen in this thread a lot of nice approaches that I really admire, but writing simply: eq2 = b == s; eq1 = a == r; eq1[[1]] - eq2[[1]] == eq1[[2]] - eq2[[2]] a - b == r - s is shorter. Have fun, Alexei > a==r > b==s > I'd like to get: > a-b == r-s Hi. Here are a few ideas. v={a==r,b==s}; Equal@@Subtract@@@{v[[All,1]],v[[All,-1]]} a-b==r-s Equal@@Subtract@@@Transpose[List@@@v] a-b==r-s {* I like Inner *) Inner[Subtract,a==r,b==s,Equal] a-b==r-s // or... Inner[Subtract,v[[1]],v[[2]],Equal] a-b==r-s = = = = = = = = = = HTH :>) =E2=80=A8Dana DeLouis Mac & Mathematica 9 =E2=80=A8= = = = = = = = = = On Sunday, February 10, 2013 3:35:06 AM UTC-5, 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. Alexei BOULBITCH, Dr., habil. IEE S.A. ZAE Weiergewan, 11, rue Edmond Reuter, L-5326 Contern, LUXEMBOURG Office phone : +352-2454-2566 Office fax: +352-2454-3566 mobile phone: +49 151 52 40 66 44 e-mail: alexei.boulbitch at iee.lu
- References:
- Re: Differencing two equations
- From: Alexei Boulbitch <Alexei.Boulbitch@iee.lu>
- Re: Differencing two equations