Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

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


  • Prev by Date: Q: How do I format text within a cell of GridBox[]?
  • Next by Date: Re: 3D Graphics suggestions?
  • Previous by thread: Re: Forcing surds into the numerator
  • Next by thread: Re: Forcing surds into the numerator