Re: Rationalizing the denominator

• To: mathgroup at smc.vnet.net
• Subject: [mg18717] Re: [mg18633] Rationalizing the denominator
• From: "Drago Ganic" <drago.ganic at in2.hr>
• Date: Sat, 17 Jul 1999 02:36:38 -0400
• Organization: HiNet
• References: <7mjtfu\$flc@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Thank you both for the answers.

I'm surprised that this newsgroup, unlike others, is positively oriented to
newcomers questions.

Drago

Tomas Garza <tgarza at mail.internet.com.mx> wrote in message
news:7mjtfu\$flc at smc.vnet.net...
> Drago Ganic [drago.ganic at in2.hr] wrote:
>
> > How can I get
> >
> >     Sqrt[2]/2
> >
> >
> >     1/Sqrt[2]
> >
> > as a result for Sin[Pi/4].
> >
> > When it comes to complex numbers Mathematica never returns 1/I -
> > she always
> > returns -I.
> > Why is the behaviour for irrationals different ?
>
> Hi, Drago!
>
> As often has been the advise in this group, look at FullForm:
>
> In[1]:=
>   1/Sqrt[2] // FullForm
>
> Out[1]//FullForm=
> Power[2, Rational[-1, 2]]
>
> You can't expect Mathematica to go back from this to the "rational" form
> Sqrt[x]/x. In fact, if you write Sqrt[x]/x you'll get 1/Sqrt[x]:
>
> In[2]:=
> Sqrt[x]/x
> Out[2]=
> 1/Sqrt[x]
>
> Of course, if you still want to "rationalize" 1/Sqrt[x] you may use a
> transformation rule together with HoldForm:
>
> In[3]:=
> Sin[Pi/4] /.
>   Power[x_, Rational[-1, 2]] ->
>     HoldForm[Power[x, Rational[1, 2]]*Power[x, -1]]
> Out[3]=
> Sqrt[2]/2
>
> which, from the point of view of Mathematica, is a waste of time since
this
> last expression, if released, will be always return 1/Sqrt[2] as shown in
> In[2] above:
>
> In[4]:=
> ReleaseHold[%]
> Out[4]=
> 1/Sqrt[2]
>
> On the other hand,
>
> In[5]:=
> 1/I // FullForm
> Out[5]//FullForm=
> Complex[0, -1]
>
> which explains why 1/I returns -I. The behavior is consistent: internally,
> Mathematica has no division.
>
> Tomas Garza
> Mexico City
>
>

```

• Prev by Date: Re: Rudimentary Spell Checker
• Next by Date: Re: Menu Control
• Previous by thread: Re: Rationalizing the denominator
• Next by thread: Concurrent Curve Fitting... II