kill(all)$

maxima:load(vect),grad,div,curl ,laplacian:,(cartesian,cylindrical,spherical),version 1.0
peter.vlasschaert@gmail.com,02/09/2021

load packages :general
==================

load(lrats)$ ratprint:false$

load packages application :(vector analysis)
===================================

load(vect)$

1e) step : coordinates

ordergreat(ii,jj,kk)$

a) cartesian coordinates (x,y,z)
========================

→ unit vectors 

p1:[ii,jj,kk];

→point :catesian coordinates

p1a:r1=x*ii+y*jj+z*kk;

→point :list representation

p1b:[x,y,z];

b) cylindrical coordinates (r,θ,z)
========================

→ unit vectors 

p2:[r,θ,z];

→point : coordinates

p2a:r2=(r*cos(θ))*ii+(r*sin(θ))*jj+z*kk;

→point :list representation

p2b:[r*cos(θ),r*sin(θ),z];

c) spherical coordinates (r,θ,φ)
========================

→ unit vectors 

p3:[r,θ,φ];

→point :catesian coordinates

p3a:r3=r*sin(θ)*cos(φ)*ii+r*sin(θ)*sin(φ)*jj+r*cos(θ)*kk;

→point :list representation

p3b:[r*sin(θ)*cos(φ),r*sin(θ)*sin(φ),r*cos(θ)];

assume(sin(θ)>0,r>0);

2e step:computation :gradient(f)
========================

→ declare 

declare(A,nonscalar)$

A:grad(f);

rem :f scalar function

→ scale factors

a) cartesian:grad

f1a:scalefactors([p1b,x,y,z]);
express(A);

b) cylindrical:grad

f2a:scalefactors([p2b,r,θ,z]);
express(A);

c) spherical:grad

f3a:scalefactors([p3b,r,θ,φ]);
express(A);

3e step:computation :div(A)
========================

declare(B,nonscalar)$
d1:div(B);

→ scale factors

a) cartesian:div

f1b:scalefactors([p1b,x,y,z]);
expand(express(d1));

b) cylindrical:div

f2b:scalefactors([p2b,r,θ,z]);
expand(express(d1));

c) spherical:div

f3b:scalefactors([p3b,r,θ,φ]);
expand(express(d1));

4e step:computation :curl(B)
========================

declare(B,nonscalar)$
d2:curl(B);

→ scale factors

a) cartesian:curl

f1c:scalefactors([p1b,x,y,z]);
express(d2);

b) cylindrical:curl

f2c:scalefactors([p2b,r,θ,z]);
expand(express(d2));

c) spherical:div

f3c:scalefactors([p3b,r,θ,φ]);
expand(express(d2));

5e step:computation :laplacian(f)
=========================

declare(B,nonscalar)$
B:laplacian(f);

rem :f scalar function

a) cartesian:laplacian

f1d:scalefactors([p1b,x,y,z]);
express(B);

b) cylindrical:laplacian

f2d:scalefactors([p2b,r,θ,z]);
expand(express(B));

c) spherical:laplacian

f3d:scalefactors([p3b,r,θ,φ]);
expand(express(B));

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

rem :dot(product)  :A1.B1
====================

declare([A1,B1],nonscalar);
scalefactors([p1b,x,y,z]);
dotproduct:A1.B1;
express(dotproduct);

express(A1);
express(B1);

don't forget scalefactors (otherwise wrong)

rem :vector(product)  :A1xB1
======================

declare([AA1,BB1,CC1],nonscalar);

vectorproduct:AA1~BB1;
express(vectorproduct);

express(CC1)=express(vectorproduct);