5. Lagrangians and Hamiltonians

Legal Notice, Disclaimer, and Book Ordering Information:

Null

Setup

\(Clear["Global`*"]; 
Off[General::spell]; 
Off[General::spell1]; 
    \)

Needs["Calculus`VectorAnalysis`"]

Needs["Graphics`PlotField`"]

<< "D:\Mma\Inits\ch5init.m"

Clear["Global`*"];

5.2 Problems

5.2.2  Cartesian and Cylindrical Coordinates

Problem 1:  Separation of Variables in Cartesian and Cylindrical Coordinates

Consider Laplace's Equation for the electric potential.

Part (a)   For Cartesian coordinates, assume a potential of the form V[x,y,z] = vx[x] vy[y] vz[z] and apply the Laplacian to this product.  Solve the ordinary differential equation for each function.

potCart = vx[x] vy[y] vz[z]

SetCoordinates[Cartesian[x, y, z]]

lapEqn = Laplacian[potCart]

eq1 = lapEqn/potCart // Expand

select[eq_, var_] := Select[eq, (! FreeQ[#, var])&]

xEq = select[eq1, x] == -cx^2

yEq = select[eq1, y] == -cy^2

zEq = select[eq1, z] == cz^2

xEq2 = Solve[xEq, {vx[x]}] /. {Rule -> Equal} // Flatten

xEquations = {xEq2, vx[0] == vx0, vx'[0] == vx0p} // Flatten

dSolX = DSolve[xEquations, {vx[x]}, x] // Flatten

yEq2 = Solve[yEq, {vy[y]}] /. {Rule -> Equal} // Flatten

yEquations = {yEq2, vy[0] == vy0, vy'[0] == vy0p} // Flatten

dSolY = DSolve[yEquations, {vy[y]}, y] // Flatten

zEq2 = Solve[zEq, {vz[z]}] /. {Rule -> Equal} // Flatten

zEquations = {zEq2, vz[0] == vz0, vz'[0] == vz0p} // Flatten

dSolZ = DSolve[zEquations, {vz[z]}, z] // Flatten

Part (b)   For czlindrical coordinates, assume a potential of the form V[r,ϕ,z] = R[r] Φ[ϕ] Z[z] and applz the Laplacian to this product.  Solve the ordinarz differential equation for each function.

potCyl = R[r] Φ[ϕ] Z[z]

SetCoordinates[Cylindrical[r, ϕ, z]]

lapEqn = Laplacian[potCyl]

eq1 = lapEqn/potCyl // Expand

zEq = select[eq1, z] == +cz^2

eq2 = eq1 - select[eq1, z] +  cz^2

eq3 = r^2 eq2 // Expand

ϕEq = select[eq3, ϕ] == -cϕ^2

rEq = (eq3  - select[eq3, ϕ] - cϕ^2) R[r] // Expand

rEquations = {rEq == 0, R[0] == r0, R'[0] == 0}

rSol = 
      DSolve[rEquations[[1]], {R[r]}, r] // PowerExpand // Flatten