Re: Adding Vectors -- Newbie help please
- To: mathgroup at smc.vnet.net
- Subject: [mg52039] Re: Adding Vectors -- Newbie help please
- From: Peter Breitfeld <phbrf at t-online.de>
- Date: Mon, 8 Nov 2004 03:13:20 -0500 (EST)
- References: <cmfc9b$7k3$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
motz art schrieb: > 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 > You could write two simple functions: pf[a_,d_]:=N[a E^(I d Degree)] polar[z_]:={Abs[z*1.],Arg[z*1.]/Degree"\[Degree]"} (the "*1." are added to force numerical evaluation) then you enter your values using pf: In[1]:= sum=pf[10,30]+pf[20,45] Out[1]= 22.8024+19.1421 I (rectangular result) In[2]:= polar[sum] Out[2]= {29.772, 40.0128°) (displayed polar form of result) Mathematica displays complex numbers in rectangular form by default, so there is no need for a function "rectangular". Input in rectangular form is input as a complex number: value=100+100 I polar[value] ---> {141.421, 45.°) Gruß Peter -- ==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-== Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de