Understanding Gradient, Divergence, Curl, and Laplacian in Vector Calculus, Slides of Dynamics

The concepts of partial derivatives and vector calculus, focusing on gradient, divergence, curl, and Laplacian. It covers multivariate functions, Taylor series, and the use of Mathematica for vector calculus operations. The document also includes exercises for sorting polynomials and visualizing potential functions and electric fields.

Typology: Slides

2021/2022

Uploaded on 07/04/2022

MiesjeX
MiesjeX 🇳🇱

5

(8)

98 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Partial derivatives & Vector calculus
Partial derivatives
Functions of several arguments (multivariate functions) such as f[x,y] can be differentiated with respect to each argument
f
x
x
f,
f
y
y
f,
etc. One can define higher-order derivatives with respect to the same or different variables
2
f
x
2
x,x
f,
2
f
y
2
y,y
f,
2
f
xy
x
f
y
x,y
f
For most of the functions mixed partial derivatives do not depend on the order of differentiation
2
f
xy
2
f
yx
This holds if the mixed derivatives are continuous at a given point. For instance,
f
@
x_, y_
D
=
x y;
x
f
@
x, y
D
y
f
@
x, y
D
y,x
f
@
x, y
D
x,y
f
@
x, y
D
y
x
1
1
ü"Bad" functions
Multivariate series
Taylor series can be generalized for multivariate functions and the
f
@
x_, y_
D
=
Sin
@
x
+
y
D
;
Series
@
f
@
x, y
D
,
8
x, 0, 3
<
D
Sin
@
y
D
+Cos
@
y
D
x1
2
Sin
@
y
D
x
2
1
6
Cos
@
y
D
x
3
+O
@
x
D
4
Series
@
f
@
x, y
D
,
8
x, 0, 3
<
,
8
y, 0, 3
<
D
yy
3
6
+O
@
y
D
4
+1y
2
2
+O
@
y
D
4
x+ y
2
+y
3
12
+O
@
y
D
4
x
2
+ 1
6
+y
2
12
+O
@
y
D
4
x
3
+O
@
x
D
4
or, in the symmetric form
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Understanding Gradient, Divergence, Curl, and Laplacian in Vector Calculus and more Slides Dynamics in PDF only on Docsity!

Partial derivatives & Vector calculus

Partial derivatives

Functions of several arguments (multivariate functions) such as f[x,y] can be differentiated with respect to each argument

∂f

∂x

≡ ∂x f,

∂f

∂y

≡ ∂y f,

etc. One can define higher-order derivatives with respect to the same or different variables

∂^2 f

∂x^2

≡ ∂x,x f,

∂^2 f

∂y^2

≡ ∂y,y f,

∂^2 f

∂x ∂ y

∂x

∂f

∂y

≡ ∂x,y f

For most of the functions mixed partial derivatives do not depend on the order of differentiation

∂^2 f

∂x ∂ y

∂^2 f

∂ y ∂x

This holds if the mixed derivatives are continuous at a given point. For instance,

f@x_, y_D = x y; ∂x f@x, yD ∂y f@x, yD ∂y,x f@x, yD ∂x,y f@x, yD y

x

1

1

ü "Bad" functions

Multivariate series

Taylor series can be generalized for multivariate functions and the

f@x_, y_D = Sin@x + yD; Series@f@x, yD, 8 x, 0, 3<D

Sin@yD + Cos@yD x −

Sin@yD x^2 −

Cos@yD x^3 + O@xD^4

Series@f@x, yD, 8 x, 0, 3<, 8 y, 0, 3<D

y −

y^3 6

  • O@yD^4 + 1 −

y^2 2

  • O@yD^4 x + −

y 2

y^3 12

  • O@yD^4 x^2 + −

y^2 12

  • O@yD^4 x^3 + O@xD^4

or, in the symmetric form

Normal@Series@f@x, yD, 8 x, 0, 3<, 8 y, 0, 3<DD Expand@Normal@Series@f@x, yD, 8 x, 0, 3<, 8 y, 0, 3<DDD

x −

x^3 6

x^2 2

y + −

x 2

x^3 12

y^2 + −

x^2 12

y^3

x −

x^3 6

  • y −

x^2 y 2

x y^2 2

x^3 y^2 12

y^3 6

x^2 y^3 12

Exercise: Find a way to sort this polynomial in increasing powers of x, y.

Vector calculus

Physics makes use of vector differential operations on functions such as gradient, divergence, curl ( rotor ), Laplacian , etc.

In the current version of Mathematica realizations of these operations are new and not included in the main body of the

software. Instead, these functions are implemented in the optional VectorAnalysis package that has to be called before

performing these operations

Needs@"VectorAnalysis`"D

Unfortunately, this package seems to be inconvenient.

ü Gradient

Gradient of a scalar funtion is a vector defined as

grad f ≡ ∇ f ≡ e x

∂f

∂x

+ e y

∂ f

∂ y

+ e z

∂f

∂z

≡ 9 ∂x f, ∂y f, ∂z f=

One can speak about the gradient operator defined as

∇ ≡ e x

∂x

+ e y

∂ y

+ e z

∂z

that acts on scalar functions of vector arguments. An example of a gradient in physics is force F that is minus gradient of the

potential energy U[x,y,z] and similar for the electric field E that is minus gradient of the electric potential f

F ≡ −∇U, E ≡ −∇ φ

Examples trying to use the Mathematica' s VectorCalculus package:

Following Mathematica help:

Clear@x, y, z, UD U = x^2 + y^2 + z^2 ; Grad@UD 8 0, 0, 0<

  • a wrong output. An attempt of a standard usage

U@x_, y_, z_D = x^2 + y^2 + z^2 ; H∗ 3d oscillator ∗L

F@x_, y_, z_D = Grad@U@x, y, zDD 8 0, 0, 0<

  • same wrong result. Still this command is working with a special naming choice

Divergence

Divergence of a vector is a scalar defined by

div A ≡ ∇ ⋅ A ≡

∂Ax

∂ x

∂ Ay

∂y

∂Az

∂z

divergence can be represented by the operator

∇ ≡ e x

∂x

+ e y

∂ y

+ e z

∂z

same as the gradient operator above. The only difference between them is that gradient acts on scalars and divergence acts

on vectors.

In[61]:= Div@Avec_D := ∂x Avec@@ 1 DD + ∂y Avec@@ 2 DD + ∂z Avec@@ 3 DD

Examples

Div@ 8 x, y, z<D 3

Fvec@x_, y_, z_D = 9 x^2 , y^2 , z^2 =; Div@Fvec@x, y, zDD 2 x + 2 y + 2 z

Fvec@x_, y_, z_D = 8 y, x, x y<; Div@Fvec@x, y, zDD 0

ü Laplacian

Laplacian is a second-order vector differential operation. Laplacian of a scalar f is defined as div grad f and denoted by D or

“^2

∆ f ≡ div grad f ≡ ∇ ⋅ ∇ f ≡ ∇^2 f

From this definition follows

∆ f =

∂^2 f

∂x^2

∂^2 f

∂y^2

∂^2 f

∂ z^2

The Laplace operator

∆ ≡ ∇^2 =

∂^2

∂ x^2

∂^2

∂ y^2

∂^2

∂ z^2

can be obtained by squaring the gradient / divergence operator above.

Laplace@ f _D := ∂x,x f + ∂y,y f + ∂z,z f

Example

f@x_, y_, z_D = x^2 + y^2 + z^2 ; Laplace@ f @x, y, zDD 6

Laplacian of a vector is defined in components through Laplacians of the components as

∆ A ≡ e 1 ∆A 1 + e 2 ∆A 2 + e 3 ∆A 3

In[60]:= LaplaceVec@ Avec _D^ :=^9 ∂x,x Avec @@^1 DD^ + ∂y,y Avec @@^1 DD^ + ∂z,z Avec @@^1 DD , ∂x,x Avec @@ 2 DD + ∂y,y Avec @@ 2 DD + ∂z,z Avec @@ 2 DD , ∂x,x Avec @@ 3 DD + ∂y,y Avec @@ 3 DD + ∂z,z Avec @@ 3 DD=

ü Curl (rotor)

Curl of a vector is a vector defined by

curl A ≡ detB

e x e y e z

∂x ∂y ∂z

Ax Ay Az

F ≡ ∇ A

In[62]:= Curl@Avec_D^ := 9 ∂y Avec@@ 3 DD − ∂z Avec@@ 2 DD, ∂z Avec@@ 1 DD − ∂x Avec@@ 3 DD, ∂x Avec@@ 2 DD − ∂y Avec@@ 1 DD=

Examples

Curl@ 8 x, y, z<D 8 0, 0, 0<

Curl@ 8 y, − x, 0<D 8 0, 0, − 2 <

ü Repeated first-order differential vector operations

Repeated vector differential operations satisfy some identities that are similar to repeated vector products if one uses the “

operator and considers it as a vector.

ü Double curl

Similarly to the double vector product A ×( B × C ) ª B ( A · C ) - C ( A·B ), one has

curl curl A ≡ ∇ H ∇ AL ≡ ∇ H ∇ ⋅ A L − ∇^2 A ≡ grad Hdiv A L − ∆ A

Note that here the vector A is always rightmost because the differential operators are acting on it. Check this identity

Avec@x_, y_, z_D = 8 Avecx@x, y, zD, Avecy@x, y, zD, Avecz@x, y, zD<;

Curl@Curl@Avec@x, y, zDDD

9 − AvecxH0,0,2L@x, y, zD − AvecxH0,2,0L@x, y, zD + AveczH1,0,1L@x, y, zD + AvecyH1,1,0L@x, y, zD, − AvecyH0,0,2L@x, y, zD + AveczH0,1,1L@x, y, zD + AvecxH1,1,0L@x, y, zD − AvecyH2,0,0L@x, y, zD, AvecyH0,1,1L@x, y, zD − AveczH0,2,0L@x, y, zD + AvecxH1,0,1L@x, y, zD − AveczH2,0,0L@x, y, zD=

Grad@φ@x, y, zD ψ@x, y, zDD == φ@x, y, zD Grad@ψ@x, y, zDD + Grad@φ@x, y, zDD ψ@x, y, zD True

ü Divergence and curl of a product of a vector and a scalar

div Hφ A L ≡ ∇ ⋅ Hφ A L ≡ φ ∇ ⋅ A + ∇ φ ⋅ A

curl Hφ A L ≡ ∇ Hφ A L ≡ φ ∇ A + ∇ φ A

Check these identities

ü Divergence of a vector product

div H A B L ≡ ∇ ⋅ H A B L ≡ H ∇ AL ⋅ B − A ⋅ H ∇ BL

Check this identity

Avec@x_, y_, z_D = 8 Avecx@x, y, zD, Avecy@x, y, zD, Avecz@x, y, zD<; Bvec@x_, y_, z_D = 8 Bvecx@x, y, zD, Bvecy@x, y, zD, Bvecz@x, y, zD<; Simplify@ Div@Cross@Avec@x, y, zD, Bvec@x, y, zDDD  Curl@Avec@x, y, zDD.Bvec@x, y, zD − Avec@x, y, zD.Curl@Bvec@x, y, zDD D True

Potential and its gradient

Force and electric field are negative gradients of the potential energy and electric potential, respectively:

F ≡ −∇U, E ≡ −∇ φ.

Gradient is perpendicular to the equipotential lines and it shows the direction of the strongest increase of the potential. (Thus

the force shows the direction of the strongest decrease of the potential. This is natural because all systems tend to decrease

their energy and the forces are developed accordingly to this). To prove this, consider an equipotential surface

U@x, y, zD = U 0

that goes through the point r 0 = 8 x 0 , y 0 , z 0 <. Expanding the potential around r 0 up to the first order, one obtains

U@x, y, zD = U 0 + Ux^ ′^ Hx − x 0 L + Uy^ ′^ Hy − y 0 L + Uz^ ′^ Hz − z 0 L.

Together with the preceding formula this yields the equation of the plane tangential to the equipotential surface at r 0

Ux^ ′^ Hx − x 0 L + Uy^ ′^ Hy − y 0 L + Uz^ ′^ Hz − z 0 L = 0,

where Vα^ ′^ ª∑a V. Any vector r within this plane can be represented in the form

r = r 0 + ρ,

where

ρ = e x Hx − x 0 L + e y Hy − y 0 L + e z Hz − z 0 L.

One can see that r is perpendicular to the gradient because

ρ ⋅ ∇U = Ie x Hx − x 0 L + e y Hy − y 0 L + e z Hz − z 0 L M ⋅ I e x Ux^ ′^ + e y Uy^ ′^ + e z Uz^ ′^ M

= Ux^ ′^ Hx − x 0 L + Uy^ ′^ Hy − y 0 L + Uz^ ′^ Hz − z 0 L = 0.

As an example consider the electric potential created by two charges put at (0,0,0) and (a,0,0). In the (x,y) plane (z=0) the

potential has the form

In[116]:= Q 1 =^ 1;^ Q 2 = −^ 1;^ a^ =^ 1;

V@x_, y_D =

Q 1

Ix^2 + y^2 M^1 ê^2

Q 2

IHx − aL^2 + y^2 M^1 ê^2

Plot3D@V@x, yD, 8 x, − 2, 2 + a<, 8 y, − 2, 2<, PlotRange → 8 − 5, 5<D

Out[118]=

In[103]:= EquipotentialLines^ =^ ContourPlot@V@x, yD,^8 x,^ ^ 2, 2^ +^ a<,^8 y,^ ^ 2.5, 2.5<, Contours^ ^20 D

Out[103]=

The electric field in the (x,y) plane is given by.

In[44]:= EE@x_, y_D = − Grad@V@x, yDD

Out[44]= :−

− 1 + x IH− 1 + xL^2 + y^2 M^3 ê^2

x Ix^2 + y^2 M^3 ê^2

y IH− 1 + xL^2 + y^2 M^3 ê^2

y Ix^2 + y^2 M^3 ê^2

Lines of the electric field are shown in the StreamPlot where we plot only x- and y-components