Setup - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Physics[Setup] - set and query the computational environment for the Physics package commands

Calling Sequence

Setup( )

Setup(parameter)

Setup(parameter = value, other_options)

Parameters

parameter

-

(optional) name (can be the keyword query); query the value of the specified parameter

parameter = value

-

(optional) equation of the form name = value; set the value of one or many of the parameters of the computational environment

other_options

-

(optional) any of the keywords: advanced, additionally, clear, conventions, default, keywords, query, quiet, redo, readsetup, savesetup, deletesavedsetup

Description

• 

The Setup command is used to set, clear and query the computational environment used by the commands of the Physics package. To avoid having to remember the relatively large number of parameters that can be set, if you type the parameter misspelled, or just a portion of it, a matching against the existing parameters is performed, and when there is only one match, the input is automatically corrected. For example, to see the list of settable parameters, enter Setup(keywords), or simply pass a portion of the word , such as Setup(k).

• 

Alternatively, you can launch the graphical interface of the package, a setup applet, and set the values of these parameters directly from it. For this purpose, call Setup with no arguments, as in Setup(), and after closing the applet the entire setup will be returned on the screen as a list of equations with the keywords on the left-hand side and their values on the right-hand side.

• 

When called with the argument conventions, Setup displays a brief summary of the computational conventions used by the Physics and Physics[Vectors] packages.

• 

A summary of the parameters that can be set, the corresponding values when Physics is loaded, and the expected types of new values when you set them by using Setup are as follows:

Parameter

Value

Expected type of new value

 

 

 

abbreviations

= true

truefalse

algebrarules

= none

set((Anti)Commutator = algebraic)

anticommutativeprefix

= none

Or(symbol, set(symbol))

assumingusesAssume

= true

truefalse

automaticsimplification

= false

truefalse

bracketbasis

= none

name

bracketrules

= none

set(Bracket(Bra, Ket) = algebraic)

combinepowersofsamebase

= false

truefalse

coordinatesystems

= none

Or(symbol, set(symbol)) # Capital letters only

cosmologicalconstant

= 0

algebraic

Dgammarepresentation

= standard

identical(standard, chiral, Majorana)

differentialoperators

= none

[name, list(name)]

differentiationvariables

= none

symbol # Capital letter

dimension

= 4

And(posint, satisfies(d -> d > 1))

disjointedspaces

= none

Or(set(symbol), set(set(symbol), set(symbol), ...))

genericindices

= none

same as spacetimeindices

geometricdifferentiation

= false

truefalse

hermitianoperators

= none

Or(name, set(name))

hideketlabel

= false

truefalse

hilbertspaces

= none

same as disjointedspaces

levicivita

= galilean

identical(galilean, nongalilean)

lapseandshift

= standard

Or(identical(standard, arbitrary), [algebraic, [algebraic, algebraic, algebraic]])

masslessfields

= none

Or(name, set(name)

mathematicalnotation

= none

truefalse

metric

= Minkowski

<keyword, line_element, Matrix, set(nonzero components)>

noncommutativeprefix

= none

Or(name={algebraic, range}, set(name={algebraic, range}))

normusesconjugate

= false

truefalse

quantumbasisdimension

= none

Or(name, set(name))

quantumcontinuousbasis

= none

Or(name, set(name))

quantumdiscretebasis

= none

Or(name, set(name))

quantumoperators

= none

Or(name, set(name))

realobjects

= none

set(Or(name, function))

redefinesum

= false

truefalse

signature

= `-`

identical(`+`, `-`, `+++-`, `-+++`, `---+`, `+---`)

spacetimeindices

= greek

identical(greek, lowercaselatin, lowercaselatin_ah, lowercaselatin_is, uppercaselatin)

spaceindices

= none

same as spacetimeindices

spinorindices

= none

same as spacetimeindices

su2indices

= none

same as spacetimeindices

su2matrixindices

= none

same as spacetimeindices

su3indices

= none

same as spacetimeindices

su3matrixindices

= none

same as spacetimeindices

tensorproductnotation

= true

truefalse

tensorsimplifier

= Physics:-TensorSimplifier

Or(procedure, algebraic)

tetrad

= none

<keyword, Matrix, set(nonzero components)>

tetradindices

= none

same as spacetimeindices

tetradmetric

= none

<keyword, Matrix, set(nonzero components)>

traceonlymatrices

= true

truefalse

unitaryoperators

= none

Or(name, set(name))

usecoordinatesastensorindices

= false

truefalse

usephysicsevaluator

= true

truefalse

usewirtingerderivatives

= false

truefalse

vectorpostfix

= none

symbol

  

Note: When the Vectors subpackage is loaded, or any of its commands is called by their long forms, the vectorpostfix is automatically set to the underscore , and geometricdifferentiation is set to true.

• 

Mathematical notation: In the standard GUI, with Typesetting level set to Extended (default), anticommutative and noncommutative variables are displayed in different colors, mathematical functions are displayed in textbook notation, if Physics[Vectors] is loaded, non-projected vectors and unit vectors are displayed with an arrow and a hat on top, respectively, the vectorial differential operators (Nabla, Curl, etc.) with an upside down triangle, and more. The notational aspects related to the Physics package can be changed to some point; the corresponding starting and expected values are:

Parameter

Value

Expected type (for details see below)

 

 

 

anticommutativecolor

= purple

identical(none, symbol) # one of 16 colors

noncommutativecolor

= olive

identical(none, symbol) # one of 16 colors

tensorproductnotation

= true

truefalse

unitvectordisplay

= hat

identical(none, hat)

vectordisplay

= arrow

identical(none, arrow, bold, halfarrow)

• 

To set the values of these parameters (could be many at the same time), call the Setup command with equations having the parameter keywords on the left-hand side, and their value on the right-hand side. The output of Setup is a list of equations of the same kind, echoing the values set.

• 

When setting values, some explanatory messages are frequently displayed on the screen. To avoid that verbosity (will not avoid the list output), use the optional argument quiet.

• 

To query the current value of any of these parameters, enter Setup(parameter) or Setup(query, parameter), where parameter is one of the keywords in the first column above. Entering Setup(query) returns the current values for all of the parameters.

• 

To clear the value of one or many of these parameters, pass the keyword clear together with the parameter(s) that you want to clear; the value is set to none.

• 

For most parameters, when setting their values, their previous settings are not discarded. For example, when you set some symbols to represent quantum operators, the previous quantum operators remain set as such. When you want to set the value of a parameter and discard the previous setting, use the optional argument redo.

• 

When setting a parameter automatically discards the previous setting, but you want to preserve that setting, use the optional argument additionally.

The parameters of the computational environment

  

A description of the parameters and the setting action associated with each of them is as follows.

Examples

with(Physics):

Setup(mathematicalnotation = true);

(1)

Query the computational setup that is loaded with the Physics package.

Setup(query);

(2)

Compute the Projector for a basis of state vectors that has not been set: it is assumed that the corresponding space is discrete.

Projector(Ket(A, n), dimension = 3);

(3)

Set a label for a continuous space of quantum states; note that you do not need to remember the exact keyword to be used, the matching mechanism will also attempt to match a part of a keyword (returning a list of options when there is more than one partial match).

Setup(continuous = R);

(4)

The corresponding projector is now a triple integral.

Projector(Ket(R, x, y, z));

(5)

Note also the difference in behavior between computing the Bracket in state vectors of discrete and continuous spaces of states. Inert representations for these commands have % as a prefix, and the computation can then be performed by using the value command.

%Bracket(Bra(A,n), Ket(A,m));

(6)

value((6));

(7)

%Bracket(Bra(R, x, y, z), Ket(R, u, v, w));

(8)

value((8));

(9)

Let  and  represent "position" and "momentum" state vectors; their scalar product is unknown to the system.

Bracket(Bra(R, x, y, z), Ket(P, p[x], p[y], p[z]));

(10)

Let their scalar product be the corresponding normalized plane wave (see references below).

(10) = 1/(2*Pi)^(3/2)*exp(I*(x*p[x] + y*p[y]+z*p[z]));

(11)

To set the above as a rule when computing Brackets between the vectors  and , use:

Setup((11));

(12)

Now this rule is used automatically.

%Bracket(Bra(R, a, b, c), Ket(P, d, e, f));

(13)

value((13));

(14)

Setup(continuousbasis = {P,R});

(15)

Projector(Ket(P, p[1], p[2], p[3]));

(16)

Bra(R, x[1], x[2], x[3]) . (16);

(17)

(16) . Ket(R, x[1], x[2], x[3]);

(18)

In the result above, to compute , the rule for  has been used, but you can also state the rule for  in addition to the rule for , by using the keyword additionally or stating the two rules at the same time.

A rule can have the same Bra and Ket in its definition and be given using inert commands (same command name preceded by %).

%Bracket(%Bra(R, x0,y0,z0), H, %Ket(R, x1,y1,z1)) = E(x1-x0, y1-y0, z1-z0);

(19)

Setup((19));

(20)

%Bracket(Bra(R, 1,2,3), H, Ket(R, 4,5,6));

(21)

value((21));

(22)

Define two quantum operators and a commutator algebra for them.

Setup(quantumop = {R, P}, algebrarule = {%Commutator(R[j], P[k]) = I*KroneckerDelta[j, k]});

(23)

Commutator(R[1], P[2]);

(24)

Commutator(R[2], P[2]);

(25)

Commutator(R[n], P[m]);

(26)

To indicate that two operators, say  and , operate on disjointed Hilbert spaces, that is, Hilbert spaces with no intersection whatsoever, you can use the keywords disjointedspaces or hilbertspaces which are synonyms. The operators acting on each Hilbert space are enclosed in a set, and there can be operators, say , acting in more than one space. For example,

Setup(hilbertspaces = {{F, H}, {G, H}});

(27)

The eigenkets of operators acting on disjointed spaces can be used to form tensor products

Ket(F, 1)*Ket(G, 1);

(28)

The ordering of the Hilbert spaces in tensor products is preserved: Bras (Kets) of the first space always appear before Bras (Kets) of the second space. For example, construct a projector into the state above

(28) . Dagger((28));

(29)

For details on the design and implementation of tensor products see Tensor product of Quantum States using Dirac's Bra-Ket Notation. Because that ordering is preserved, one can now hide the label of Bras and Kets without ambiguity, as it is usual in textbooks (e.g. in Quantum Information). For that purpose use the keyword option hideketlabel

Setup(hideketlabel = true);

(30)

The display for the projector above is now

(29);

(31)

Important: this option only hides the label at the time of displaying a Bra or a Ket. That label, however, is still there, both in the input and in the output. One can "see" what is behind this compact display using show, which works the same way as it does in the context of CompactDisplay. The actual contents being displayed in the above is thus

show;

(32)

Clear the setting of  and  as quantum operators, to allow for reusing these letters with a different meaning.

Setup(clear, op = {F, G, H});

(33)

In the output of Setup(query), at the beginning, notice that there is no anticommutative prefix set. To work with anticommutative variables, set the prefix to be used to distinguish them; for example, set it to be theta.

Setup(anticommutativeprefix = theta);

(34)

Now theta alone, followed by a positive integer, or indexed as in  where  is any valid maple object, is interpreted as an anticommutative variable.

theta[1];

(35)

(35)^2;

(36)

After loading the Physics package, you can use delay evaluation quotes to prevent the normalization of powers or products. Then simply execute the output again to evaluate.

'theta1 * theta2 + theta2 * theta1';

(37)

(37);

(38)

The second mixed derivatives with respect to different anticommutative variables anticommute (note the use of %diff, which could be Diff, the inert representations for diff, turned active by using value).

%diff(f(theta1, theta2), theta1, theta2) + %diff(f(theta1, theta2), theta2, theta1);

(39)

value((39));

(40)

Load the Physics[Vectors] package.

with(Physics[Vectors]);

(41)

By default, the vectorpostfix identifier for non-projected 3-D vectors is . So, after loading the Physics:-Vectors package any symbol ending with the underscore  is interpreted as a non-projected vector.

A_;

(42)

type(A_, PhysicsVectors);

(43)

A_ . (B_ &x A_);

(44)

Changing the vectorpostfix; the matching mechanism is used to avoid typing the entire keyword.

Setup(torp = v);

(45)

Now, neither  nor  are vectors, and  and  are non-projected vectors.

A_ . (B_ &x A_);

Error, (in Physics:-Vectors:-&x) expected a vector as first argument, received: B_

Av . (Bv &x Av);

(46)

The Dirac matrices are implemented as all the other tensors of the Physics package, so that its components can be seen using the shortcut notation

Dgamma[];

(47)

By default, when you load Physics the representation used for the Dirac matrices is the standard one

Setup(dg);

(48)

To see the components of each of Dirac's matrices the simplest way is

Dgamma[1, matrix];

(49)

Set the Majorana representation for them

Setup(mm = Majorana);

(50)

In the Majorana representation implemented in Maple, all of the components of these matrices are purely imaginary.

Dgamma[1, matrix];

(51)

Set a working 3-D Euclidean space. The following command is equivalent to Setup(dimension = 3, signature = `+`).

Setup(dimension = [3, `+`]);

(52)

Now define  as an object having tensor properties; in addition, specify that  has only one index.

Define(A[mu]);

(53)

Differentiate  with respect to .

diff(A[mu], A[~nu]);

(54)

Because the dimension is equal to 3, this evaluates to:

eval((54), nu=mu);

(55)

or directly differentiate with respect to , so that:

diff(A[mu], A[mu]);

(56)

What is known about ?

Define(A, query);

(57)

When changing the dimension in the middle of the session, the previous definitions set by Define are erased.

Setup(dim = [2, `+`], Dgammarepresentation = standard);

(58)

Define(A, query);

(59)

The components of the Dirac matrices are also automatically redefined according to the change in dimension and signature

Dgamma[1, matrix];

(60)

Setting the spacetime metric passing a keyword: it automatically sets the corresponding Coordinates accordingly, and returns the set of nonzero elements of the metric Matrix

Setup(metric = Tolman);

(61)

To see the matrix form of the metric you can enter g_ without indices

g_[];

(62)

Usually, you can select a tensor component indexing the tensor name with a number, say 1, or a contravariant number, say ~1. With paper and pencil, however, it is common practice to index tensors with the coordinates themselves representing a number: their position in the list of coordinates. To turn ON that notation, use the keyword usecoordinatesastensorindices. For example,

Setup(usecoordinates = true);

(63)

The main coordinates (i.e. the ones used by d_ and D_) are

Setup(diff);

(64)

Hence

g_[t, t] = g_[4, 4];

(65)

Remark:  is both a greek letter and a coordinate, so could be interpreted as an index or as its numerical position in the list of coordinates . When usecoordinatesastensorindices = true and such ambiguous situation happens, the letter is interpreted as its numerical position, not as an index, so the following is , not the trace of the metric:

g_[theta, theta] = g_[2, 2];

(66)

Reset the value of this setting

Setup(usecoordinates = false);

(67)

When you try to set the metric with a keyword and there is no exact match, a searchtext is performed against the keywords known, and if there is a single match, the metric is set accordingly

Setup(metric = sc);

(68)

When there are many matches, the choices are displayed and you can choose

Setup(metric = sik);

(69)

Setup(metric = [12, 38, 1]);

(70)

Setting the metric by passing the line element, as an expression quadratic in the differentials expressed using d_ or %d_. In order to use  as a coordinate, clear first its anticommutative character

Setup(clear, anticommutativepre);

(71)

Coordinates(X = [r, theta, phi, t]);

(72)

ds2 := r*d_(r)^2/(-r+2*m)-r^2*d_(theta)^2-r^2*sin(theta)^2*d_(phi)^2+(r-2*m)*d_(t)^2/r;

(73)

Setup(metric = ds2);

(74)

The Minkowski line element, expressing the differentials concatenating d to the coordinates

Coordinates(redo, X);

(75)

ds2 := - dx1^2 - dx2^2 - dx3^2 + dx4^2;

(76)

Setup(metric = ds2);

(77)

Setting the metric passing a Matrix or its nonzero components

G := Matrix(4, 4, {(1, 1) = r/(-r+2*m), (2, 2) = -r^2, (3, 3) = -r^2*sin(theta)^2, (4, 4) = (r-2*m)/r}, shape = symmetric);

(78)

Setup(coordinates = spherical, metric = G);

(79)

Setup(coordinates = cartesian, metric = {(1, 1) = -3*y^(-2+2*k)*epsilon/abs(Lambda), (1, 4) = -3/(2*y^2*abs(Lambda)), (2, 2) = 3/(y^2*abs(Lambda)), (3, 3) = 3/(y^2*abs(Lambda))});

(80)

By default, usephysicsevaluator is set to true so that contracted indices in tensorial expressions are automatically rewritten as one covariant one contravariant.

Define(A, B);

(81)

A[mu]^2;

(82)

A[mu]*B[mu];

(83)

When the indices are already given as one covariant, one contravariant, they are not changed

A[~mu]*B[mu] - A[mu]*B[~mu];

(84)

If, however, you are working with tensorial expressions of thousands of terms and experience a slowdown in performance you can try setting the value to false

Setup(usephysicsevaluator = false);

(85)

The indices now remain the way you enter them (to enter a contravariant index, prefix it with ~)

A[mu]^2;

(86)

A[mu]*B[mu];

(87)

Automatic simplification requires the Physics evaluator and is turned ON using the automaticsimplification keyword. The starting value of this keyword is false

Setup(automaticsimplification);

(88)

After setting automaticsimplification = true, everything gets automatically simplified in size before being returned to the screen. An example not related to Physics:

-3*sin(x)^(1/2)*cos(x)^2*sin(x)^m+3*sin(x)^(1/2)*cos(x)^2*cos(x)^n+4*sin(x)^(1/2)*cos(x)^4*sin(x)^m-4*sin(x)^(1/2)*cos(x)^4*cos(x)^n;

(89)

Activate now the feature and re-enter this same expression

Setup(usephysicsevaluator = true, automaticsimplification = true);

(90)

-3*sin(x)^(1/2)*cos(x)^2*sin(x)^m+3*sin(x)^(1/2)*cos(x)^2*cos(x)^n+4*sin(x)^(1/2)*cos(x)^4*sin(x)^m-4*sin(x)^(1/2)*cos(x)^4*cos(x)^n;

(91)

The combinepowersofsamebase keyword: its starting value is false

Setup(combinepowersofsamebase);

(92)

Activate the feature

Setup(combinepowersofsamebase = true);

(93)

From here on, powers of the same base are automatically combined when that is mathematically correct

A^m*A^n;

(94)

The combination is valid for noncommutative  provided that n and m commute. For exponentials, Glauber's formula is automatically taken into account. Set for instance A, B and C to be noncommutative operators, A and B to commute with C, and C equal to the commutator of A and B

Setup(op = {A, B, C}, %Commutator(A, C) = 0, %Commutator(B, C) = 0, %Commutator(A, B) = C);

(95)

Automatic combination of exponentials using Glauber's formula

exp(A)*exp(B);

(96)

Turn the feature OFF and expand the previous result:

Setup(combine = false);

(97)

expand((96));

(98)

To indicate that certain names are differential operators use the differentialoperators keyword with a list on the right-hand side, containing two operands: the name variable and a list with the corresponding differentiation variables, or to set many of them at the same time pass the many corresponding lists as a set. For example

Setup(differentialoperators = {[theta__x, [x, z]], [theta__y, [y, z]]});

(99)

So now these names are noncommutative and these operators do not commute with the corresponding differentiation variables

type(theta__x, noncommutative);

(100)

Library:-Commute(theta__x, x);

(101)

Library:-Commute(theta__y, x);

(102)

Library:-Commute(theta__x, theta__y);

(103)

So you can now use these operators in products of algebraic expressions and have them applied to the objects to their right only when desired using Library:-ApplyProductsOfDifferentialOperators

(theta__x * theta__y + theta__y * theta__x + 1) * x;

(104)

Library:-ApplyProductsOfDifferentialOperators((104));

(105)

You can also define commutation relationships between the differential operators and everything else, to be taken into account at the time of applying the products of differential operators. For example:

Setup(%Commutator(theta__x, theta__y) = 0);

(106)

Library:-ApplyProductsOfDifferentialOperators((104));

(107)

 

See Also

Bra, Bracket, Conventions, Coordinates, d_, D_, dAlembertian, Define, Dgamma, g_, Ket, LapseAndShiftConditions, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Physics[`*`], Physics[.], Projector, Vectors

References

  

Cohen-Tannoudji, C.; Diu, B.; and Laloe, F. Quantum Mechanics, Chapter II. Paris, France: Hermann, 1977.

  

Stephani, H., Kramer, D., MacCallum, M., Hoenselaers, C. Herlt, E.  Exact Solutions of Einstein's Field Equations, Cambridge Monographs on Mathematical Physics, second edition. Cambridge University Press, 2003.


Download Help Document