Example 2
In[22]:=
Clear[x,y,z,u,v,w]
x[r_,t_,z_]:=r Cos[t]
y[r_,t_,z_]:=r Sin[t]
z[r_,t_,z_]:=z
In[23]:=
x[r,theta,z]
y[r,theta,z]
z[r,theta,z]
Out[23]=
r Cos[theta]
Out[24]=
r Sin[theta]
Out[25]=
z
In[26]:=
Clear[a,b,c]
{a,b,c}=Simplify[scalefactors[x,y,z][r,theta,z]]
Out[26]=
2
{1, Sqrt[r ], 1}
Let's make a coordinate change on a vector field.
In[27]:=
Clear[F]
F[x_,y_,z_]:={x/(x^2+y^2),y/(x^2+y^2),0}
In[28]:=
newF[r_,theta_,z_]:=
F[x[r,theta,z],y[r,theta,z],z[r,theta,z]]
In[29]:=
Simplify[newF[r,theta,z]]
Out[29]=
Cos[theta] Sin[theta]
{----------, ----------, 0}
r r
What are the divergence and curl?
In[30]:=
newdiv[newF][r,theta,z]
Out[30]=
2 2
r Sqrt[r ] Cos[theta] (2 r Cos[theta] +
2
2 r Sin[theta] )
(-(---------------------------------------------------------
2 2 2 2 2
(r Cos[theta] + r Sin[theta] )
r Cos[theta]
) + ------------------------------- +
2 2 2 2
r Cos[theta] + r Sin[theta]
2
r Cos[theta]
------------------------------------------ +
2 2 2 2 2
Sqrt[r ] (r Cos[theta] + r Sin[theta] )
2
Sqrt[r ] Cos[theta] 2
-------------------------------) / Sqrt[r ]
2 2 2 2
r Cos[theta] + r Sin[theta]
Yuck!
In[31]:=
Simplify[%]
Out[31]=
2
Sqrt[r ] Cos[theta]
-------------------
3
r
In[32]:=
newcurl[newF][r,theta,z]
Out[32]=
2
{0, 0, (-((r Sqrt[r ] Sin[theta]
2 2
(2 r Cos[theta] + 2 r Sin[theta] )) /
2 2 2 2 2
(r Cos[theta] + r Sin[theta] ) ) +
2 2 2 2
(r Sin[theta]) / (r Cos[theta] + r Sin[theta] ) +
2
(r Sin[theta]) /
2 2 2 2 2
(Sqrt[r ] (r Cos[theta] + r Sin[theta] )) +
2
(Sqrt[r ] Sin[theta]) /
2 2 2 2 2
(r Cos[theta] + r Sin[theta] )) / Sqrt[r ]}
In[33]:=
Simplify[%]
Out[33]=
2
Sqrt[r ] Sin[theta]
{0, 0, -------------------}
3
r
Calculate the divergence and curl in rectangular coordinates.
In[34]:=
F[x_,y_,z_]:={x/(x^2+y^2),y/(x^2+y^2),0}
In[35]:=
curl3[F,x,y,z]
Out[35]=
curl3[F, x, y, z]
In[36]:=
div3[F,x,y,z]
Out[36]=
div3[F, x, y, z]
Comment:
Up to Examples