Re: Adding equations
- To: mathgroup at smc.vnet.net
- Subject: [mg14406] Re: Adding equations
- From: graciark at ippt.gov.pl (Adam Ciarkowski)
- Date: Sun, 18 Oct 1998 15:10:10 -0400
- Organization: IPPT PAN
- References: <703u1n$hup@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <703u1n$hup at smc.vnet.net>, lwalker701 at earthlink.net says...
[...]
>Is there a way to elegantly add (sub, mult, div) two equations? Also is
>there an elegant way to add (sub, mult, div) an expression to both
>sides of an equation?
>
>Lawrence Walker
>
>
One possible approach:
1. Adding (subtracting, multiplying, dividing) of two equations:
In[1]:= Inner[Plus, {a,b}, {c,d}, Equal]
Out[1]= a+c==b+d.
Replace Plus by Subtract, Times or Divide to obtain the three remaining
operations, respectively.
2. Adding the quantity c (subtracting, multiplying, dividing) to each side of the
equation a==b:
In[2]:= Inner[Plus, {a,b}, {c,c}, Equal]
Out[2]= a+c==b+c
with the same remark as above, or
In[3]:= h[y_][eq_]:=eq+y (* or h[y_][eq_]:=eq*y or h[y_][eq_]:=eq/y *)
In[4]:= Map[ h[c], Equal[a,b]]
Out[4]= a+c==b+c
But is it more elegant than the "natural" approach???...
Adam
........
(remove gr from my e-mail address)