382x Filetype PDF File size 0.63 MB Source: www.lehman.edu
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 ∂f
≡ ∂xf, ≡ ∂yf,
∂x ∂y
etc. One can define higher-order derivatives with respect to the same or different variables
∂2f ∂2f ∂2f ∂ ∂f
≡ ∂x,xf, ≡ ∂y,yf, ≡ ≡ ∂x,yf
∂x2 ∂y2 ∂x∂y ∂x ∂y
For most of the functions mixed partial derivatives do not depend on the order of differentiation
∂2f ∂2f
≡
∂x∂y ∂y∂x
This holds if the mixed derivatives are continuous at a given point. For instance,
fx_, y_ = xy;
∂xfx, y
∂yfx, y
∂y,xfx, y
∂x,yfx, y
y
x
1
1
"Bad" functions
Multivariate series
Taylor series can be generalized for multivariate functions and the
fx_, y_ = Sinx+y;
Seriesfx, y, x, 0, 3
1 1
Siny+Cosyx− Sinyx2− Cosyx3+Ox4
2 6
Seriesfx, y, x, 0, 3, y, 0, 3
y3 y2 y y3 1 y2
y− +Oy4 + 1− +Oy4 x+ − + +Oy4 x2+ − + +Oy4 x3+Ox4
6 2 2 12 6 12
or, in the symmetric form
NormalSeriesfx, y, x, 0, 3, y, 0, 3
ExpandNormalSeriesfx, y, x, 0, 3, y, 0, 3
x3 x2 x x3 1 x2
x− + 1− y+ − + y2 + − + y3
6 2 2 12 6 12
x3 x2 y xy2 x3 y2 y3 x2 y3
x− +y− − + − +
6 2 2 12 6 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`"
Unfortunately, this package seems to be inconvenient.
Gradient
Gradient of a scalar funtion is a vector defined as
gradf≡∇f≡e ∂f +e ∂f +e ∂f ≡∂ f,∂ f,∂ f
x ∂x y ∂y z ∂z x y z
One can speak about the gradient operator defined as
∂ ∂ ∂
∇ ≡ ex +ey +ez
∂x ∂y ∂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:
Clearx, y, z, U
2 2 2
U = x +y +z ;
GradU
0, 0, 0
- a wrong output. An attempt of a standard usage
Ux_, y_, z_ = x2 +y2 +z2; ∗ 3d oscillator ∗
Fx_, y_, z_ = GradUx, y, z
0, 0, 0
- same wrong result. Still this command is working with a special naming choice
GradXx2+Yy2+Zz2
2Xx, 2Yy, 2Zz
However, this naming restriction is inconvenient.
Fortunately, it is not difficult to program the gradient in Mathematica. To use the definition below, quit the kernel to
remove the VectorAnalysis package from the memory
In[43]:= Gradf_ := ∂xf, ∂yf, ∂zf
Since x,y,z enters the definition of this function, the arguments of f should also be x,y,z. With any other notation for the
arguments of f, it won't work, in contrast to definitions of tru functions.
MyGrad works on expressions
Gradx2+y2+z2 ∗ ∇r2=2r ∗
2x, 2y, 2z
This means
∇r2 = 2 r
MyGrad also works on functions
Ux_, y_, z_ = x2 +y2 +z2; ∗ 3d oscillator ∗
Vx_, y_, z_ = x4;
GradUx, y, z
GradVx, y, z
2x, 2y, 2z
4x3, 0, 0
Mathematica has the symbol “ but it seems it is only for typing
?∇
“ à
?E
e à
I
True
One can define a vector function that is the gradient of a scalar function. For the electric field of a point charge one has
φx_, y_, z_ = kQ ; ∗ Coulomb potential of a point charge ∗
x2 +y2 +z2
EEx_, y_, z_ = −Gradφx, y, z ∗ Electric field of a point charge ∗
kQx 3
2, kQy 3
2, kQz 3
2
x2 +y2 +z2 x2 +y2 +z2 x2 +y2 +z2
Divergence
Divergence of a vector is a scalar defined by
∂Ax ∂Ay ∂Az
div A ≡ ∇ ⋅A ≡ + +
∂x ∂y ∂z
divergence can be represented by the operator
∂ ∂ ∂
∇ ≡ ex +ey +ez
∂x ∂y ∂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]:= DivAvec_ := ∂xAvec1+∂yAvec2+∂zAvec3
Examples
Divx, y, z
3
Fvecx_, y_, z_ = x2, y2, z2
;
DivFvecx, y, z
2x+2y+2z
Fvecx_, y_, z_ = y, x, xy;
DivFvecx, y, z
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 ≡ divgradf ≡ ∇ ⋅∇ f ≡ ∇2f
From this definition follows
∂2f ∂2f ∂2f
∆f = + +
∂x2 ∂y2 ∂z2
The Laplace operator
∂2 ∂2 ∂2
∆ ≡ ∇2= + +
∂x2 ∂y2 ∂z2
can be obtained by squaring the gradient / divergence operator above.
Laplacef_ := ∂x,xf +∂y,yf +∂z,zf
Example
no reviews yet
Please Login to review.