MathGroup Archive 1998

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

Search the Archive

Re: Adding equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14403] Re: Adding equations
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Sun, 18 Oct 1998 15:10:08 -0400
  • Organization: University of Western Australia
  • References: <703u1n$hup@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Lawrence Walker wrote:

> 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?

If you modify Equal as follows (as suggested by Roman Maeder) then any
Listable operations are automatically applied to both sides of any
equality:

Unprotect[Equal]; 

listableQ[f_] := MemberQ[Attributes[f], Listable]

Equal/: lhs:(f_Symbol)?listableQ[___, _Equal, ___] := 
   Thread[Unevaluated[lhs], Equal]

Protect[Equal]; 

Cheers,
	Paul

____________________________________________________________________ 
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia            Nedlands WA  6907       
mailto:paul at physics.uwa.edu.au  AUSTRALIA                       
http://www.physics.uwa.edu.au/~paul

            God IS a weakly left-handed dice player
____________________________________________________________________


  • Prev by Date: Re: Adding equations
  • Next by Date: Re: Routines inside Epilog
  • Previous by thread: Re: Adding equations
  • Next by thread: Re: Adding equations