DifferentialGeometry Lessons - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : DifferentialGeometry : Lessons and Tutorials : DifferentialGeometry : DifferentialGeometry/LessonsAndTutorials/DifferentialGeometry/ArithmeticOperations

DifferentialGeometry Lessons

 

Lesson 2: Arithmetic Operations and Special Input Commands

 

 

Overview

&plus, &minus, &mult

&wedge, &tensor

evalDG

Hook

DGzip, FrameBaseVectors, FrameBaseForms

&MatrixMinus, &MatrixPlus, &MatrixMult, &MatrixWedge

DGzero, DGvolume

DGvector, DGform

convert/DGtensor, convert/DGArray

Copy and Paste DifferentialGeometry output

Exercises

Overview

 

In this lesson, you will learn to do the following:

– 

Add, subtract, and scalar multiply vectors, forms and tensors.

– 

Calculate the wedge product of forms.

– 

Calculate the tensor product of two tensors.

– 

Use the DifferentialGeometry parser evalDG.

– 

Calculate the inner product of a vector and a form.

– 

Use the DGzip command to form linear combinations of vectors, forms, and tensors.

– 

Work with matrices of differential forms.

– 

Create zero forms of a given degree, and volume forms.

– 

Convert an array to a tensor.

– 

Convert a differential form to a tensor.

 

&plus, &minus, &mult

 

When using these algebraic commands, it is important to use parentheses to indicate the order of operation.

>

with(DifferentialGeometry): DGsetup([x, y, z], E3);

frame name: E3

(2.1)

 

Enter the vector field D_x + 3D_y - 2xyD_z.

E3 > 

D_x &plus (3 &mult D_y) &minus ((2*x*y) &mult D_z);

D_x+3D_y2xyD_z

(2.2)

 

Enter the vector field dx + 3dy - 2xydz.

E3 > 

dx &plus (3 &mult dy) &minus ((2*x*y) &mult dz);

dx+3dy2xydz

(2.3)

 

&wedge, &tensor

 

E3 > 

with(DifferentialGeometry): DGsetup([x, y, z], E3);

frame name: E3

(3.1)

 

Enter the wedge product of the 1-forms dx, dy, dz.

E3 > 

dx &wedge dy &wedge dz;

dx`^`dy`^`dz

(3.2)

 

Enter the tensor product of the 1-forms dx, dy, dz.

E3 > 

dx &tensor dy &tensor dz;

dxdydz

(3.3)

 

Enter the tensor product of the vector fields D_x, D_y, D_z.

E3 > 

D_x &tensor D_y &tensor D_z;

D_xD_yD_z

(3.4)

 

Enter the 2 form 3dx^dy + xdy^dz.

E3 > 

(3 &mult (dx &wedge dy)) &plus ( x &mult (dy &wedge dz));

3dx`^`dy+xdy`^`dz

(3.5)

 

evalDG

 

The DifferentialGeometry parser evalDG provides an easier way to perform arithmetic operations.

– 

Use +, -, and * for addition, subtraction, and scalar multiplication.

– 

Use &w for wedge product.

– 

Use &t for tensor product.

 

E3 > 

restart: with(DifferentialGeometry): DGsetup([x, y, z], E3):

 

Enter the vector field 2D_x - xD_y + yD_z.

E3 > 

evalDG(2*D_x - x*D_y + y*D_z);

2D_xxD_y+yD_z

(4.1)

 

Enter the rank 2 tensor 2D_x dy - xD_y - xD_y dz.

E3 > 

evalDG(2*D_x &t dy - x*D_y &t dz);

2D_xdyxD_ydz

(4.2)

 

Enter the 2-form 2dx^dy - xdy^dz.

E3 > 

evalDG(2*dx &w dy - x*dy &w dz );

2dx`^`dyxdy`^`dz

(4.3)

 

Hook

 

The command Hook calculates the interior product of a vector and a differential p-form.

E3 > 

with(DifferentialGeometry): DGsetup([x, y, z], E3):

 

Define vectors X, Y and a 2-form alpha.

E3 > 

X := D_x;

XD_x

(5.1)
E3 > 

Y := D_y;

YD_y

(5.2)
E3 > 

alpha := evalDG(3*dx &w dy - 4*dy &w dz + 2*dx &w dz);

α3dx`^`dy+2dx`^`dz4dy`^`dz

(5.3)

 

Calculate the interior product of X and alpha.

E3 > 

beta1 := Hook(X, alpha);

β13dy+2dz

(5.4)

 

Calculate the interior product of Y and beta1.

E3 > 

beta2 := Hook(Y, beta1);

β23

(5.5)

 

Note that multiple interior products can also be evaluated with a single call to Hook.

E3 > 

Hook([X, Y], alpha) = Hook(Y, Hook(X,alpha));

3=3

(5.6)

 

DGzip, FrameBaseVectors, FrameBaseForms

 

DGzip is a handy command that gets used a lot.

E3 > 

with(DifferentialGeometry): DGsetup([x, y, z], E3):

 

Create the 1-form 4dx + 5dy + 6dz.

E3 > 

DGzip([4, 5, 6], [dx, dy, dz], "plus");

4dx+5dy+6dz

(6.1)

 

Create the 3-form dx^dy^dz.

E3 > 

DGzip([dx, dy, dz], "wedge");

dx`^`dy`^`dz

(6.2)

 

Create the tensor dx D_y dz.

E3 > 

DGzip([dx, D_y, dz], "tensor");

dxD_ydz

(6.3)

 

The coordinate basis for the tangent and cotangent spaces can be obtained from the command DGinfo.

This command is often used in conjunction with DGzip.

E3 > 

Fr := Tools:-DGinfo("FrameBaseVectors");

FrD_x,D_y,D_z

(6.4)
E3 > 

Omega := Tools:-DGinfo("FrameBaseForms");

Ωdx,dy,dz

(6.5)

 

Create the 1-form dx + 2dy + 3dz.

E3 > 

alpha := DGzip([1, 2, 3], Fr, "plus");

αD_x+2D_y+3D_z

(6.6)

 

&MatrixMinus, &MatrixPlus, &MatrixMult, &MatrixWedge

 

Use these commands for working with matrices of differential forms.  They are found in the Tools package.

E3 > 

with(DifferentialGeometry): with(Tools):

E3 > 

DGsetup([x, y, z], E3):

 

Define a matrix A of scalars.

E3 > 

A := Matrix([[1, 2], [3, 4]]);

A1234

(7.1)

 

Define a matrix Omega1 of 1-forms.

E3 > 

Omega1 := Matrix([[dx, dy], [dz, dx]]);

Ω1dxdydzdx

(7.2)

 

Scalar multiply the matrix of 1-forms Omega1 by 3.

E3 > 

3 &MatrixMult Omega1;

3dx3dy3dz3dx

(7.3)

 

Matrix multiply the matrix of scalars A and the matrix of 1-forms Omega1.

E3 > 

Omega2 := A &MatrixMult Omega1;

Ω2dx+2dz2dx+dy3dx+4dz4dx+3dy

(7.4)

 

Add the two matrices of 1-forms Omega1 and Omega2.

E3 > 

Omega1 &MatrixPlus Omega2;

2dx+2dz2dx+2dy3dx+5dz5dx+3dy

(7.5)

 

Matrix multiply the two matrices of 1-forms Omega1 and Omega2.

E3 > 

Omega1 &MatrixWedge Omega1;

dy`^`dz0dx`^`dy0dx`^`dydy`^`dz

(7.6)

 

DGzero, DGvolume

 

Use the command DGzero to create the zero vector, or the zero differential p-form.  Use the command DGvolume to create a differential n-form, where n is the dimension of the active coordinate system.  These commands are found in the Tools package.

 

E3 > 

with(DifferentialGeometry): DGsetup([x, y, z], E3):

 

Create the zero vector.

E3 > 

Tools:-DGzero("vector");

0D_x

(8.1)

 

Create the zero 2-form.

E3 > 

Tools:-DGzero("form", 2);

0dx`^`dy

(8.2)

 

Create the volume form with a coefficient of k.

E3 > 

Tools:-DGvolume("form", k);

kdx`^`dy`^`dz

(8.3)

 

DGvector, DGform

 

The commands DGvector and DGform provide an alternative way of defining the coordinate vector fields and differential 1-forms and are useful when writing new programs for differential geometry applications.  These commands are found in the Tools package.

 

E3 > 

with(DifferentialGeometry): DGsetup([x, y, z], E3):

 

Create the vector D_x.

E3 > 

Tools:-DGvector(1);

D_x

(9.1)

 

Create the vector D_y.

E3 > 

Tools:-DGvector(y);

D_y

(9.2)

 

Create the 1-form dz.

E3 > 

Tools:-DGform(z);

dz

(9.3)

 

convert/DGtensor, convert/DGArray

 

The DifferentialGeometry package provides a number of extensions to the Maple convert facility.

The convert/DGtensor command enables one to convert

– 

a vector to a rank 1 covariant tensor;

– 

a differential p-form to a rank p covariant tensor field;

– 

a p-dimensional Maple Array to a rank p tensor field.

See DifferentialGeometry, Convert for details.

 

with(DifferentialGeometry):

DGsetup([x, y, z], E3);

frame name: E3

(10.1)

 

Define a differential 2-form omega and convert it to a tensor.

E3 > 

omega := evalDG(dx &w dy - 3*dy &w dz);

ωdx`^`dy3dy`^`dz

(10.2)
E3 > 

convert(omega, DGtensor);

dxdydydx3dydz+3dzdy

(10.3)

 

Define a 3-dimensional array A and convert it to a type (2, 1) tensor.

E3 > 

A := Array(1..3, 1..3, 1..3);

A 1..3 x 1..3 x 1..3 ArrayData Type: anythingStorage: rectangularOrder: Fortran_order

(10.4)
E3 > 

A[1, 2, 3] := 5;

A1,2,35

(10.5)
E3 > 

A[1, 1, 1] := -1;

A1,1,11

(10.6)

 

The last argument must specify the index type of the tensor being defined by the Array.

E3 > 

T := convert(A, DGtensor, [["cov_bas", "cov_bas", "con_bas"], []]);

TdxdxD_x+5dxdyD_z

(10.7)

 

The command convert/DGArray will convert a tensor to an Array.

E3 > 

B := convert(T, DGArray);

B 1..3 x 1..3 x 1..3 ArrayData Type: anythingStorage: rectangularOrder: Fortran_order

(10.8)
E3 > 

B[1, 2, 3];

5

(10.9)
E3 > 

B[1, 1, 1];

1

(10.10)
E3 > 

B[1, 2, 2];

0

(10.11)

 

Copy and Paste DifferentialGeometry output

 

The results of a DifferentialGeometry computation are displayed in a format consistent with standard mathematical usage.  The displayed format for vector fields and differential 1-forms can be copied and pasted into other parts of the worksheet or even other worksheets and the result passed directly to the DifferentialGeometry parser evalDG.

 

Unfortunately, differential forms of higher degree and tensors cannot be copied and pasted without editing.  In this section, we describe some possible workarounds.

E3 > 

with(DifferentialGeometry): DGsetup([x, y, z], M):

M > 

alpha := evalDG(dx &w dy + (1/x) *dy &w dz);

αdx`^`dy+dy`^`dzx

(11.1)

 

Copy and paste this output here to see the problem.

M > 

alpha := dx*`^`*dy+1/x*dy*`^`*dz:

 

To make this readable by evalDG, the string *`^`* must be replaced by &w.

 

To simplify this editing, we can use the Preferences program to change the way the wedge product is displayed.  With the WedgeDisplay value = 2, the wedge symbol is suppressed; with the WedgeDisplay value = 3, the wedge symbol is changed to &w.  In either case, the editing of the result of a copy and paste is slightly easier.

M > 

Preferences("WedgeDisplay", 2);

1

(11.2)
M > 

alpha;

dx`^`dy+dy`^`dzx

(11.3)

 

Copy and paste this line to get

M > 

dx*dy+1/x*dy*dz;

dxdy+dydzx

(11.4)

 

Here we need only replace the appropriate * by &w.

M > 

Preferences("WedgeDisplay",3);

2

(11.5)
M > 

alpha;

dx`^`dy+dy`^`dzx

(11.6)

 

Copy and paste this line to get

M > 

dx*` &w `*dy+1/x*dy*` &w `*dz:

 

Here we need only remove the strings `*`.

 

Change the WedgeDisplay back to its default value.

Preferences("WedgeDisplay", 1);

 

Finally, another alternative is to use lprint to display the internal representation of the form alpha.  This can always be copied and pasted.

M > 

lprint(alpha);

_DG([["form", M, 1], [[[1], 1]]])*`^`*_DG([["form", M, 1], [[[2], 1]]])+1/x*_DG([["form", M, 1], [[[2], 1]]])*`^`*_DG([["form", M, 1], [[[3], 1]]])

 

Copy and paste this.

M > 

beta := _DG([["form", M, 2], [[[1, 2], 1], [[2, 3], 1/x]]]);

βdx`^`dy+dy`^`dzx

(11.7)

 

Exercises

Exercise 1

 

Check, by example, that the inner product of a vector with a form is an anti-derivation.

 

Solution

M > 

with(DifferentialGeometry): DGsetup([x, y, z], E3):

 

Define a vector.

E3 > 

X := evalDG(D_x - 2*D_y + 3*D_z);

XD_x2D_y+3D_z

(12.1.1.1)

 

Define a pair of 1-forms.

E3 > 

alpha := evalDG(dx + 3*dy - 2*dz);

αdx+3dy2dz

(12.1.1.2)
E3 > 

beta := evalDG(-dx + 4*dy + dz);

βdx+4dy+dz

(12.1.1.3)
E3 > 

LHS := Hook(X, alpha &w beta);

LHS17dx26dy23dz

(12.1.1.4)
E3 > 

RHS := evalDG(Hook(X, alpha) &w beta - alpha &w Hook(X, beta));

RHS17dx26dy23dz

(12.1.1.5)
E3 > 

LHS &minus RHS;

0dx

(12.1.1.6)

Exercise 2

 

Write a program which takes an integer r for its input and returns the 2-form dx1^dx2 + dx3^dx4 + ..., where there are r summands.

 

Solution

 

with(DifferentialGeometry):

TwoForm1 := proc(r)

local n, ans, Omega, i;

n := min(r, iquo(Tools:-DGinfo("FrameBaseDimension"),2));

Omega := Tools:-DGinfo("FrameBaseForms");

evalDG(add(Omega[2*i-1] &wedge Omega[2*i], i = 1 .. n));

end:

 

DGsetup([x1, x2, x3, x4, x5, x6], E6);

frame name: E6

(12.2.1.1)
E6 > 

TwoForm1(2);

dx1`^`dx2+dx3`^`dx4

(12.2.1.2)
E6 > 

TwoForm1(3);

dx1`^`dx2+dx3`^`dx4+dx5`^`dx6

(12.2.1.3)

Exercise 3

 

Write a program which takes as input an n x n matrix A, where n is the dimension of the active coordinate system, and returns the 2-form dx^t A dx, where dx is a column vector of coordinate differentials.

 

Solution

with(DifferentialGeometry):

 

TwoForm2:=proc(A)

local Omega1, Omega2, n, Fr, ans;

n := LinearAlgebra:-RowDimension(A);

Fr := DifferentialGeometry:-Tools:-DGinfo("FrameBaseForms");

Omega1 := Matrix(n, 1, Fr);

Omega2 := LinearAlgebra:-Transpose(Omega1);

use DifferentialGeometry:-Tools in

ans := Omega2 &MatrixWedge (A &MatrixMult Omega1);

end use;

ans[1,1]; end:

 

DGsetup([x, y, z, w], E4);

frame name: E4

(12.3.1.1)
E4 > 

A := Matrix([[0, 1, 2, 3],[-1, 0, 4, 5], [-2, -4, 0, 6], [-3, -5, -6, 0]]);

A0123104524063560

(12.3.1.2)
E4 > 

TwoForm2(A);

2dx`^`dy+4dx`^`dz+6dx`^`dw+8dy`^`dz+10dy`^`dw+12dz`^`dw

(12.3.1.3)

Exercise 4

 

Write a program which will return a list of 2-forms which define a basis for the vector space of all 2-forms for a given manifold M.

 

Solution

 

E4 > 

TwoFormBasis := proc(M)

E4 > 

local n ,i, j, alpha, beta, Basis;

E4 > 

n := DifferentialGeometry:-Tools:-DGinfo(M, "FrameBaseDimension");

E4 > 

Basis := [];

E4 > 

for i to n do

E4 > 

alpha := DifferentialGeometry:-Tools:-DGform(i);

E4 > 

for j from i + 1 to n do

E4 > 

beta := DifferentialGeometry:-Tools:-DGform(j);

E4 > 

Basis := [op(Basis), alpha &wedge beta];

E4 > 

od;

E4 > 

od;

E4 > 

Basis;

E4 > 

end:

E4 > 

 

E4 > 

with(DifferentialGeometry):

E6 > 

DGsetup([x1, x2, x3, x4], M);

frame name: M

(12.4.1.1)
M > 

TwoFormBasis(M);

TwoFormBasisM

(12.4.1.2)

 

It is very inefficient to define the Basis to be a list.  It is highly recommended that 1 dimensional Arrays be used in place of lists.  Thus,the above program becomes

M > 

TwoFormBasis2 := proc(M)

E4 > 

local n ,i, j, alpha, beta, Basis, k;

E4 > 

n := DifferentialGeometry:-Tools:-DGinfo(M, "FrameBaseDimension");

E4 > 

Basis := Array(1 .. n*(n - 1)/2):

M > 

k := 0;

E4 > 

for i to n do

E4 > 

alpha := DifferentialGeometry:-Tools:-DGform(i);

E4 > 

for j from i + 1 to n do

M > 

k := k + 1;

E4 > 

beta := DifferentialGeometry:-Tools:-DGform(j);

E4 > 

Basis[k] := alpha &wedge beta;

E4 > 

od;

E4 > 

od;

E4 > 

convert(Basis, list);

M > 

end:

M > 

 

M > 

TwoFormBasis2(M);

dx1`^`dx2,dx1`^`dx3,dx1`^`dx4,dx2`^`dx3,dx2`^`dx4,dx3`^`dx4

(12.4.1.3)

Exercise 5

 

Let M be a manifold and recall that a type (1, 1) tensor T defined at a point p in M can be viewed as a linear transformation from T_pM to T_pM, that is, as an element of Hom(T_pM, T_pM).  Write a program that will compute the k-th power of a type (1, 1) tensor.

Hint: Use DGinfo to obtain the tensor type.

 

Solution

 

M > 

TensorPower := proc(T, k)

E4 > 

local IndexType, A, B, C;

E4 > 

IndexType := DifferentialGeometry:-Tools:-DGinfo(T, "TensorType");

M > 

A := convert(T, DGArray);

M > 

B := convert(A, Matrix):

M > 

C := B^k;

M > 

convert(C,DGtensor, IndexType);

M > 

end:

M > 

 

M > 

with(DifferentialGeometry): with(Tensor): DGsetup([x, y, z], V):

V > 

T1 := evalDG(dx &t D_y + 3*dy &t D_y - 2*dy &t D_z);

T1dxD_y+3dyD_y2dyD_z

(12.5.1.1)
V > 

TensorPower(T1, 3);

9dxD_y6dxD_z+27dyD_y18dyD_z

(12.5.1.2)
V > 

TensorPower(T1, 4);

27dxD_y18dxD_z+81dyD_y54dyD_z

(12.5.1.3)

Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam