Re: Forcing surds into the numerator

*To*: mathgroup at smc.vnet.net*Subject*: [mg64666] Re: Forcing surds into the numerator*From*: bghiggins at ucdavis.edu*Date*: Sun, 26 Feb 2006 05:07:50 -0500 (EST)*References*: <dtp5pv$eq8$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Tony, The difficulty with what you are trying to do is that mathematica always tries to reduce an expression to its simplest form. So the key is to wrap a HoldForm around the surds. Here is a one way to do this SurdFunction[x_] := Module[{num = Numerator[x], denom = Denominator[x], denom1}, denom1 = denom /. Sqrt[y_] -> -Sqrt[y]; (Simplify[num*denom1] /. Sqrt[y_] -> HoldForm[Sqrt[y]])/Simplify[denom*denom1]] SurdFunction[1/(2 - Sqrt[2])] (1/2)*(2 + HoldForm[Sqrt[2]]) SurdFunction[Sin[Pi/12]] (1/4)*HoldForm[Sqrt[2]]*(-1 + HoldForm[Sqrt[3]]) Note that the surds in the output are wrapped with HoldForm to prevent the kernel from trying to simplify the expression. In StandardForm the HoldForm is not visible. To use this expression in another calculation, you need to wrap the output with ReleaseHold. Hope this helps, Cheers, Brian