       Re: Convert function from polar to Cartesian

• To: mathgroup at smc.vnet.net
• Subject: [mg112783] Re: Convert function from polar to Cartesian
• From: Peter Breitfeld <phbrf at t-online.de>
• Date: Thu, 30 Sep 2010 04:52:15 -0400 (EDT)
• References: <i7usgt\$rdn\$1@smc.vnet.net>

```Sam Takoy wrote:

> Hi,
>
> I've stumbled onto an unexpected problem. I have a function in polar
> coordinate and I need to convert it to Cartesian coordinates:
>
> fPolar[r_, a_] = r^2 Cos[2 a];
> fCart[x_, y_] = fPolar[Sqrt[x^2 + y^2], ArcTan[x, y]];
> fCart[x, y]
>
> I get: (x^2 + y^2) Cos[2 ArcTan[x, y]].
>
> But how to get rid of the ArcTan[x, y]? I've tried this:
>
> fCart[x, y] //
>   TrigExpand /. {Cos[ArcTan[x, y]] -> x/Sqrt[x^2 + y^2],
>     Sin[ArcTan[x, y]] -> y/Sqrt[x^2 + y^2]}
>
> but it does not do the substitution I need it to do. So what's the
> proper way to get rid of the ArcTan[x, y] and for the simple example
> above, to obtain x^2 - y^2?
>
>
>
> Sam
>

I think you can't always get rid of the ArcTan, but this works for your
case:

cartRule = {r -> Sqrt[x^2 + y^2], a -> ArcTan[x, y]};

(((fPolar[r, a] // TrigToExp) /. cartRule) // FullSimplify) // Expand

Out= x^2 - y^2

--
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de

```

• Prev by Date: Re: Convert function from polar to Cartesian
• Next by Date: How to unflatten an array ?
• Previous by thread: Re: Convert function from polar to Cartesian
• Next by thread: Poisson's integral formula doesn't work