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

Online Help

All Products    Maple    MapleSim


Physics:-Library - A programming language for Physics

Calling Sequence

Physics:-Library:-Command(arguments, options)

Parameters

Command

-

a Command of the Physics Library; could be any of those shown via with(Physics:-Library)

arguments

-

the arguments of Command

options

-

Most Library Commands accept optional arguments of the form name = value

Description

• 

This Physics Library got introduced in Maple 17 with 96 programming commands and 58 specialized Physics types, all key elements of the programming language used at Maplesoft to construct Physics. This library has been growing; in Maple 2019 there are 159 programming commands and 98 Physics types. These commands and types can be useful to program your own extensions of Physics. Many of these commands are useful interactively too, like for instance AntiCommute, Commute, Degree for noncommutative variables, IsTensorialAntisymmetric, IsTensorialSymmetric, MinimizeTensorComponents for tensors, Backup and Restore to explore with different settings for algebra rules, spacetime dimensions, and so on.

• 

To load this Library of programming commands, enter:

with(Physics): with(Library):

  

You can also use any of these commands without loading the Library by using the long form, as in Library:-Command.

• 

To see a complete list of the Physics types available, because PhysicsType is one of the commands of the Library, and a module itself, you can enter exports(PhysicsType), or instead list them alphabetically using another Library command, ListPhysicsTypes:

ListPhysicsTypes();

AnnihilationCreationOperator,AnnihilationOperator,AppliableProcedure,AppliedQuantumOperator,AtProcedure,BosonAnnihilationCreationOperator,BosonAnnihilationOperator,BosonCreationOperator,Bra,Bracket,CommutativeMapping,CompositeDifferentiationOperator,Contravariant,ContravariantGreek,Covariant,CreationOperator,D_,DifferentialOperator,DifferentialOperatorIndexed,DifferentialOperatorSymbol,DiracSpinor,DiracSpinorWithoutIndices,DoublyIndexedPhysicsMatrix,EntirelyNotNestedIntegral,EuclideanIndex,ExpandableProduct,ExtendedBra,ExtendedDifferentialOperator,ExtendedDifferentialOperatorIndexed,ExtendedDifferentialOperatorSymbol,ExtendedKet,ExtendedMatrix,ExtendedMatrixRequiringEval,ExtendedPhysicsMatrix,ExtendedProjector,ExtendedProjectorKind,ExtendedQuantumOperator,ExtendedTensor,ExtendedVectorDifferentialOperator,FermionAnnihilationCreationOperator,FermionAnnihilationOperator,FermionCreationOperator,FullyCommutative,HalfInteger,HermitianOperator,IdentityMatrix,InertSymbol,Ket,LeviCivitaTensor,LinearOperatorFunction,LiteralSubscript,NegativePower,NonCommutativeProduct,NotNestedIntegral,NumericalIndex,P_indexed,P_suffixed,PhysicsD3_2,PhysicsD_2,PhysicsFunction,PhysicsKnownFunction,PhysicsMatrix,PhysicsMatrixWithMatrixIndices,PhysicsTensor,PhysicsVectors,Physicsd_2,Polynomial,Procedure,Projector,ProjectorCore,ProjectorInt,ProjectorKind,ProjectorKindDot,ProjectorKindStar,ProjectorSum,QuantumNumber,QuantumObject,QuantumOperator,QuantumOperatorFunction,SpaceIndexValue,SpaceTimeVectorApplied,SpacetimeIndexValue,SumOfNegatives,SymbolicTensorIndex,Tensor,TensorAllowWithoutIndices,TensorInCurrentCoordinates,TensorIndex,TensorInternalRepresentation,TensorQuantumOperator,TensorStructure,TensorVector,TensorWithAbstractIndices,TensorWithIndices,TensorWithNumericalIndices,TensorWithoutIndices,TensorialExpression,TripleProduct,UnitaryOperator,VectorDifferentialOperator,VectorOperator,VectorOperatorApplied,Vectorial,X_mu,dg_dg,genericindex,p_P_indexed,p_P_suffixed,p_indexed,p_suffixed,spaceindex,spacetimeindex,spinorindex,su2index,su2matrixindex,su3index,su3matrixindex,tetradindex,x_mu

(1)
  

You can see the definition of these types in two different ways. First, using the option showdefinition of ListPhysicsTypes. For example:

ListPhysicsTypes(AnnihilationCreationOperator, showdefinition);

AnnihilationCreationOperator=AnnihilationOperatorCreationOperator

(2)
  

Secondly, the definition for each PhysicsType can be retrieved using TypeTools:-GetType, for example:

TypeTools:-GetType(PhysicsType:-AnnihilationCreationOperator);

AnnihilationOperatorCreationOperator

(3)
• 

If you load the package of types via with(PhysicsType), you can also see this definition entering just TypeTools:-GetType(AnnihilationCreationOperator). Recall however that by entering with(PhysicsType) you will populate the space of working names with the names of all the Physics types.

• 

These types are used as in type(A, PhysicsType:-TypeKeyword) or using the long forms Library:-PhysicsType:-TypeKeyword or Physics:-Library:-PhysicsType:-TypeKeyword, depending on whether you have already loaded Physics or Physics:-Library using with. In all cases A can be anything, and TypeKeyword is any of the types returned above by ListPhysicsTypes() or exports(PhysicsType). Note that you do not need to list these types before using them.

• 

Mathematical notation: When Physics or Physics:-Vectors are loaded in the Standard Graphical User Interface, by entering

with(Physics): Setup(mathematicalnotation = true);

mathematicalnotation=true

(4)
  

you have anticommutative and noncommutative variables displayed in different colors, non-projected vectors and unit vectors are respectively displayed with an arrow and a hat on top, the vectorial differential operators (such as Nabla, Laplacian) with an upside down triangle, and most of the other Physics commands are displayed as in textbooks.

• 

Examples: illustrating the use of the package's commands in Analytical Geometry, Mechanics, Electrodynamics, Special and General Relativity, and Quantum Mechanics are found in Physics examples (this page opens only in the Standard Graphical User Interface).

• 

Instead of providing a help page for each of these Library programming tools, below there is an alphabetical listing of them, linking to sections within this single page, where their calling sequence, parameters, description, and examples are shown.

List of the Physics Library Commands

Add

AntiCommute

ApplyCommandUsingImplicitAssumptions

ApplyProductsOfDifferentialOperators

Backup

BelongToDifferentDisjointedSpaces

BelongToDisjointedSpaces

BelongToTheSameDisjointedSpace

CartesianProduct

CombinePowersOfSameBase

Commute

Contravariant

CoordinatesINFO

Covariant

DefaultAlgebraRules

Degree

DelayEvaluationOfTensors

Dgamma5ToOtherDgamma

DiscardTermsOfHigherDegree

ExpandProductsInExpression

FlattenPowersInProduct

FlipCharacter

FlipCharacterOfFreeIndices

Forget

ForgetInAllRememberTables

FromCoordinatesToLabel

FromGeneralRelativityTensorFunctionalForm

FromLabelToCoordinates

FromMetricToLineElement

FromMinkowskiKindToSignature

FromSignatureToMinkowskiKind

FromSpaceTimeVector

FromTensorFunctionalForm

FromTensorInternalRepresentation

FromTetradToTetradMetric

GetAlgebraRuleName

GetAlgebraRules

GetAntiCommutativeSymbol

GetBasisContinuityInfo

GetBasisDimension

GetCommutativeSymbol

GetCoordinateSystem

GetCoordinatesAlias

GetDefineINFO

GetDifferentialOperators

GetDifferentiationVariables

GetDimensionNumbers

GetDimensionNumbersSequence

GetDimensionOfIndex

GetDimensionOfTypeOfIndex

GetDimensionRange

GetExistingAnnihilationCreationOperator

GetFAndDifferentiationVariables

GetFingerprint

GetGeneralRelativityTensorFunctionalForm

GetIndicesAndCharacter

GetIndicesInUse

GetIndicesOfType

GetNameIndicesVariables

GetNameWithIndices

GetNameWithoutIndices

GetNonCommutativeSymbol

GetNotCommutativeNamesAndFunctions

GetProjectorCore

GetRepeatedIndices

GetReplacementIndices

GetSetupINFO

GetSpaceTimeVectors

GetSumIntCore

GetSymbolsWithSameType

GetTensorDependency

GetTensorFunctionalForm

GetTensorIndices

GetTensorNamesInExpression

GetTensorProductArrayOfCoefficients

GetTensorSymmetryProperties

GetTypeOfIndex

GetTypeOfTensorIndices

GetVectorRootName

HasAfterAtomizingNames

IndicesOfKindOfLetter

InertProductToInertPower

IsACSuffixed

IsAntiCommutatorVariable

IsAnticommutativeMappingOfAnticommutativeVariables

IsCommutativeMappingOfAnticommutativeVariables

IsCommutatorVariable

IsContravariant

IsCovariant

IsEuclideanMetric

IsEuclideanSignature

IsGalileanMetric

IsGalileanSignature

IsHermitianOperator

IsLiteralSubscript

IsMinkowskiMetric

IsMinkowskiSignature

IsNCSuffixed

IsNoncommutativeMappingOfAnticommutativeVariables

IsNullTetradMetric

IsOrthonormalTetradMetric

IsRealObject

IsSymmetricMatrix

IsTensorInCurrentCoordinates

IsTensorialAntisymmetric

IsTensorialSymmetric

IsUnitaryOperator

IsValidSignature

IsVectorSymbol

ListPhysicsTypes

MinimizeTensorComponents

NestLeftAssociative

NormalizeProductsOfDifferentialOperators

NormalizeTensor

NormalizeTensorExpression

NumberOfIndependentTensorComponents

OperationOnInertCommand

PerformMatrixOperations

PhysicsType

PositionOfTimelikeComponent

PowerToProduct

PrintWithTypesetting

PutCharacterAttributesBack

PutCharacterAttributesInExpression

PutCharacterAttributesInTensor

PutZeroDimensionEntries

Quiet

RealObjects

RecycleArguments

RedefineTensorComponent

ReformatRepeatedIndices

RelabelTensorComponents

RemoveIntegerIndices

ReplaceCommonRepeatedIndices

ReplaceRepeatedIndices

Restore

RewriteInMatrixForm

RewriteTypeOfIndices

RootOfIndex

SearchDGMetricTable

ShieldDummyIndicesInFunctionArguments

ShowTypeDefinition

SignOfTimelikeComponent

SortAnticommutativeList

SortQuantumObjectsThatCommute

SplitIndicesByType

StripTilde

StripTildeFromRepeatedIndices

SubsTensorIndices

SubstituteMatrix

SwapLinesAndColumns

TensorComponents

ToContravariant

ToCovariant

ToGeneralRelativityTensorFunctionalForm

ToSpaceTimeVector

ToTensorFunctionalForm

ToTensorInternalRepresentation

TypesetPrint

UpdateCharacterAttributesInExpression

UpdateCharacterAttributesInTensor

UpdateQnInUse

Add

  

Calling Sequence

  

Physics:-Library:-Add(f, k = m..n)

  

Parameters

  

f    : algebraic expression

  

k    : name; summation index

  

m, n : integers or arbitrary expressions, indicate the summation range

  

Description

  

Add unifies the standard add and sum commands into one that uses a more modern handling of arguments, is free of premature evaluation problems, and implements multi-index summation. The functionality and handling of arguments of Add can be plugged directly into the sum command using the option redefinesum of Physics:-Setup.

  

Examples

restart: with(Physics): with(Library):

  

Consider this multi-index summation.

Add(f[i, j], 1 <= i+j and i+j <= n);

Physics:-Library:-Addfi&comma;j&comma;i&plus;jn&comma;lowerbound&equals;1

(5)
  

For instance, for n=2,

eval((5), n = 2);

f0,1+f1,0+f0,2+f1,1+f2,0

(6)
  

The formula for the integer power of a sum is:

(a+b+c)^n = Add(factorial(n)*a^p*b^q*c^r/(factorial(p)*factorial(q)*factorial(r)), p+q+r = n);

a&plus;b&plus;cn&equals;Physics:-Library:-Add`*`factorialn&comma;`^`a&comma;p&comma;`^`b&comma;q&comma;`^`c&comma;r&comma;`^``*`factorialp&comma;factorialq&comma;factorialr&comma;1&comma;p&plus;q&plus;r&equals;n

(7)

eval((7), n = 3);

a+b+c3=a3+3a2b+3a2c+3ab2+6abc+3ac2+b3+3b2c+3bc2+c3

(8)
  

A more modern handling of its arguments, consider a typical problem where a name, say j, is assigned a value, and j is used as dummy summation variable

a, b, j := 1, 2, 3;

a,b,j1,2,3

(9)
  

The value just assigned, j=3, is not expected to interfere with the summation

Add(f[j], j = a..b);

f1+f2

(10)
  

while for this example, sum interrupts with an error message due to a premature evaluation of the summation index j. Another frequent case: a procedure that returns a value according to the value of the summation index.

g := k -> if k::odd then G[k] else 0 end if;

gkifk::oddthenGkelse0endif

(11)
  

Without giving a value to the summation limit f, the following summation cannot be performed.

Add(g(k), k = 1 .. f);

Physics:-Library:-Addgk&comma;k&equals;1..f

(12)
  

For this example, add interrupts with an error message while sum returns 0, again due to a premature evaluation of gk before k has a numerical value. Using a more modern handling of arguments Add returns unevaluated instead, as seen above, which permits evaluating the summation at a later moment, for instance attributing a value to f.

eval((12), f = 3);

G1+G3

(13)
  

See Also

  

add, sum, Physics[Setup]

AntiCommute

  

Calling Sequence

  

Physics:-Library:-AntiCommute(a, b)

  

Parameters

  

a    : any Maple algebraic expression

  

b    : any Maple algebraic expression

  

Description

  

AntiCommute returns true or false according to whether a and b anticommute, that is, a*b = -b*a.

  

Examples

restart: with(Physics): with(Library):

Setup(anticommutativepre = A):

* Partial match of 'anticommutativepre' against keyword 'anticommutativeprefix'

_______________________________________________________

(14)

AntiCommute(A1, A2);

true

(15)
  

See Also

  

Commute

ApplyCommandUsingImplicitAssumptions

  

Calling Sequence

  

Physics:-Library:-ApplyCommandUsingImplicitAssumptions(command, ee)

  

Parameters

  

command : a maple command to be applied to ee

  

ee      : a Maple object, typically an algebraic expression or equation or set of them, containing definite integrals, sums, or products

  

Description

  

ApplyCommandUsingImplicitAssumptions applies any command to expressions containing sums, integrals or products such that the command is applied to the summand (integrand or 1st argument of the product) taking into account the assumptions implicit in the summation (integration or product) range.

  

Any additional argument passed to ApplyCommandUsingImplicitAssumptions is passed as an optional argument for command when performing the operation.

  

Examples

restart: with(Physics): with(Library):

Sum((a*b)^k, k = a .. b);

k=ababk

(16)
  

expand will not expand the power in the summand: it does not know about k being an integer (implicit assumption in the Sum structure)

expand((16));

k=abakbk

(17)
  

The following makes expand be aware of the implicit assumptions on k and so expand the power

ApplyCommandUsingImplicitAssumptions(expand, (16));

k=abakbk

(18)
  

See Also

  

assuming, simplify

ApplyProductsOfDifferentialOperators

  

Calling Sequence

  

Physics:-Library:-ApplyProductsOfDifferentialOperators(ee)

  

Parameters

  

e : any valid Maple object, possibly an expression, that may contain products involving differential operators

  

Description

  

Given an algebraic expression ee, or any Maple object (e.g. set, list or Matrix) containing such expressions, ApplyProductsOfDifferentialOperators applies the differential operators found in the products to the operands appearing to their right.

  

Examples

restart: with(Physics): with(Library): with(Vectors):

  

Consider the commutator between a scalar Ax&comma;y&comma;z and the  operator; use CompactDisplay for convenience

CompactDisplay(A(x, y, z), B_(x, y, z));

Ax&comma;y&comma;zwill now be displayed asA

Bx&comma;y&comma;zwill now be displayed asB

(19)

Commutator(Nabla, A(x, y, z));

CommutatorNabla&comma;Ax&comma;y&comma;z

(20)
  

The expanded form of this commutator has the correct operatorial meaning:

expand((20));

`*`Nabla&comma;Ax&comma;y&comma;z`*`Ax&comma;y&comma;z&comma;Nabla

(21)
• 

So all the algebra is performed taking  as a noncommutative operator, as we do when computing with paper and pencil. You can apply the differential operators at any time using the ApplyProductsOfDifferentialOperators

ApplyProductsOfDifferentialOperators((21));

diffAx&comma;y&comma;z&comma;x_i&plus;diffAx&comma;y&comma;z&comma;y_j&plus;diffAx&comma;y&comma;z&comma;z_k`*`Ax&comma;y&comma;z&comma;Nabla

(22)
  

The differentiation variables associated to  are the coordinates of the Cartesian cylindrical and spherical systems of coordinates: x&comma;y&comma;z&comma;ρ&comma;φ&comma;r&comma;θ. The same concept is implemented for the differential operators of special and special and general relativity, d_ and D_. Define system of coordinates, X, then A and B as a tensors and for convenience use a CompactDisplay

Coordinates(X);

Systems of spacetime coordinates are:X=x1&comma;x2&comma;x3&comma;x4

X

(23)

Define(A[mu], B[mu]);

Defined objects with tensor properties

Aμ&comma;Bμ&comma;γμ&comma;σμ&comma;μ&comma;gμ,ν&comma;εα,β,μ,ν&comma;Xμ

(24)

CompactDisplay((A, B)(X));

Ax1&comma;x2&comma;x3&comma;x4will now be displayed asA

Bx1&comma;x2&comma;x3&comma;x4will now be displayed asB

(25)
  

The commutator of d_μ and Aν multiplied by Bα, representing the application of d_μ can now be represented as

Commutator(d_[mu], A[nu](X))*B[alpha](X);

`*`Commutatord_&mu;&comma;A&nu;X&comma;B&alpha;X

(26)

expand((26));

`*`d_&mu;&comma;A&nu;X&comma;B&alpha;X`*`A&nu;X&comma;d_&mu;&comma;B&alpha;X

(27)
  

Note that to the right of d_μ in the first term there is the product AνBα, so that when applying the operator to the product, two terms result, one of which cancels the second term in the above:

Library:-ApplyProductsOfDifferentialOperators((27));

d_&mu;A&nu;X&comma;XB&alpha;X

(28)
  

ApplyProductsOfDifferentialOperators also applies differential operators that you define as such using Setup. This is particularly useful in quantum mechanics.

Setup(differentialoperators = {[p_, [x, y, z]]}, hermitianoperators = {p, x, y, z}, algebrarules = {%Commutator(x, y) = 0, %Commutator(x, z) = 0, %Commutator(y, z) = 0}, quiet);

algebrarules&equals;%Commutatorx&comma;y&equals;0&comma;%Commutatorx&comma;z&equals;0&comma;%Commutatory&comma;z&equals;0&comma;differentialoperators&equals;p_&comma;x&comma;y&comma;z&comma;hermitianoperators&equals;p&comma;x&comma;y&comma;z

(29)

alias(:-X = (x, y, z)):

CompactDisplay(F(X)):

Fx&comma;y&comma;zwill now be displayed asF

(30)

%Commutator(F(X), p_)*Ket(psi, X);

`*`%CommutatorFX&comma;p_&comma;Ket&psi;&comma;x&comma;y&comma;z

(31)
  

Note that p, FX and the ket Ketψ&comma;x&comma;y&comma;z are operands in the products above and that they do not commute: we indicated that the coordinates X are the differentiation variables of p. This emulates what we do when computing with these operators with paper and pencil, where we represent the application of a differential operator as a product operation.

  

This representation can be transformed into the (traditional in computer algebra) application of the differential operator when desired, as follows:

(31) = expand((31));

`*`%CommutatorFX&comma;p_&comma;Ket&psi;&comma;x&comma;y&comma;z&equals;`*`FX&comma;p_&comma;Ket&psi;&comma;x&comma;y&comma;z`*`p_&comma;FX&comma;Ket&psi;&comma;x&comma;y&comma;z

(32)

(31) = ApplyProductsOfDifferentialOperators(rhs((32)));

`*`%CommutatorFX&comma;p_&comma;Ket&psi;&comma;x&comma;y&comma;z&equals;`*`FX&comma;p_Ket&psi;&comma;x&comma;y&comma;zp_`*`FX&comma;Ket&psi;&comma;x&comma;y&comma;z

(33)
  

See Also -(lead=indent) CompactDisplay, Coordinates, Define, d_, D_, Setup, Physics:-Vectors, Physics:-Vectors:-Nabla

Backup

  

Calling Sequence

  

Physics:-Library:-Backup()

  

Parameters

  

: no parameters

  

Description

  

Backup saves in memory a copy of the current Physics Setup, so that it can be restored at a later moment, during the same Maple session, using the Physics:-Library:-Restore; command. Backup returns NULL.

  

Examples

restart: with(Physics): with(Library):

Setup(noncommutativeprefix);

noncommutativeprefix=none

(34)

Backup();

Setup(noncommutativeprefix = Z);

noncommutativeprefix=Z

(35)

Commute(Z1, Z2);

false

(36)

Restore();

Setup(noncommutativeprefix);

noncommutativeprefix=none

(37)

Commute(Z1, Z2);

true

(38)
  

See Also

  

Restore

BelongToDifferentDisjointedSpaces

  

Calling Sequence

  

Physics:-Library:-BelongToDifferentDisjointedSpaces(A, B)

  

Parameters

  

A, B      : quantum operators set as such using Setup, or Bras or Kets

  

Description

  

Given A and B as quantum operators or Bras or Kets, BelongToDifferentDisjointedSpaces returns true or false according to whether A and B below to different (disjointed) Hilbert spaces. products, correctly handling the case of noncommutative products and powers and using Glauber's formula for combining exponentials when the exponents commute with their commutator. Note that this functionality, including taking into account the possibly noncommutative character of the operands and powers in a product, is already present in the standard combine command that makes calls to CombinePowersOfSameBase, so you can directly use combine.

  

Examples

restart: with(Physics): with(Library):

Setup(op = {A, B});

* Partial match of 'op' against keyword 'quantumoperators'

_______________________________________________________

quantumoperators=A&comma;B

(39)

A^n * A^m + exp(A) * exp(B);

AmAn+&ExponentialE;A&ExponentialE;B

(40)
  

In this expression, the exponentials in the product &ExponentialE;A&ExponentialE;B cannot be combined because neither A nor B are commutative:

CombinePowersOfSameBase((40));

Am+n+&ExponentialE;A&ExponentialE;B

(41)
  

If, however, A and B commute with their commutator,

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

algebrarules&equals;%CommutatorA&comma;B&equals;C&comma;%CommutatorA&comma;C&equals;0&comma;%CommutatorB&comma;C&equals;0

(42)

CombinePowersOfSameBase((40));

Am+n+&ExponentialE;A+B+C2

(43)
  

This functionality is already present in the standard combine command that makes calls to CombinePowersOfSameBase.

combine((40));

Am+n+&ExponentialE;A+B+C2

(44)
  

See Also

  

BelongToTheSameDisjointedSpace, Physics[Setup]

CombinePowersOfSameBase

  

Calling Sequence

  

Physics:-Library:-CombinePowersOfSameBase(ee)

  

Parameters

  

ee      : a Maple object, typically an algebraic expression or equation or a set of them

  

Description

  

CombinePowersOfSameBase combines powers of same base in products, correctly handling the case of noncommutative products and powers and using Glauber's formula for combining exponentials when the exponents commute with their commutator. Note that this functionality, including taking into account the possibly noncommutative character of the operands and powers in a product, is already present in the standard combine command that makes calls to CombinePowersOfSameBase, so you can directly use combine.

  

Examples

restart: with(Physics): with(Library):

Setup(op = {A, B});

* Partial match of 'op' against keyword 'quantumoperators'

_______________________________________________________

quantumoperators=A&comma;B

(45)

A^n * A^m + exp(A) * exp(B);

AmAn+&ExponentialE;A&ExponentialE;B

(46)
  

In this expression, the exponentials in the product &ExponentialE;A&ExponentialE;B cannot be combined because neither A nor B are commutative:

CombinePowersOfSameBase((40));

Am+n+&ExponentialE;A&ExponentialE;B

(47)
  

If, however, A and B commute with their commutator,

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

algebrarules&equals;%CommutatorA&comma;B&equals;C&comma;%CommutatorA&comma;C&equals;0&comma;%CommutatorB&comma;C&equals;0

(48)

CombinePowersOfSameBase((40));

Am+n+&ExponentialE;A+B+C2

(49)
  

This functionality is already present in the standard combine command that makes calls to CombinePowersOfSameBase.

combine((40));

Am+n+&ExponentialE;A+B+C2

(50)
  

See Also

  

combine, Physics[Commutator], Physics[Setup]

Commute

  

Calling Sequence

  

Physics:-Library:-Commute(a, b)

  

Parameters

  

a    : any Maple algebraic expression

  

b    : any Maple algebraic expression

  

Description

  

Commute returns true or false according to whether a and b commute, that is, ab=ba.

  

Examples

restart: with(Physics): with(Library):

Setup(noncommutativepre = A, %Commutator(A1, A2) = 0):

* Partial match of 'noncommutativepre' against keyword 'noncommutativeprefix'

_______________________________________________________

(51)

Commute(A1, A2);

true

(52)

Commute(A1, A3);

false

(53)
  

See Also

  

AntiCommute

Contravariant

  

Calling Sequence

  

Physics:-Library:-Contravariant(mu)

  

Parameters

  

mu    : any Maple algebraic expression

  

Description

  

Contravariant receives an algebraic expression representing a tensor index, and returns its corresponding contravariant index according to: if mu is a symbol (not already prefixed with ~), or a non-negative integer smaller or equal to the spacetime dimension, then prefix it with (that is, concatenate) ~; else if mu is a sum of such indices, then prefix all of them with ~; otherwise return mu unchanged.

  

Examples

restart: with(Physics): with(Library):

Contravariant(mu);

~mu

(54)

Contravariant(mu + nu);

~mu+~nu

(55)

Setup(dimension);

dimension=4

(56)

Contravariant(3);

~3

(57)

Contravariant(5);

5

(58)
  

See Also

  

Covariant, FlipCharacter, StripTilde, StripTildeFromRepeatedIndices, ToContravariant

CoordinatesINFO

  

Calling Sequence

  

Physics:-Library:-CoordinatesINFO()

  

Parameters

  

: no parameters

  

Description

  

CoordinatesINFO returns information about systems of spacetime coordinates set using Coordinates or Setup, as a list with four equations, where in the left-hand sides are the local variables of Physics where the information about the coordinates is saved and in the right-hand sides are the actual value of these variables. This information is of use in various parts of the library that need to handle spacetime coordinates.

  

Examples

restart: with(Physics): with(Library):

CoordinatesINFO();

Coordinates/X=&comma;Coordinates/xyz=&comma;Coordinates/X_equal_xyz=&comma;Coordinates/with_macros=

(59)

Coordinates(X=spherical);

Systems of spacetime coordinates are:X=r&comma;θ&comma;φ&comma;t

X

(60)
  

Remove the alias X to turn visible the information in the next input line

alias(X = X):

CoordinatesINFO();

Coordinates/X=X&comma;Coordinates/xyz=r&comma;θ&comma;φ&comma;t&comma;Coordinates/X_equal_xyz=X=r&comma;θ&comma;φ&comma;t&comma;Coordinates/with_macros=X=x1&comma;x2&comma;x3&comma;x4

(61)
  

See Also

  

Physics[Coordinates], alias, macro

Covariant

  

Calling Sequence

  

Physics:-Library:-Covariant(mu)

  

Parameters

  

mu    : a symbol or an algebraic expression

  

Description

  

Covariant receives an algebraic expression representing a tensor index, and returns its corresponding covariant index according to: if mu is a symbol prefixed with ~, then remove the ~, otherwise return mu unchanged.

  

Examples

restart: with(Physics): with(Library):

Covariant(~mu);

μ

(62)

Covariant(mu);

μ

(63)
  

See Also

  

Contravariant, FlipCharacter, StripTilde, StripTildeFromRepeatedIndices, ToCovariant

Degree

  

Calling Sequence

  

Physics:-Library:-Degree()

  

Parameters

  

EE  : any Maple algebraic object, or equation or a set or list of them

  

X   : a name or a set of them

  

minmax : optional, can be min, max (default), or both, to request the minimal (equivalent to the lower degree), maximal degree with respect to X, or both (returns a sequence of two numbers)

  

Description

  

Degree computes the maximum degree of a set of equations EE with respect to variable(s) X, possibly not commutative.

  

NOTE: if all the equations are equal to 0, the value returned is 0, not -infinity. When the degree cannot be computed, Degree returns FAIL.

  

Examples

restart: with(Physics): with(Library):

Degree({a, b^2, c^3}, {a, b, c});

3

(64)
  

See Also

  

Physics[Coefficients]

FlattenPowersInProduct

  

Calling Sequence

  

Physics:-Library:-FlattenPowersInProduct(A0)

  

Parameters

  

A0  : any algebraic object or a table

  

Description

  

FlattenPowersInProduct receives an expression, and if it is a power, where the base can be not commutative and the exponent an integer, returns the corresponding product of operands. If A0 is a table, it maps over its elements.

  

Examples

restart: with(Physics): with(Library):

Setup(op = A);

* Partial match of 'op' against keyword 'quantumoperators'

_______________________________________________________

quantumoperators=A

(65)

FlattenPowersInProduct(A^3);

AAA

(66)
  

See Also

  

InertProductToInertPower, PowerToProduct

FlipCharacter

  

Calling Sequence

  

Physics:-Library:-FlipCharacter(mu,{ignorefailure: truefalse := false})

  

Parameters

  

mu              : a tensor index, covariant or contravariant

  

ignorefailure   : optional, when given, if mu is not a covariant/contravariant index, return mu itself instead of FAIL

  

Description

  

FlipCharacter flips the covariant or contravariant character of a given index, or returns FAIL when mu is not an index or the covariant/contravariant character cannot be determined.

  

Examples

restart: with(Physics): with(Library):

Setup(spacetimeindices = greek);

spacetimeindices=greek

(67)

FlipCharacter(mu);

~mu

(68)

FlipCharacter(~mu);

μ

(69)
  

See Also

  

Contravariant, Covariant, StripTilde, StripTildeFromRepeatedIndices

Forget

  

Calling Sequence

  

Physics:-Library:-Forget()

  

Parameters

  

: no parameters

  

Description

  

Forget clears all the remember tables of the internal subroutines of the Physics package, as well as those of simplify, expand, diff, normal, and int. This command is automatically used by all the Physics commands when appropriate, for example, when defining new algebras or tensors, so that computations performed before that with the same mathematical objects, and stored in remember tables, are cleared to permit the next computations take into account the new properties of the objects.

  

Examples

restart;

expand(A*(B+C));

AB+AC

(70)
  

Expand swaps operands in products.

expand((B+C)*A);

AB+AC

(71)
  

Expand keeps results in a remember table.

op(4, eval(expand));

tableB+C=B+C&comma;AB+C=AB+AC

(72)

with(Physics): with(Library):

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

* Partial match of 'op' against keyword 'quantumoperators'

_______________________________________________________

quantumoperators=A&comma;B&comma;C

(73)
  

The remember table got cleared to permit products with noncommutative operands.

op(4, eval(expand));

  

No swapping of operands and no interference of the previous remember table.

expand((B+C)*A);

BA+CA

(74)
  

See Also

  

forget, simplify, expand, diff, normal, int

FromCoordinatesToLabel

  

Calling Sequence

  

Physics:-Library:-FromCoordinatesToLabel(`[X]`, {disregardordering: truefalse := false})

  

Parameters

  

`[X]`             : a list of spacetime coordinates set using Coordinates or Setup

  

disregardordering   : optional, true or false (default), to disregard the ordering of the spacetime variables within the list `[X]`

  

Description

  

FromCoordinatesToLabel receives a list of spacetime coordinates and returns the corresponding label assigned previously by the Coordinates command, when the system of coordinates got defined either using Setup or using Coordinates.

  

Examples

restart: with(Physics): with(Library):

Coordinates(X):

Systems of spacetime coordinates are:X=x1&comma;x2&comma;x3&comma;x4

(75)

FromCoordinatesToLabel([x1, x2, x3, x4]);

X

(76)
  

See Also

  

FromLabelToCoordinates

FromGeneralRelativityTensorFunctionalForm

  

Calling Sequence

  

Physics:-Library:-FromGeneralRelativityTensorFunctionalForm(A, {evaluatetensor: truefalse := true}, $)

  

Parameters

  

A               : an algebraic expression involving tensors in a nongalilean spacetime, where the metric depends on the spacetime coordinates and the Christoffel symbols are different from zero

  

evaluatetensor  : optional, true (default) or false, to evaluate the tensor after removing the spacetime functionality

  

Description

  

FromGeneralRelativityTensorFunctionalForm receives an expression A containing general relativity tensors with functionality and returns the same expression after removing the functionality of these tensors, followed by a set with the substitution equations used. This is useful when intermediate computations should take into account (or not) this functionality.

  

Examples

restart: with(Physics): with(Library):

  

Set the metric to be nongalilean, for example:

g_[sc];

_______________________________________________________

Systems of spacetime coordinates are:X=r&comma;θ&comma;φ&comma;t

Default differentiation variables for d_, D_ and dAlembertian are:X=r&comma;θ&comma;φ&comma;t

Setting lowercaselatin_is letters to represent space indices

The Schwarzschild metric in coordinates r&comma;θ&comma;φ&comma;t

Parameters: m

Signature: - - - +

_______________________________________________________

g_&mu;&comma;&nu;&equals;r2mr0000r20000r2sin&theta;20000r2mr

(77)

e1 := Riemann[alpha, beta, mu,nu](X) + g_[mu,nu](X);

e1Rα,β,μ,νX+gμ,νX

(78)

FromGeneralRelativityTensorFunctionalForm(e1);

Rα,β,μ,ν+gμ,ν,Rα,β,μ,νX=Rα,β,μ,ν&comma;gμ,νX=gμ,ν

(79)
  

See Also

  

FromTensorFunctionalForm, GetGeneralRelativityTensorFunctionalForm,  GetTensorFunctionalForm, GetTensorDependency, ToGeneralRelativityTensorFunctionalForm, ToTensorFunctionalForm, Physics[g_]

FromLabelToCoordinates

  

Calling Sequence

  

Physics:-Library:-FromLabelToCoordinates(X)

  

Parameters

  

X   : a capital Letter that is the label of a system of spacetime coordinates set using Coordinates or Setup

  

Description

  

FromLabelToCoordinates receives a capital letter that is the label of a system of spacetime coordinates previously set with Coordinates or Setup and returns the corresponding list of coordinates.

  

Examples

restart: with(Physics): with(Library):

Coordinates(X):

Systems of spacetime coordinates are:X=x1&comma;x2&comma;x3&comma;x4

(80)

ee := FromLabelToCoordinates(:-X);

eeX

(81)

map(``, [ee]);

x1&comma;x2&comma;x3&comma;x4

(82)
  

See Also

  

FromCoordinatesToLabel

FromMetricToLineElement

  

Calling Sequence

  

Physics:-Library:-FromMetricToLineElement(g_info := Physics:-GetSetupINFO(metric), X := Physics:-GetSetupINFO(differentiationvariables), dim := Physics:-GetSetupINFO(dimension), {used_: truefalse := false})

  

Parameters

  

g_info  : optional, the default value is the current spacetime metric as returned by Setup(differentiationvariables), it can also be any equivalent set of array elements

  

X       : optional, the default value is the list of the current differentiation variables as returned by Setup(differentiationvariables)

  

dim     : optional, the default value is the current dimension of the spacetime as returned by Setup(dimension)

  

used_   : optional, can be true or false (default), to represent the differential of the spacetime coordinates using d_, or just concatenating the symbol d with the coordinate

  

Description

  

FromMetricToLineElement computes the line element representation for the spacetime metric, an expression quadratic in the differentials of the spacetime coordinates, expressed by default concatenating the letter d with the coordinate, a visual representation, or applying d_ to the coordinate, a real mathematical representation that Physics understands with the correct meaning.

  

Examples

restart: with(Physics): with(Library):

Coordinates(X):

Systems of spacetime coordinates are:X=x1&comma;x2&comma;x3&comma;x4

(83)

FromMetricToLineElement();

dx12dx22dx32+dx42

(84)

FromMetricToLineElement(used_);

&DifferentialD;x12&DifferentialD;x22&DifferentialD;x32+&DifferentialD;x42

(85)
  

See Also

  

Physics:-g_

FromSpaceTimeVector

  

Calling Sequence

  

Physics:-Library:-FromSpaceTimeVector(ee)

  

Parameters

  

ee  : a mathematical expression possibly involving the SpaceTimeVector command of Physics

  

Description

  

FromSpaceTimeVector converts all occurrences of SpaceTimeVector[mu](X) into X[mu], where X is a sequence of spacetime coordinates.

  

Examples

restart: with(Physics): with(Library):

Coordinates(X):

Systems of spacetime coordinates are:X=x1&comma;x2&comma;x3&comma;x4

(86)

X_mu := FromSpaceTimeVector(SpaceTimeVector[mu](X));

X_muXμ

(87)

map(``, [op(0, X_mu)]);

x1&comma;x2&comma;x3&comma;x4

(88)
  

See Also

  

GetSpaceTimeVectors, ToSpaceTimeVector

FromTensorFunctionalForm

  

Calling Sequence

  

Physics:-Library:-FromTensorFunctionalForm(A,{evaluatetensor: truefalse := true}, $)

  

Parameters

  

A               : an algebraic expression involving tensors that have functional dependency, either because they were defined as such, or because it is one of the general relativity tensors and the spacetime is nongalilean, with the metric depending on the spacetime coordinates

  

evaluatetensor  : optional, true (default) or false, to evaluate the tensor after removing the spacetime functionality

  

Description

  

FromTensorFunctionalForm receives an expression A containing tensors with functionality - say T[i,j](x,y), and returns the same expression after removing the functionality of these tensors - say as in T[i,j] - followed by a set with the substitution equations used. This is useful when intermediate computations should take into account (or not) this functionality. In this sense, FromTensorFunctionalForm is a generalization of the Maple 17 FromGeneralRelativityTensorFunctionalForm command that also handles user defined tensor functions, and performs the reverse operation of ToTensorFunctionalForm.

  

Examples

restart: with(Physics): with(Library):

  

Define a system of coordinates and tensor depending on some variables.

Coordinates(X = Cartesian);

Systems of spacetime coordinates are:X=x&comma;y&comma;z&comma;t

X

(89)

Define(p[mu] = [m*v__1(t), m*v__2(t), m*v__3(t), p__0(t)]);

Defined objects with tensor properties

γμ&comma;σμ&comma;μ&comma;gμ,ν&comma;pμ&comma;εα,β,μ,ν&comma;Xμ

(90)
  

The system now knows about this dependency on t and m, so that the derivatives of pμ are not zero.

[p[mu], diff(p[mu], t), d_[nu](p[mu])];

pμ&comma;tpμ&comma;νpμ

(91)
  

Put and remove the functionality.

ToTensorFunctionalForm((91));

pμt&comma;m&comma;tpμt&comma;m&comma;νpμt&comma;m,pμ=pμt&comma;m

(92)

FromTensorFunctionalForm((92)[1]);

pμ&comma;tpμ&comma;νpμ,pμt&comma;m=pμ

(93)
  

Set the metric to be nongalilean, for example:

g_[sc];

_______________________________________________________

Systems of spacetime coordinates are:X=r&comma;θ&comma;φ&comma;t

Default differentiation variables for d_, D_ and dAlembertian are:X=r&comma;θ&comma;φ&comma;t

Setting lowercaselatin_is letters to represent space indices

The Schwarzschild metric in coordinates r&comma;θ&comma;φ&comma;t

Parameters: m

Signature: - - - +

_______________________________________________________

g_&mu;&comma;&nu;&equals;r2mr0000r20000r2sin&theta;20000r2mr

(94)

e1 := Riemann[alpha, beta, mu,nu](X) + g_[mu,nu](X);

e1Rα,β,μ,νX+gμ,νX

(95)

FromTensorFunctionalForm(e1);

Rα,β,μ,ν+gμ,ν,Rα,β,μ,νX=Rα,β,μ,ν&comma;gμ,νX=gμ,ν

(96)
  

See Also

  

FromGeneralRelativityTensorFunctionalForm, GetGeneralRelativityTensorFunctionalForm, GetTensorFunctionalForm, GetTensorDependency, ToGeneralRelativityTensorFunctionalForm, ToTensorFunctionalForm, Physics[g_]

FromTensorInternalRepresentation

  

Calling Sequence

  

Physics:-Library:-FromTensorInternalRepresentation(expr,{evaluatetensor: truefalse := true})

  

Parameters

  

expr             : a mathematical expression containing tensors in the Physics internal representation

  

evaluatetensor   : optional, it can be true (default) or false, to evaluate the tensors after having restored their natural (not internal) representation

  

Description

  

FromTensorInternalRepresentation replaces, in the given expression, all tensors expressed using the Physics internal representation by the same tensors expressed in the natural representation used at user level. The tensors being restored are evaluated before returning, so that they get normalized taking into account their symmetry properties. To override that evaluation use the option evaluatetensor = false.

  

Examples

restart: with(Physics): with(Library):

Coordinates(X):

Systems of spacetime coordinates are:X=x1&comma;x2&comma;x3&comma;x4

(97)

Define(A):

Defined objects with tensor properties

(98)

ir := ToTensorInternalRepresentation(d_[mu](A[nu](X)));

ir_tenop_dotidx1&comma;A_dotidx2X&comma;Xμ,ν,_tenop_dotidx1&comma;A_dotidx2X&comma;Xμ,ν

(99)

FromTensorInternalRepresentation(ir[2]);

μAνX

(100)
  

See Also

  

ToTensorInternalRepresentation

GetAlgebraRuleName

  

Calling Sequence

  

Physics:-Library:-GetAlgebraRuleName(A)

  

Parameters

  

A  : a mathematical object supposed to be part of the definition of an algebra rule of Commutators or AntiCommutators

  

Description

  

GetAlgebraRuleName applies a := GetNameWithIndices(A), and when a enters the internal representation of an algebra rule of Commutators or AntiCommutators, returns a Otherwise, if a is indexed it returns op(0, a). This command is used inside Commutator and AntiCommutator when computing, in order to determine whether an algebra rule already exists for the objects being manipulated.

  

Examples

restart: with(Physics): with(Library):

Define(A, B):

Defined objects with tensor properties

(101)

Setup('Commutator(A[mu], B[nu])' = KroneckerDelta[mu,nu]);

Warning, since Maple 2019 KroneckerDelta is not implemented as a tensor unless the indices are of type <spinor, su2, su3 or gauge>indices, not space or spacetime. Thus, the right-hand side of the algebra rule `?`=δμ,ν has for free tensor indices , while the left-hand side has μ&comma;ν, of which μ&comma;ν appear in δμ,ν. To resolve this problem you can: 1. If the dimension of the tensor indices on the left-hand side is 3, then use su2indices that you can define via Setupsu2indices=greek. 2. Use the spacetime metric g_, or the space metric gamma_, instead of KroneckerDelta. If so, check the value of: Setupsignature. 3. Enter: macroKroneckerDelta=g_; or use gamma_ instead of g_. 4. Define a Kronecker δ tensor. In the following, type 'delta' on the left and 'KroneckerDelta' on the right, or copy and paste: Defineδα,β=Matrix4&comma;4&comma;j&comma;kδj,k. After any of the above it is recommended that you set this algebra rule again, with the corrected right-hand side, to avoid problems due to having different free indices on each side of the rule.

algebrarules&equals;%CommutatorA&mu;&comma;B&nu;&equals;KroneckerDelta&mu;&comma;&nu;

(102)

GetAlgebraRuleName(A[mu]);

A

(103)
  

See Also

  

GetAlgebraRules, Physics[Setup]

GetAlgebraRules

  

Calling Sequence

  

Physics:-Library:-GetAlgebraRules(A, B, {cackind:list(identical(Physics:-Commutator, Physics:-AntiCommutator)) := [Physics:-Commutator, Physics:-AntiCommutator]})

  

Parameters

  

A, B     : two mathematical objects supposed to be related to the operands of a previous definition of an algebra rule of a Commutator or an AntiCommutator

  

cackind  : optional, a list with either or both of Commutator and AntiCommutator, to search in the corresponding tables of previously defined algebra rules

  

Description

  

GetAlgebraRules checks the internal tables for algebra rules of Commutators or AntiCommutators set using Setup, that are related to the objects A and B given. The output consists of a sequence of two lists, each containing lists of two elements, respectively defining Commutator and AntiCommutator algebra rules.

  

Examples

restart: with(Physics): with(Library):

Define(A, B):

Defined objects with tensor properties

(104)

Setup('Commutator(A[mu], B[nu])' = KroneckerDelta[mu,nu]);

Warning, since Maple 2019 KroneckerDelta is not implemented as a tensor unless the indices are of type <spinor, su2, su3 or gauge>indices, not space or spacetime. Thus, the right-hand side of the algebra rule `?`=δμ,ν has for free tensor indices , while the left-hand side has μ&comma;ν, of which μ&comma;ν appear in δμ,ν. To resolve this problem you can: 1. If the dimension of the tensor indices on the left-hand side is 3, then use su2indices that you can define via Setupsu2indices=greek. 2. Use the spacetime metric g_, or the space metric gamma_, instead of KroneckerDelta. If so, check the value of: Setupsignature. 3. Enter: macroKroneckerDelta=g_; or use gamma_ instead of g_. 4. Define a Kronecker δ tensor. In the following, type 'delta' on the left and 'KroneckerDelta' on the right, or copy and paste: Defineδα,β=Matrix4&comma;4&comma;j&comma;kδj,k. After any of the above it is recommended that you set this algebra rule again, with the corrected right-hand side, to avoid problems due to having different free indices on each side of the rule.

algebrarules&equals;%CommutatorA&mu;&comma;B&nu;&equals;KroneckerDelta&mu;&comma;&nu;

(105)

GetAlgebraRules(A[mu], B[nu]);

A&comma;B,

(106)
  

See Also

  

GetAlgebraRuleName

GetAntiCommutativeSymbol

  

Calling Sequence

  

Physics:-Library:-GetAntiCommutativeSymbol(x,n := 1)

  

Parameters

  

x  : any Maple object such that the anticommutative symbols returned are not already contained in x

  

n  : optional, default value is 1, indicates how many anticommutative symbols are to be returned

  

Description

  

GetAntiCommutativeSymbol returns anticommutative symbols (variables of type symbol) taking into account the anticommutative prefix of the moment, set using Setup(anticommutativeprefix). By default it returns 1 symbol; optionally returning as many as the number n passed as second argument. These symbol variables are not found in x, are not assigned, have no attributes previously set, are not local variables and are not visually identical to any local variables found in x; they are also not visually equivalent to the variables used during calls to assuming. This commands is thus a convenient way of getting variables of this type for internal computations within subroutines, that at the same time do not collide with the global variables already present in the computation. If no anticommutative prefix is defined then _Q_ is used as prefix.

  

Examples

restart: with(Physics): with(Library):

GetAntiCommutativeSymbol(x);

Physics_Q_1

(107)

type(_lambda1, anticommutative);

false

(108)

GetAntiCommutativeSymbol([_lambda5], 2);

Physics_Q_1,Physics_Q_2

(109)
  

See Also

  

GetCommutativeSymbol, GetNonCommutativeSymbol

GetBasisContinuityInfo

  

Calling Sequence

  

Physics:-Library:-GetBasisContinuityInfo(A)

  

Parameters

  

A    : a Bra, Ket, or a name

  

Description

  

GetBasisContinuityInfo receives a Bra, a Ket, or a name, and returns the name itself (or, the first argument of the Bra or the Ket) when this name was previously set as a label for quantum continuous basis using Setup(quantumcontinuousbasis = {...}), indicating that indeed the input A is related to a quantum continuous basis. If A is not related to any quantum continuous basis already set, the GetBasisContinuityInfo returns the string "unknown".

  

Examples

restart: with(Physics): with(Library):

Setup(quantumcontinuousbasis = A);

quantumcontinuousbasis=A

(110)

GetBasisContinuityInfo(A);

A

(111)

GetBasisContinuityInfo(B);

unknown

(112)

GetBasisContinuityInfo(Bra(A));

A

(113)
  

See Also

  

GetBasisDimension, Physics[Setup]

GetBasisDimension

  

Calling Sequence

  

Physics:-Library:-GetBasisDimension(A)

  

Parameters

  

A    : a Bra, Ket, or a name

  

Description

  

GetBasisDimension receives a Bra, a Ket, or a name, and returns an equation with the name itself (or, the first argument of the Bra or the Ket) in the left-hand side and the dimension of the basis of quantum states in the right-hand side, when this name in the left-hand side was previously set as a label for quantum basis of some dimension n using Setup(quantumbasisdimension = {A = n, ...}). If A is not related to any quantum continuous basis with dimension already set, the command returns the string "unknown".

  

Examples

restart: with(Physics): with(Library):

Setup(quantumbasisdimension = {A = 2});

quantumbasisdimension=A=2

(114)

GetBasisDimension(A);

A=2

(115)

GetBasisDimension(B);

unknown

(116)

GetBasisDimension(Bra(A));

A=2

(117)
  

See Also

  

GetBasisContinuityInfo, Physics[Setup]

GetCommutativeSymbol

  

Calling Sequence

  

Physics:-Library:-GetCommutativeSymbol(x, n := 1)

  

Parameters

  

x  : any Maple object such that the commutative symbols returned are not already contained in x

  

n  : optional, default value is 1, indicates how many commutative symbols are to be returned

  

Description

  

GetAntiCommutativeSymbol returns commutative symbols (variables of type symbol) that start with a capital letter, and taking into account the anticommutative and noncommutative prefixes of the moment, set using Setup(anticommutativeprefix) and Setup(noncommutativeprefix). By default, it returns 1; optionally returning as many as the number n passed as second argument. These symbol variables are not found in x, are not assigned, have no attributes that are previously set, are not local variables, and are not visually identical to any local variables found in x; they are also not visually equivalent to the variables used during calls to assuming. This command is thus a convenient way of getting variables of this type for internal computations within subroutines, which at the same time do not collide with the global variables already present in the computation.

  

Examples

restart: with(Physics): with(Library):

Setup(noncommutativeprefix = Z, anticommutativeprefix = theta);

anticommutativeprefix=θ&comma;noncommutativeprefix=Z

(118)

GetCommutativeSymbol(x);

F1

(119)

GetCommutativeSymbol([F5]);

F6

(120)

Setup(additionally, noncommutativeprefix = F);

noncommutativeprefix=F&comma;Z

(121)

GetCommutativeSymbol(x);

A1

(122)
  

See Also

  

GetAntiCommutativeSymbol, GetNonCommutativeSymbol

GetCoordinateSystem

  

Calling Sequence

  

Physics:-Library:-GetCoordinateSystem(`[X]`)

  

Parameters

  

`[X]`   : a list of spacetime coordinates of a system of coordinates previously defined with Setup(coordinatesystems = X) or with Coordinates

  

Description

  

GetCoordinateSystem searches among the previously defined systems of coordinates to find one that has the same coordinates found in `[X]`, not necessarily with the same ordering. If it finds only one of such a system, it returns it, otherwise it returns FAIL.

  

Examples

restart: with(Physics): with(Library):

Coordinates(Y = spherical);

Systems of spacetime coordinates are:Y=r&comma;θ&comma;φ&comma;t

Y

(123)

GetCoordinateSystem([theta,phi,r,t]);

Y

(124)
  

See Also

  

CoordinatesINFO, GetCoordinatesAlias

GetCoordinatesAlias

  

Calling Sequence

  

Physics:-Library:-GetCoordinatesAlias(x)

  

Parameters

  

x : any variable of a system of spacetime coordinates previously set using Setup.

  

Description

  

GetCoordinatesAlias receives a coordinate and searches the previously defined systems of spacetime coordinates for a system containing that coordinate. If it finds none, it returns the empty set, {}, Otherwise, the set contains equations, where the left-hand side contains the sequence of coordinates (one of which is the given x), and the right-hand side is the label for this system used in an alias definition to refer to it.

  

Examples

restart: with(Physics): with(Library):

Coordinates(Y = spherical);

Systems of spacetime coordinates are:Y=r&comma;θ&comma;φ&comma;t

Y

(125)

GetCoordinatesAlias(phi);

Y=Y

(126)
  

See Also

  

CoordinatesINFO, GetCoordinateSystem

GetDefineINFO

  

Calling Sequence

  

Physics:-Library:-GetDefineINFO(keyword)

  

Parameters

  

keyword : a string, one of the indices of the table of information Define:-INFO; that is, one of the strings returned by indices(Define:-INFO)

  

...     : other keywords

  

Description

  

GetDefineINFO(keyword, ...) gets the value of Define:-INFO[keyword, ...] without fully evaluating it, so as in eval(Define:-INFO[keyword, ...], 1). To see all the possible values of keyword, enter indices(Define:-INFO).

  

Examples

restart: with(Physics): with(Library):

indices(Define:-INFO);

properties&comma;%WFieldStrength,cannotbeerased,tetradnullvectors,properties&comma;Γ,properties&comma;δ,properties&comma;Κ,properties&comma;𝔹,properties&comma;%GluonFieldStrength,properties&comma;%gamma_,properties&comma;R,tensors_in_internal_representation,properties&comma;%EnergyMomentum,properties&comma;%Weyl,properties&comma;γ,default_indices_used,properties&comma;noncommutative,properties&comma;%BFieldStrength,properties&comma;antisymmetric,properties&comma;%e_,properties&comma;%Einstein,defined_%PhysicsTensors,properties&comma;R,%PhysicsTensors,properties&comma;symmetric,threeplusonetensors,properties&comma;Γ,GeneralRelativityTensors,typeoftensorindices,minimizetensorcomponents,default_indices_used&comma;spaceindices,PhysicsTensors,properties&comma;𝔢,properties&comma;𝕎,properties&comma;γ,properties&comma;λ,properties&comma;𝕎,properties&comma;γ,properties&comma;Τ,properties&comma;%WPlusFieldStrength,properties&comma;%Ricci,properties&comma;𝔽,functionality,PhysicsTensorNames,properties&comma;Christoffel,properties&comma;,feynmandiagramstensors,default_indices_used&comma;su3matrixindices,properties&comma;%Riemann,default_indices_used&comma;su2indices,properties&comma;G,properties&comma;f__su3,properties&comma;R,properties&comma;g,history,properties&comma;η,structure,linear_scalar_operators,properties&comma;%ZFieldStrength,names,default_indices_used&comma;su2matrixindices,properties&comma;%ElectromagneticFieldStrength,standardmodeltensors,properties&comma;C,linear_tensor_operators,properties&comma;R,default_indices_used&comma;su3indices,properties&comma;𝕎+,properties&comma;%WMinusFieldStrength,defined,properties&comma;%KroneckerDelta,properties&comma;%eta_,flipcharacterofindices,properties&comma;%g_,indices,properties&comma;%FSU3,tetradtensors,properties&comma;𝔾,properties&comma;%lambda_

(127)

GetDefineINFO("GeneralRelativityTensors");

%Lapse&comma;%Ricci&comma;%Ricci3&comma;%Shift&comma;%Weyl&comma;%e_&comma;%gamma_&comma;%l_&comma;%m_&comma;%mb_&comma;%n_&comma;α&comma;R&comma;R&comma;R&comma;β&comma;C&comma;𝔢&comma;γ&comma;γ&comma;l&comma;λ&comma;m&comma;m&conjugate0;&comma;n&comma;%Christoffel&comma;%Christoffel3&comma;%Einstein&comma;%Riemann&comma;%Riemann3&comma;%TimeVector&comma;%gamma3_&comma;%lambda_&comma;Γ&comma;Γ&comma;G&comma;R&comma;t&comma;%ExtrinsicCurvature&comma;%UnitNormalVector&comma;Κ&comma;n

(128)
  

See Also

  

GetSetupINFO

GetDimensionOfIndex

  

Calling Sequence

  

Physics:-Library:-GetDimensionOfIndex(idx)

  

Parameters

  

idx : an index, of space, spacetime, spinor, or gauge kind

  

Description

  

GetDimensionOfIndex gets the current dimension for the index idx as set using Setup. If idx is not an index of those kinds, GetDimensionOfIndex returns FAIL.

  

Examples

restart: with(Physics): with(Library):

GetDimensionOfIndex(mu);

4

(129)

GetDimensionOfIndex(j);

FAIL

(130)

Setup(spaceindices = lowercaselatin);

spaceindices=lowercaselatin

(131)

GetDimensionOfIndex(j);

3

(132)

Setup(dimension = 3);

Warning, unable to define the Pauli sigma matrices (Psigma) as a tensor in a spacetime with dimension = 3 where the metric is not Euclidean. You can still refer to the Pauli matrices using Psigmax, Psigmay and Psigmaz

The dimension and signature of the tensor space are set to 3&comma;- - +

dimension=3

(133)

GetDimensionOfIndex(mu);

3

(134)

GetDimensionOfIndex(j);

2

(135)
  

See Also

  

GetDimensionOfTypeOfIndex, GetDimensionRange

GetDimensionOfTypeOfIndex

  

Calling Sequence

  

Physics:-Library:-GetDimensionOfTypeOfIndex(t_idx, j := not given)

  

Parameters

  

t_idx : a type of index, one of spacetimeindex, spaceindex, tetradindex, spinorindex, genericindex, su2index, su3index, su2matrixindex, su3matrixindex.

  

Description

  

GetDimensionOfTypeOfIndex returns the dimension of the type of index t_idx. If this dimension is not defined, or if the type of index is not previously set using Setup, the command returns FAIL.

  

Examples

restart: with(Physics): with(Library):

GetDimensionOfTypeOfIndex(spacetimeindex);

4

(136)

GetDimensionOfTypeOfIndex(spaceindex);

3

(137)
  

See Also

  

GetDimensionOfIndex, GetDimensionRange

GetDimensionRange

  

Calling Sequence

  

Physics:-Library:-GetDimensionRange(dim, continuous_basis, U)

  

Parameters

  

dim              : an integer or an algebraic expression, or a range of them

  

continuous_basis : true or false

  

U                : a label of a basis of quantum states, possibly anticommutative (fermionic states)

  

Description

  

GetDimensionRange returns a range to be used as a dimension range for the label U of quantum states. When dim is not a range, if continuous_basis = true, this dimension is the range dim..dim, otherwise, if U is anticommutative, the range from 0 to 1, else from 0 to dim-1. When dim is a range, if continuous_basis = false and the first operand of the range dim is half