jacobian.mws

> restart:

> with(linalg):

Warning, the protected names norm and trace have been redefined and unprotected

Consider the transformation from cartesian to polar coordinates in two dimensions

> x:=(r,theta)->r *cos(theta);

x := proc (r, theta) options operator, arrow; r*cos...

> y:=(r,theta)->r*sin(theta);

y := proc (r, theta) options operator, arrow; r*sin...

Define the jacobian of the transformation abs(diff(x,r)*diff(y,theta)-diff(x,theta)*diff(y,r)... i.e. determinant of partial derivatives

> j:=jacobian([x(r,theta),y(r,theta)],[r,theta]);

j := matrix([[cos(theta), -r*sin(theta)], [sin(thet...

> detj:=det(j);

detj := cos(theta)^2*r+r*sin(theta)^2

> detj:=simplify(%);

detj := r

The element of area in cartesian coordinates is dA=dxdy and in polar coordinates dA=rdrd theta

The relationship between them is just dxdy= abs(J)*dr*d*theta

Consider cylindrical polar coordinates:

> x:=(r,theta,z)->r*cos(theta);

x := proc (r, theta, z) options operator, arrow; r*...

> y:=(r,theta,z)->r*sin(theta);

y := proc (r, theta, z) options operator, arrow; r*...

> z:=(r,theta,z)->z;

z := proc (r, theta, z) options operator, arrow; z ...

> j:=jacobian([x(r,theta,z),y(r,theta,z),z(r,theta,z)],[r,theta,z]);

j := matrix([[cos(theta), -r*sin(theta), 0], [sin(t...

> detj:=det(j);

detj := cos(theta)^2*r+r*sin(theta)^2

> detj:=simplify(%);

detj := r

Hence the element of volume dV=dx dy dz = |J| d*r*d*theta*d z = r*d*r*d*theta*d*z

Spherical Coordinates

> x:=(r,theta,phi)->r*sin(theta)*cos(phi);

x := proc (r, theta, phi) options operator, arrow; ...

> y:=(r,theta,phi)->r*sin(theta)*sin(phi);

y := proc (r, theta, phi) options operator, arrow; ...

> z:=(r,theta,phi)->r*cos(theta);

z := proc (r, theta, phi) options operator, arrow; ...

> j:=jacobian([x(r,theta,phi),y(r,theta,phi),z(r,theta,phi)],[r,theta,phi]);

j := matrix([[sin(theta)*cos(phi), r*cos(theta)*cos...

> detj:=det(j);

detj := sin(theta)^3*cos(phi)^2*r^2+sin(theta)^3*si...

> detj:=simplify(%);

detj := sin(theta)*r^2

Hence the element of volume dV=dx dy dz = |J| d*r*d*theta*d z = r^2*sin(theta)*d*r*d*theta*d*z