       • To: mathgroup at smc.vnet.net
• From: Paul Abbott <paul at physics.uwa.edu.au>
• Date: Tue, 9 Nov 2004 01:36:36 -0500 (EST)
• Organization: The University of Western Australia
• References: <cmfc9b\$7k3\$1@smc.vnet.net> <cmhut5\$ppb\$1@smc.vnet.net> <cmklrk\$jm3\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```In article <cmklrk\$jm3\$1 at smc.vnet.net>, motz art <music at heart.com>
wrote:

> Ok; but I was hoping that there is a simpler way than the
> following method  to add  two ac voltage vectors (for example):
>
>                                (220V, 225 degrees)
>                                (100V, 16 degrees)
>
> Clear[r, x, y, Theta, rect, polar]
>
> (* Input vectors here *)
> v1 := {220, 225};
> v2 := {100, 16};

No need for := here. Also, include Degree:

v1 = {220, 225 Degree};
v2 = {100, 16 Degree}

> rect[r_,Theta_] := { r Cos[Theta Pi/180] , r  Sin[Theta Pi/180]}
> polar[x_, y_] := {Sqrt[x^2 + y^2], ArcTan[x, y]180/Pi}

Modify these to

PolarToRectangular[{r_,Theta_}] := {r Cos[Theta] , r Sin[Theta]}

RectangularToPolar[{x_, y_}] := {Sqrt[x^2 + y^2], ArcTan[x, y]/Degree}

Alternatively,

PolarToRectangular[{r_,Theta_}] := r Exp[I Theta]
RectangularToPolar[z_] := {Abs[z], Arg[z]/Degree}

> r1:= rect[v1[], v1[] ] // N;
> r2:= rect[v2[], v2[] ] // N;
> rt := p1 + p2
>
> polar[rt[], rt[]] // N

RectangularToPolar[PolarToRectangular[v1]+PolarToRectangular[v2] // N]

which I find a little less cumbersome.

> This just seems so cumbersome, especially when compared to a
> scientific calculator.

You could, of course, write a palette or program buttons to do this,
just like a scientific calculator.

Cheers,
Paul

> On Sat, 6 Nov 2004 07:36:05 +0000 (UTC), David Bailey
> <dave at Remove_Thisdbailey.co.uk> wrote:
>
> >motz art wrote:
> >> Mathematica v5: How can I input vectors in polar form and
> >> rectangular form?
> >>
> >> Example:
> >>
> >> a:= (r1, theta1) + (r2, theta2)  Polar form.
> >>
> >> b:= (re1 , j* im1) + (re2, j*im2) Rectangular form
> >>
> >> I know this should be pretty basic, but I haven't  found examples
> >> of this kind of input.
> >>
> >> I would guess it would be something like:
> >>
> >>           Polar[magnitude, phase]
> >>           Rectangular[Real, Imaginary]
> >>
> >> but, apparently not.  (This is for  electronics engineering.)
> >>
> >> Thanks for any help.
> >>
> >>
> >>
> >>
> >>
> >You can easily write a function to convert from polar to coordinate form:
> >
> >FromPolar[r_, theta_] := {r Cos[theta], r Sin[theta]}
> >
> >Note that this assumes your angles are measured in radians. Once all
> >your vectors are in coordinate form you can add/subtract then directly:
> >
> >{1,2}+(3,4}
> >
> >produces
> >
> >{4,6}
> >
> >Regards,
> >
> >David Bailey
>

--
Paul Abbott                                   Phone: +61 8 6488 2734
School of Physics, M013                         Fax: +61 8 6488 1014
The University of Western Australia      (CRICOS Provider No 00126G)
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au
AUSTRALIA                            http://physics.uwa.edu.au/~paul

```