Re: BothSides.m
- To: mathgroup at smc.vnet.net
- Subject: [mg80089] Re: BothSides.m
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sun, 12 Aug 2007 07:18:03 -0400 (EDT)
- References: <f9jlf6$3hv$1@smc.vnet.net>
Hi,
oh thats wonderful and much simpler an easier to read than
2 a/b - 4 == c
4 + # & /@ %
#*b/2 & /@ %
But you should keep in mind that % is from the days where
Mathematica run without a FrontEnd on a ASCII terminal and
the usage of % will make the reevaluation of you notebook
(where you can jump between input cell 1, 42 and 100 forward
and backward) rather unpredictable.
If you hide this in a package, I'm sure that you will not understand
the results in you notebook after 5 minutes of working.
Regards
Jens
AngleWyrm wrote:
> Here's a handy little package for working with equations.
>
> Example in[1]:=
>
> <<BothSides`
> 2 a/b - 4 == c // TraditionalForm
> BothSides[Plus, 4]
> BothSides[Times, b/2]
>
> -----| BothSides.m |----
> BeginPackage["BothSides`"]
>
> BothSides::usage =
> "BothSides[f,v] applies function f[v,%] to previous output.
> BothSides[Plus,5] will add 5 to both sides of an expression."
>
> BothSides[f_, v_] := Module[ {a = Apply[List, %]},
> a = Thread[ f[v, a] ];
> Apply[Equal, a]
> ];
>
> EndPackage[ ]
>
>
>