Re: Modifying equations
- To: mathgroup at smc.vnet.net
- Subject: [mg59170] Re: Modifying equations
- From: Peter Pein <petsie at dordos.net>
- Date: Sun, 31 Jul 2005 01:30:43 -0400 (EDT)
- References: <dcf38r$lfr$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Kalle Rutanen schrieb:
> Hello
>
> My intention is to write a mathematical paper which derives results step by
> step. So here is my first question:
>
> Given the equations
> eqn1 = a == b
> eqn2 = c == d
>
> How can I combine these to form (for example)
> a + c == b + d ?
>
> I tried the obvious eqn1 + eqn2, but that does not seem to work...
>
> Second question:
>
> Given this:
> Sum[a_i, {i, 0, n}] + Sum[b_i, {i, 0, n}]
> How can I make Mathematica combine the sums giving:
> Sum[a_i + b_i, {i, 0, n}] ?
>
> Thanks.
>
>
try
1. Thread[eq1 + eq2, Equal]
2.
Unprotect[Sum];
Sum /: Sum[a_, {n_, n0_, n1_}] + Sum[b_, {n_, n0_, n1_}] :=
Sum[a + b, {n, n0, n}];
Protect[Sum];
Sum[Cos[n^2*x], {n, 0, m}] + Sum[Sin[n^2*x], {n, 0, m}]
-->
Sum[Cos[n^2*x] + Sin[n^2*x], {n, 0, n}]
--
Peter Pein
Berlin
http://people.freenet.de/Peter_Berlin/