Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Modifying equations

  • To: mathgroup at
  • Subject: [mg59164] Re: Modifying equations
  • From: dh <dh at>
  • Date: Sun, 31 Jul 2005 01:30:39 -0400 (EDT)
  • References: <dcf38r$lfr$>
  • Sender: owner-wri-mathgroup at

Hi Kalle,
see below.
sincerely Daniel

Kalle Rutanen wrote:
> 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 ?
you must thread Plus over the head Equal:

Thread[Plus[eqn1, eqn2], Equal]
> 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}] ?
this can be done e.g. by a rule:
r = HoldPattern[Sum[f1_, {i, 0,
       n}] + Sum[f2_, {i, 0, n}]] :> Sum[f1 + f2, {i, 0, n}];
The HoldPattern is needed because f1 and f2 do not explicitely mention i 
and Mathematica would otherwise take f1 and f2 as independent of i. 
Application of this rule gives the result you want:
Sum[a[i], {i, 0, n}] + Sum[b[i], {i, 0, n}] /. r

note that your example a_i and b_i is WRONG. Either you can define a and 
b as functions od i and would write a[i] and b[i] or you take it as 
arrays: a[[i]], b[[i]]

> Thanks.

  • Prev by Date: Re: Mathematica's CPU utilization
  • Next by Date: Re: Modifying equations
  • Previous by thread: Re: Modifying equations
  • Next by thread: Re: Modifying equations