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,EuclideanTensor,ExpandableProduct,ExtendedBra,ExtendedDifferentialOperator,ExtendedDifferentialOperatorIndexed,ExtendedDifferentialOperatorSymbol,ExtendedKet,ExtendedMatrix,ExtendedMatrixRequiringEval,ExtendedPhysicsMatrix,ExtendedProjector,ExtendedProjectorKind,ExtendedQuantumOperator,ExtendedTensor,ExtendedVectorDifferentialOperator,FermionAnnihilationCreationOperator,FermionAnnihilationOperator,FermionCreationOperator,FullyCommutative,HalfInteger,HermitianOperator,IdentityMatrix,InertSymbol,Ket,LeviCivitaNonGalilean,LeviCivitaTensor,LinearOperatorFunction,LiteralSubscript,NegativePower,NonCommutativeProduct,NonTensorFunction,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,SpaceNumericalIndex,SpaceTimeVectorApplied,SpacetimeNumericalIndex,Spinor,SpinorWithoutIndices,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);

1i+jnfi,j

(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+b+cn=p+q+r=nn!apbqcr1p!q!r!

(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);

k=1fgk

(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));

,A

(20)
  

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

expand((20));

AA

(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));

Axi+Ayj+AzkA

(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 μ and Aν multiplied by Bα, representing the application of μ can now be represented as

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

μ,AνBα

(26)

expand((26));

μAνBαAνμBα

(27)
  

Note that to the right of μ 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));

μAνBα

(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=x,y=0&comma;x,z=0&comma;y,z=0&comma;differentialoperators=p&comma;x&comma;y&comma;z&comma;hermitianoperators=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);

F,pψx&comma;y&comma;z

(31)
  

Note that p, FX and the ket ψ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));

F,pψx&comma;y&comma;z=Fpψx&comma;y&comma;zpFψx&comma;y&comma;z

(32)

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

F,pψx&comma;y&comma;z=Fpψx&comma;y&comma;zpFψ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=A,B=C&comma;A,C=0&comma;B,C=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=A,B=C&comma;A,C=0&comma;B,C=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));

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

(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μ,ν=

(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;p.μ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μ,ν=

(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 Aμ,Bν=δμ,ν 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=Aμ,Bν=δμ,ν

(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 Aμ,Bν=δμ,ν 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=Aμ,Bν=δμ,ν

(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);

_Q_1

(107)

type(_lambda1, anticommutative);

false

(108)

GetAntiCommutativeSymbol([_lambda5], 2);

_Q_1,_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);

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

(127)

GetDefineINFO("GeneralRelativityTensors");

Lapse&comma;R&comma;Ricci3&comma;Shift&comma;C&comma;e_&comma;γ&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;Γ&comma;Christoffel3&comma;G&comma;R&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-integer, the range is from 0 to the second operand of dim minus that half integer, otherwise, the range is dim itself.

  

Examples

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

GetDimensionRange(2, true, U);

−2..2

(138)

GetDimensionRange(2, false, U);

0..1

(139)

Setup(anticommutativepre = Q, quiet):

GetDimensionRange(2, true, Q);

−2..2

(140)

GetDimensionRange(2, false, Q);

0..1

(141)

GetDimensionRange(1/2, true, Q);

12..12

(142)

GetDimensionRange(3/2, true, Q);

32..32

(143)

GetDimensionRange(1/2, false, Q);

0..12

(144)

GetDimensionRange(3/2, false, Q);

0..1

(145)
  

See Also

  

GetDimensionOfIndex, GetDimensionOfTypeOfIndex

GetExistingAnnihilationCreationOperator

  

Calling Sequence

  

Physics:-Library:-GetExistingAnnihilationCreationOperator(notation, fingerprint)

  

Parameters

  

notation    : one of implicit, explicit, or anything

  

fingerprint : a list with an annihilation or creation internal Physics fingerprint; that is, a list with four elements, for example, as in ["annihilation", "label" = psi, "quantum_numbers" = [1, 2, 3], "boson"]

  

Description

  

GetExistingAnnihilationCreationOperator searches, among the annihilation and creation operators already set with Annihilation and Creation, for one that has the given fingerprint and got defined with the given notation.

  

Examples

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

am := Annihilation(A);

ama

(146)

fingerprint := [attributes(am)];

fingerprintannihilation&comma;label=A&comma;quantum_numbers=1&comma;boson

(147)

GetExistingAnnihilationCreationOperator(anything, fingerprint);

a

(148)

evalb(% = am);

true

(149)
  

See Also

  

GetFingerprint

GetFingerprint

  

Calling Sequence

  

Physics:-Library:-GetFingerprint(a)

  

Parameters

  

a : an annihilation or creation operator set with Annihilation or Creation

  

Description

  

If a is an annihilation or creation operator set with Annihilation or Creation, then GetFingerprint returns its fingerprint. The fingerprint is an attribute of these operators so it can also be retrieved with the attributes command.

  

Examples

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

am := Annihilation(A);

ama

(150)

ap := Creation(A);

apa+

(151)

GetFingerprint(am);

annihilation,label=A,quantum_numbers=1,boson

(152)

GetFingerprint(ap);

creation,label=A,quantum_numbers=1,boson

(153)

attributes(ap);

creation,label=A,quantum_numbers=1,boson

(154)
  

See Also

  

GetExistingAnnihilationCreationOperator

GetGeneralRelativityTensorFunctionalForm

  

Calling Sequence

  

Physics:-Library:-GetGeneralRelativityTensorFunctionalForm(T)

  

Parameters

  

T : a general relativity tensor, a member of GetDefineINFO("GeneralRelativityTensorsWithDependency")

  

Description

  

when T is a tensor whose name (its 0th operand) is a member of GetDefineINFO("GeneralRelativityTensors"), GetGeneralRelativityTensorFunctionalForm returns an equation of the form T = T(Q) where Q is the spacetime metric's dependency as indicated by GetSetupINFO("spacetimemetricdependency"). Otherwise, T = T is returned.

  

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μ,ν=

(155)

GetSetupINFO("GeneralRelativityTensorsWithDependency");

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

(156)

GetSetupINFO("spacetimemetricdependency");

r&comma;θ&comma;m

(157)

GetGeneralRelativityTensorFunctionalForm(Einstein[mu, nu]);

Gμ,ν=Gμ,νr&comma;θ&comma;m

(158)

GetGeneralRelativityTensorFunctionalForm(%g_[mu, nu]);

gμ,ν=gμ,νr&comma;θ&comma;m

(159)
  

See Also

  

FromGeneralRelativityTensorFunctionalForm, ToGeneralRelativityTensorFunctionalForm, Physics[g_]

GetFAndDifferentiationVariables

  

Calling Sequence

  

Physics:-Library:-GetFAndDifferentiationVariables(df)

  

Parameters

  

df : a derivative expressed using :-diff, :-Diff, :-%diff or Physics:-diff

  

Description

  

GetFAndDifferentiationVariables receives a derivative and returns a sequence with derivand and all the differentiation variables.

  

Examples

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

GetFAndDifferentiationVariables(diff(f(x,y,z), x,x, y,y,y, z));

fx&comma;y&comma;z,x,x,y,y,y,z

(160)
  

See Also

  

diff, Physics[diff]

GetIndicesAndCharacter

  

Calling Sequence

  

Physics:-Library:-GetIndicesAndCharacter(idxs, T)

  

Parameters

  

idxs : a list of spacetime, space, tetrad, spinor, generic, su2, su3, su2matrix or su3matrix indices

  

T    :

  

Description

  

GetIndicesAndCharacter receives a list of indices idxs and the name T of the tensor, and returns a sequence of two lists- the first one with the indices themselves but all covariant (so stripping ~ prefixes), and the second one with the same name of operands, consisting of the keywords covariant or contravariant according to the character of the indices in idxs.

  

Examples

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

GetIndicesAndCharacter([alpha, beta], Ricci);

α&comma;β,covariant&comma;covariant

(161)

GetIndicesAndCharacter([alpha, ~beta], g_);

α&comma;β,covariant&comma;contravariant

(162)

GetIndicesAndCharacter([~1, ~2], g_);

1&comma;2,contravariant&comma;contravariant

(163)
  

See Also

  

GetIndicesInUse, GetIndicesOfType, GetNameIndicesVariables, GetTensorIndices

GetIndicesInUse

  

Calling Sequence

  

Physics:-Library:-GetIndicesInUse()

  

Parameters

  

: no parameters

  

Description

  

GetIndicesInUse receives arguments (any) and returns a set with all the indices in indexed objects or in indexed functions found in these arguments, union with the indices found in the environment variable _Env_Physics_indices_in_use. This routine is useful when dummy contracted indices are to be introduced, and when they cannot be indices that are already present in the expression or are already reserved by assigning them to _Env_Physics_indices_in_use.

  

Examples

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

expression := g_[alpha, ~beta] * %d_[mu](F[nu](x));

expressionδαβαβμFνx

(164)

GetIndicesInUse(expression);

α,β,μ,ν

(165)

_Env_Physics_indices_in_use := kappa, rho:

GetIndicesInUse(expression);

α,β,κ,μ,ν,ρ

(166)
  

See Also

  

GetIndicesAndCharacter, GetIndicesOfType, GetNameIndicesVariables, GetReplacementIndices, GetTensorIndices

GetIndicesOfType

  

Calling Sequence

  

Physics:-Library:-GetIndicesOfType(kind::identical(spacetimeindex, spaceindex, tetradindex, spinorindex, genericindex, su2index, su3index, su2matrixindex, su3matrixindex), not_in_ee, N::nonnegint := 1, {character::(identical(Covariant, Contravariant)) := Covariant}, $)

  

Parameters

  

kind      :  the kind of indices being requested, any of spacetimeindex, spaceindex, tetradindex, spinorindex, genericindex, su2index, su3index, su2matrixindex, su3matrixindex

  

not_in_ee : any Maple object, typically an expression, equation or a list or set of them - the requested indices must not be present in this second argument

  

n         : optional, default value is 1, indicates the number of indices desired

  

character = ...  : optional, the right-hand side can be Covariant (default) or Contravariant, indicating the character of the indices to be returned

  

Description

  

GetIndicesOfType returns indices of the indicated type (kind), according to the kind of letter set in Setup for the kind of indices requested, that are not found in not_in_ee or in _Env_Physics_indices_in_use, and that are not assigned, not attributed, not aliased, or not macroed. The returned indices are covariant by default. To request them to be contravariant, pass the optional argument character = Contravariant. These returned indices can be used when constructing output, for instance, introducing contracted products of tensors without colliding with indices of the expression. If the type of index has not been associated with a kind of letter using Setup, an error message alerting that is displayed. To

  

Examples

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

Setup(spaceindices=lowercaselatin_is);

spaceindices=lowercaselatin_is

(167)

GetIndicesOfType(spacetimeindex, []);

μ

(168)

GetIndicesOfType(spacetimeindex, [], character = Contravariant);

~&mu;

(169)

GetIndicesOfType(spaceindex, [], 3);

i,j,k

(170)

i := 5:

GetIndicesOfType(spaceindex, [a * j + c], 3);

k,l,m

(171)

_Env_Physics_indices_in_use := m;

_Env_Physics_indices_in_usem

(172)

GetIndicesOfType(spaceindex, [a * j + c], 3, character = Contravariant);

~k,~l,~n

(173)
  

See Also

  

GetIndicesAndCharacter, GetIndicesInUse, GetNameIndicesVariables, GetReplacementIndices, GetTensorIndices, GetTypeOfIndex

GetNameIndicesVariables

  

Calling Sequence

  

Physics:-Library:-GetNameIndicesVariables(A)

  

Parameters

  

A : a symbol variable as in A or an indexed one, a function or an indexed function as in A[mu](x, y ,z); it can also be a power, conjugate, or Dagger of such an object, or a tensor in the Physics internal representation (see ToTensorInternalRepresentation)

  

Description

  

GetNameIndicesVariables returns a sequence of four operands - say for F[mu, nu](x, y, z) that sequence would be F, F[mu, nu], [mu, nu], [x, y, z]. When the object is just indexed, no functionality, the last list is empty, as in []. When the name of the object has no indices, the third list is empty, and the first and second elements are equal. When A is a power, the commands applies to the first operand of A. If A is a conjugate or Dagger function, it works like when it is a power, but the first element returned is conjugate or Dagger applied to the name of the object. If A is a tensor in the Physics internal representation, first the natural (user) representation is restored, then GetNameIndicesVariables is applied to that result.

  

Examples

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

GetNameIndicesVariables(A);

A,A,,

(174)

GetNameIndicesVariables(A[mu]);

A,Aμ,μ,

(175)

GetNameIndicesVariables(A(x,y));

A,A,,x&comma;y

(176)

GetNameIndicesVariables(A[mu](x,y));

A,Aμ,μ,x&comma;y

(177)

GetNameIndicesVariables(A[mu](x,y)^n);

A,Aμ,μ,x&comma;y

(178)

GetNameIndicesVariables('Dagger'(A[mu](x,y)));

A,Aμ,μ,x&comma;y

(179)
  

See Also

  

GetIndicesAndCharacter, GetIndicesInUse, GetIndicesOfType, GetTensorIndices

GetNameWithIndices

  

Calling Sequence

  

Physics:-Library:-GetNameWithIndices(T)

  

Parameters

  

T : a function, possibly indexed, or a Dagger or conjugate of it.

  

Description

  

GetNameWithIndices returns the name of the function call along with its indices, if any. When this function is itself a Dagger or conjugate of another function, the functionality is stripped from that function, and the Dagger or conjugate applied to the result is returned. This routine is useful to expose the indices of a nested expression while getting its name.

  

Examples

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

GetNameWithIndices(A);

A

(180)

GetNameWithIndices(A[mu](x,y,z));

Aμ

(181)

GetNameWithIndices('Dagger(A[mu](x,y,z))');

Aμ

(182)
  

See Also

  

GetNameWithoutIndices

GetNameWithoutIndices

  

Calling Sequence

  

Physics:-Library:-GetNameWithoutIndices(T)

  

Parameters

  

T : a function, possibly indexed, or a Dagger or conjugate of it.

  

Description

  

GetNameWithoutIndices returns the same as GetNameWithIndices but without the indices. See GetNameWithIndices.

  

Examples

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

GetNameWithoutIndices(A);

A

(183)

GetNameWithoutIndices(A[mu](x,y,z));

A

(184)

GetNameWithoutIndices('Dagger(A[mu](x,y,z))');

A

(185)
  

See Also

  

GetNameWithIndices

GetNonCommutativeSymbol

  

Calling Sequence

  

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

  

Parameters

  

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

  

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

  

Description

  

GetNonCommutativeSymbol returns noncommutative symbols (variables of type symbol), taking into account the noncommutative prefix of the moment set using Setup(anticommutativeprefix). By default, it returns 1; optionally returning as many as the number n which is passed as the second argument. These symbol variables are not found in x, are not assigned, have no attributes that were 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, which at the same time do not collide with the global variables already present in the computation. If no noncommutative prefix is defined then Physics:-_Z_ is used as prefix and the variables are returned indexed, such as _Z_[1], and so on.

  

Examples

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

GetNonCommutativeSymbol(x);

_Z_1

(186)

type(_Z[1], noncommutative);

false

(187)

Setup(noncommutativeprefix = Z);

noncommutativeprefix=Z

(188)

GetNonCommutativeSymbol(x);

Z1

(189)

GetNonCommutativeSymbol([Z4]);

Z5

(190)
  

See Also

  

GetAntiCommutativeSymbol, GetCommutativeSymbol

GetNotCommutativeNamesAndFunctions

  

Calling Sequence

  

Physics:-Library:-GetNotCommutativeNamesAndFunctions(ee, {ignorewithinfunctions::truefalse := false, onlyanticommutative::truefalse := false})

  

Parameters

  

ee                    : any Maple object, typically an algebraic expression

  

ignorewithinfunctions : optional, to disregard not commutative names and functions found only within functions

  

onlyanticommutative   : optional, to disregard noncommutative objects and only return anticommutative ones

  

Description

  

GetNotCommutativeNamesAndFunctions returns the not commutative (that is, of types noncommutative or anticommutative) names and functions found in ee, optionally disregarding names and functions found only within functions, and optionally returning only the objects of type anticommutative, disregarding those of type noncommutative.

  

Examples

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

Setup(quantumoperators = {A,B}, anticommutativeprefix = Q);

anticommutativeprefix=Q&comma;quantumoperators=A&comma;B

(191)

ee := A(x) + F(B(x)) + Q1 + H(Q2);

eeAx+FBx+Q1+HQ2

(192)

GetNotCommutativeNamesAndFunctions(ee);

A&comma;B&comma;Q1&comma;Q2&comma;Ax&comma;Bx&comma;FBx

(193)

GetNotCommutativeNamesAndFunctions(ee, ignorewithinfunctions);

A&comma;Q1&comma;Ax

(194)
  

See Also

  

GetNameIndicesVariables

GetProjectorCore

  

Calling Sequence

  

Physics:-Library:-GetProjectorCore(P::Physics:-Projector)

  

Parameters

  

P : a projector, of type Library:-PhysicsType:-Projector

  

Description

  

GetProjectorCore receives a projector P and returns a sequence of four elements. The first element is the projector's core. For example, if P is a sum (perhaps a multiple sum), then its core is the inner-most summand, or if P is an integral, then its core is the inner-most integrand. The second element is a list with the number 1 repeated as many times as the nesting level, so if it is not a multiple sum this list is [1]. The third element is a list with the dummies of the sum or integral, that is, with as many dummies as the nesting level. The fourth element is also a list with the summation or integration ranges representing the dimension (possibly multi-dimension) of the projector.

  

Examples

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

P := Sum(Ket(A, n)*Bra(A, n), n = 0 .. 2);

Pn=02AnAn

(195)

GetProjectorCore(P);

AnAn,1,n,0..2

(196)

P := Int(Int(Int(Ket(R, x, y, z)*Bra(R, x, y, z), x = -infinity .. infinity), y = -infinity .. infinity), z = -infinity .. infinity);

PRx&comma;y&comma;zRx&comma;y&comma;z&DifferentialD;x&DifferentialD;y&DifferentialD;z

(197)

GetProjectorCore(P);

Rx&comma;y&comma;zRx&comma;y&comma;z,1&comma;1&comma;1,z&comma;y&comma;x,..&comma;..&comma;..

(198)
  

See Also

  

GetSumIntCore

GetReplacementIndices

  

Calling Sequence

  

Physics:-Library:-GetReplacementIndices(idx_to_be_replaced::Or(list, set))

  

Parameters

  

idx_to_be_replaced :  a list of indices to be replaced; these could be sspacetime, space, tetrad, spinor, generic, su2, su3, su2matrix or su3matrix indices

  

Description

  

GetReplacementIndices returns a sequence of two objects L, S, where L is a list of four lists, each one containing equations with replacements of the indices of spacetime, space, spinor, and gauge types found in idx_to_be_replaced, and S is a set containing all the indices in use as found in the environment variable _Env_Physics_indices_in_use if any, including the new indices introduced as replacements. All the replacement indices returned are also not found in any additional arguments passed to GetReplacementIndices or in the environment variable _Env_Physics_indices_in_use, and the lists returned include equations for both covariant and contravariant indices.

  

Examples

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

Setup(spaceindices=lowercaselatin_is, spinorindices = lowercaselatin_ah, genericindices = uppercaselatin);

genericindices=uppercaselatin&comma;spaceindices=lowercaselatin_is&comma;spinorindices=lowercaselatin_ah

(199)

GetReplacementIndices([mu, a, i, B]);

μ=ν&comma;~&mu;=~&nu;&comma;i=j&comma;~i=~j&comma;a=b&comma;~a=~b&comma;B=A&comma;~B=~A,A&comma;b&comma;j&comma;ν

(200)
  

Get replacement indices that are not j, b or A

GetReplacementIndices([mu, a, i, B], [j, b, A]);

μ=ν&comma;~&mu;=~&nu;&comma;i=k&comma;~i=~k&comma;a=c&comma;~a=~c&comma;B=C&comma;~B=~C,C&comma;c&comma;k&comma;ν

(201)
  

Assigning a set of indices to _Env_Physics_indices_in_use makes GetReplacementIndices to not return those indices

_Env_Physics_indices_in_use := {j, b, A, k, C};

_Env_Physics_indices_in_useA&comma;C&comma;b&comma;j&comma;k

(202)

GetReplacementIndices([mu, a, i, B]);

μ=ν&comma;~&mu;=~&nu;&comma;i=l&comma;~i=~l&comma;a=c&comma;~a=~c&comma;B=E&comma;~B=~E,A&comma;C&comma;E&comma;b&comma;c&comma;j&comma;k&comma;l&comma;ν

(203)
  

See Also

  

GetIndicesAndCharacter, GetIndicesInUse, GetNameIndicesVariables, GetTensorIndices, GetTypeOfIndex

GetSetupINFO

  

Calling Sequence

  

Physics:-Library:-GetSetupINFO()

  

Parameters

  

keyword : a string, one of the indices of the table of information of the Physics Setup; that is, one of the strings returned after entering kernelopts(opaquemodules = false); indices(Physics:-SetupINFO)

  

...     : other keywords

  

Description

  

GetSetupINFO(keyword, ...) gets the value of Physics:-SetupINFO[keyword, ...] without fully evaluating it, so as in eval(Physics:-SetupINFO[keyword, ...], 1). To see all the possible values of keyword, enter kernelopts(opaquemodules = false); indices(Physics:-SetupINFO).

  

Examples

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

kernelopts(opaquemodules = false):

GetSetupINFO("coordinatesystems");

none

(204)

GetSetupINFO("spacetimeindices");

greek

(205)

GetSetupINFO("spacetimemetricdependency");

(206)

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μ,ν=

(207)

GetSetupINFO("coordinatesystems");

X

(208)

GetSetupINFO("spacetimeindices");

greek

(209)

GetSetupINFO("spacetimemetricdependency");

r&comma;θ&comma;m

(210)
  

See Also

  

GetDefineINFO

GetSpaceTimeVectors

  

Calling Sequence

  

Physics:-Library:-GetSpaceTimeVectors(ee,{evaluateatintegers::truefalse := true})

  

Parameters

  

ee  : a mathematical expression possibly involving the spacetime vectors written as a sequence of spacetime coordinates X indexed, as in X[mu]

  

Description

  

GetSpaceTimeVectors returns a set of equations where in the left-hand side there are spacetime vectors written as indexed sequences of spacetime coordinates, and in the right-hand side there are the equivalent spacetime vectors written in the SpaceTimeVector[mu](X) notation. Note that the product operator * of Physics automatically performs this normalization of products.

  

Examples

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

Coordinates(X):

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

(211)

ee := X[mu];

eeXμ

(212)

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

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

(213)
  

Due to the use of alias, lhs and rhs look alike; use lprint to see the difference

GetSpaceTimeVectors(ee);

Xμ=Xμ

(214)

lprint(%);

{(X)[mu] = Physics:-SpaceTimeVector[mu](X)}

  

See Also

  

FromSpaceTimeVector, ToSpaceTimeVector

GetSumIntCore

  

Calling Sequence

  

Physics:-Library:-GetSumIntCore(P::specfunc(anything,[sum, Sum, %sum, int, Int, %int]))

  

Parameters

  

P : a projector not set using the Projector command of Physics, and not necessarily involving Kets or Bras. P is just expressed in terms of sum, Sum, int or Int, possibly nested

  

Description

  

GetSumIntCore receives P, that could be interpreted as a projector but was not constructed by the Projector command of Physics, and it returns the same sequence of four elements returned by GetProjectorCore. See GetProjectorCore in this same help page.

  

Examples

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

  

 

ee := Sum(Int(c[n]*K[n](x)*B[n](x), x=-infinity..infinity), n=-3..3);

een=−33cnKnxBnx&DifferentialD;x

(215)

GetSumIntCore(ee);

Sum&comma;Int,cnKnxBnx,1&comma;1,n&comma;x,−3..3&comma;..

(216)
  

See Also

  

GetProjectorCore

GetSymbolsWithSameType

  

Calling Sequence

  

Physics:-Library:-GetSymbolsWithSameType(x, other, N))

  

Parameters

  

x     : a Maple algebraic object of type commutative, anticommutative, or noncommutative

  

other : any other Maple object, typically a list or set of algebraic objects or variables; the returned symbols should not be contained within other

  

N     : optional, default value is 1, the number of symbols with the same type of x to be returned

  

Description

  

GetSymbolsWithSameType receives an expression x, of type commutative, anticommutative, or noncommutative, along with any other argument, and returns symbols of the same type as x, and not present in the rest of arguments.

  

Examples

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

  

 

Setup(anticommutativeprefix = w, noncommutativeprefix = z);

anticommutativeprefix=w&comma;noncommutativeprefix=z

(217)

GetSymbolsWithSameType(x, [x1], 2);

F1,F2

(218)

GetSymbolsWithSameType(w1 * w2, [F2], 2);

F3,F4

(219)

GetSymbolsWithSameType(w1 - w2, [x1], 2);

w3,w4

(220)

GetSymbolsWithSameType(z1 + z2, [z4], 3);

z5,z6,z7

(221)
  

See Also

  

GetAntiCommutativeSymbol,GetCommutativeSymbol, GetNonCommutativeSymbol, GetReplacementIndices

GetTensorDependency

  

Calling Sequence

  

Physics:-Library:-GetTensorDependency(T)

  

Parameters

  

T : a tensor, defined as such using the Define command, or one of the general relativity tensors automatically defined when you load Physics.

  

Description

  

GetTensorDependency gets the dependency of an indexed object defined as a tensor using Define, or when the indexed object is one of the general relativity tensors automatically defined when Physics is loaded.

  

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

(222)

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μ

(223)
  

You can now compute with pμ itself without indicating the dependency; the system already knows this from its definition (as mentioned earlier), so for instance these two derivatives do not return 0.

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

tpμ&comma;νpμ

(224)
  

You can make the dependency on m and t explicit, remove it, or just compute it with the purpose of further manipulations.

GetTensorDependency(p[mu]);

t&comma;m

(225)

ToTensorFunctionalForm((224));

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

(226)

FromTensorFunctionalForm((226)[1]);

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

(227)
  

Set a non-flat spacetime metric, for instance:

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μ,ν=

(228)
  

All the general relativity tensors now have dependency.

Einstein[mu, nu];

Gμ,ν

(229)

GetTensorDependency((229));

r&comma;θ&comma;m

(230)
  

See Also

  

GetTensorFunctionalForm, FromTensorFunctionalForm, ToTensorFunctionalForm

GetTensorFunctionalForm

  

Calling Sequence

  

Physics:-Library:-GetTensorFunctionalForm(T)

  

Parameters

  

T : a tensor defined using Define, or general relativity tensor

  

Description

  

GetTensorFunctionalForm is a generalization of the former GetGeneralRelativityTensorFunctionalForm command that also handles tensor functions you define using Define. So when T is a tensor of any of those kinds, GetTensorFunctionalForm returns an equation of the form T = T(Q) where Q is the dependency of T. Otherwise, the T = T is returned.

  

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

(231)

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μ

(232)
  

The system now knows about this dependency on t and m, so that in most cases can compute with pμ itself, without making explicit the dependency on m and t; for example, these derivatives of pμ are not zero.

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

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

(233)
  

You can put, remove, or get the functionality of pμ.

ToTensorFunctionalForm((233));

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

(234)

FromTensorFunctionalForm((234)[1]);

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

(235)

GetTensorFunctionalForm(p[mu]);

pμ=pμt&comma;m

(236)
  

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μ,ν=

(237)

GetTensorFunctionalForm(g_[mu,nu]);

gμ,ν=gμ,νr&comma;θ&comma;m

(238)
  

See Also

  

FromGeneralRelativityTensorFunctionalForm, FromTensorFunctionalForm, GetGeneralRelativityTensorFunctionalForm ToGeneralRelativityTensorFunctionalForm, ToTensorFunctionalForm, Physics[Define], Physics[g_]

GetTensorIndices

  

Calling Sequence

  

Physics:-Library:-GetTensorIndices(T)

  

Parameters

  

T : a tensor, defined as such using the Define command, so that type(T, PhysicsType:-Tensor) = true. T can also be a tensor function or even a composed tensor function, such as in dAlembertian(T[mu,nu](X)) 

  

Description

  

GetTensorIndices returns a list with the indices found in the tensor T. If T is not a tensor, the empty list [] is returned.

  

Examples

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

Coordinates(X):

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

(239)

Define(T, quiet):

ee := d_[mu](T[alpha, beta](X));

eeμTα,βX

(240)

GetTensorIndices(ee);

μ&comma;α&comma;β

(241)
  

See Also

  

GetIndicesAndCharacter, GetIndicesInUse, GetIndicesOfType, GetNameIndicesVariables, GetReplacementIndices, GetTensorNamesInExpression, GetTensorSymmetryProperties

GetTensorNamesInExpression

  

Calling Sequence

  

Physics:-Library:-GetTensorNamesInExpression(expr)

  

Parameters

  

expr : any expression, or generally a Maple object with its contents visible (not a table)

  

Description

  

GetTensorNamesInExpression returns the names of the tensors present in expr.

  

Examples

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

Define(A, quiet):

expr := g_[mu,nu] * A[alpha] * A[beta] + LeviCivita[alpha, beta, mu, nu] + KroneckerDelta[alpha, beta] * KroneckerDelta[mu, nu];

exprgμ,νAαAβ+δα,βδμ,ν+εα,β,μ,ν

(242)

GetTensorNamesInExpression(expr);

A&comma;g&comma;ε

(243)
  

See Also

  

GetTensorIndices, GetTensorSymmetryProperties

GetTensorSymmetryProperties

  

Calling Sequence

  

Physics:-Library:-GetTensorSymmetryProperties(T)

  

Parameters

  

T : a tensor, of type PhysicsType:-Tensor

  

Description

  

GetTensorSymmetryProperties returns a sequence of two sets; the first one with an indication of the indices with respect to which T is symmetric, the second one with respect to which T is antisymmetric. These sets contain lists with the numerical positions of indices representing the symmetries of T as explained in the help page for Physics[Define].

  

Examples

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

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: - - - +

_______________________________________________________

(244)

Define(A, H, symmetric, quiet):

Define(G, antisymmetric, quiet):

EM := F[mu,nu] = D_[mu](A[nu](X)) - D_[nu](A[mu](X));

EMFμ,ν=μAνXνAμX

(245)

Define(EM, quiet):

GetTensorSymmetryProperties(A);

,

(246)

GetTensorSymmetryProperties(H[mu, nu]);

1&comma;2,

(247)

GetTensorSymmetryProperties(G[alpha, mu, nu]);

,1&comma;2&comma;3

(248)

GetTensorSymmetryProperties(F[mu, nu](X));

,1&comma;2

(249)

GetTensorSymmetryProperties(Riemann[alpha, beta, mu, nu]);

1&comma;2&comma;3&comma;4,1&comma;2&comma;3&comma;4

(250)
  

See Also

  

GetTensorIndices, GetTensorNamesInExpression, NormalizeTensorExpression

GetTypeOfIndex

  

Calling Sequence

  

Physics:-Library:-GetTypeOfIndex(idx)

  

Parameters

  

idx : an index of any of the types spacetimeindex, spaceindex, tetradindex, spinorindex, genericindex, su2index, su3index, su2matrixindex or su3matrixindex

  

Description

  

GetTypeOfIndex returns the type of the index idx when it is one of spacetimeindex, spaceindex, tetradindex, spinorindex, genericindex, su2index, su3index, su2matrixindex or su3matrixindex; otherwise it returns FAIL.

  

Examples

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

GetTypeOfIndex(mu);

spacetimeindex

(251)

GetTypeOfIndex(j);

FAIL

(252)
  

See Also

  

GetIndicesAndCharacter, GetIndicesInUse, GetNameIndicesVariables, GetTensorIndices, GetTypeOfIndex, IndicesOfKindOfLetter, RootOfIndex

HasAfterAtomizingNames

  

Calling Sequence

  

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

  

Parameters

  

a :

  

b :

  

Description

  

HasAfterAtomizingNames first transforms indexed objects into atomized symbols, then calls has, as in has(a_with_all_indexed_atomized, b_with_all_indexed_atomized). This is particularly relevant when working in jet notation, where x and u[x] (derivative of u) represent independent objects, or when indexing vectors just to represent their components, as in V[x] (the projection of V over the x axis).

  

Examples

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

has(a[x], x);

true

(253)

HasAfterAtomizingNames(a[x], x);

false

(254)

has(f[a[x]], a[x]);

true

(255)

HasAfterAtomizingNames(f[a[x]], a[x]);

false

(256)

HasAfterAtomizingNames(f(a[x]) + a[x], a[x]);

true

(257)
  

See Also

  

has

IndicesOfKindOfLetter

  

Calling Sequence

  

Physics:-Library:-IndicesOfKindOfLetter(n)

  

Parameters

  

n : any integer between 1 and 5

  

Description

  

IndicesOfKindOfLetter returns a sequence of three elements: a list followed by two numbers. The list contains the letters available for the indices corresponding to the given number n, where this correspondence is 1 = greek, 2 = lowercaselatin, 3 = lowercaselatin_ah, 4 = lowercaselatin_is, and 5 = uppercaselatin. The two numbers that follow the list are the minimum and maximum lengths of such an index, respectively.

  

Examples

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

IndicesOfKindOfLetter(1);

α&comma;β&comma;γ&comma;δ&comma;ζ&comma;η&comma;θ&comma;ι&comma;κ&comma;λ&comma;μ&comma;ν&comma;ξ&comma;ο&comma;&pi;&comma;ρ&comma;σ&comma;τ&comma;υ&comma;φ&comma;χ&comma;ψ&comma;ω&comma;ε&comma;ϵ&comma;ϰ&comma;ϕ&comma;ϖ&comma;ϱ&comma;ς&comma;ϑ,2,10

(258)

IndicesOfKindOfLetter(2);

a&comma;b&comma;c&comma;d&comma;e&comma;f&comma;g&comma;h&comma;i&comma;j&comma;k&comma;l&comma;m&comma;n&comma;o&comma;p&comma;q&comma;r&comma;s&comma;t&comma;u&comma;v&comma;w&comma;x&comma;y&comma;z,1,1

(259)

IndicesOfKindOfLetter(3);

a&comma;b&comma;c&comma;d&comma;e&comma;f&comma;g&comma;h,1,1

(260)

IndicesOfKindOfLetter(4);

i&comma;j&comma;k&comma;l&comma;m&comma;n&comma;o&comma;p&comma;q&comma;r&comma;s,1,1

(261)

IndicesOfKindOfLetter(5);

A&comma;B&comma;C&comma;D&comma;E&comma;F&comma;G&comma;H&comma;I&comma;J&comma;K&comma;L&comma;M&comma;N&comma;O&comma;P&comma;Q&comma;R&comma;S&comma;T&comma;U&comma;V&comma;W&comma;X&comma;Y&comma;Z,1,1

(262)
  

See Also

  

GetTypeOfIndex, RootOfIndex

InertProductToInertPower

  

Calling Sequence

  

Physics:-Library:-InertProductToInertPower(A)

  

Parameters

  

A     : an algebraic expression entering, the first operand of an inert product

  

rest : any other argument, also operands of the inert product

  

Description

  

InertProductToInertPower receives a sequence of arguments supposed to be operands of an inert product and, taking their commutative, anticommutative, or noncommutative character, returns the inert product of them with rewriting as inert powers any two or more contiguous operands that are identical. Note that this command receives the operands of an inert product, not the inert product itself, and returns an inert product. Inert products are represented by the function %*, for example as in %*(A, B, C).

  

Examples

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

Setup(noncommutativeprefix = Z);

noncommutativeprefix=Z

(263)

ee := InertProductToInertPower(Z2, Z1, Z1, Z3);

eeZ2Z12Z3

(264)

lprint(ee);

Physics:-`%*`(Z2,Z1 %^ 2,Z3)

  

See Also

  

Physics[*], Physics[^], PowerToProduct

IsACSuffixed

  

Calling Sequence

  

Physics:-Library:-IsACSuffixed(x0)

  

Parameters

  

x0 : any symbol variable

  

Description

  

IsACSuffixed and IsNCSuffixed return true or false according to whether or not x0 is a symbol of type global and an anticommutative (for IsACSuffixed) or a noncommutative (for IsNCSuffixed) prefix itself, which is set using Setup, or suffixed by any of these anticommutative or noncommutative prefixes and followed by an integer. Note that the (new in Maple 17) so-called literal subscripted variables are allowed, so that if Q is an anticommutative prefix, then both Q5 and Q_5 are considered anticommutative. Similarly, if Z is a noncommutative prefix, then both Z5 and Z_5 are considered noncommutative.

  

Examples

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

Setup(anticommutativeprefix = {Q, theta});

anticommutativeprefix=Q&comma;θ

(265)

IsACSuffixed(Q);

true

(266)

IsACSuffixed(Q5);

true

(267)

IsACSuffixed(Qn);

false

(268)

IsACSuffixed(Q__5);

true

(269)
  

See Also

  

IsAntiCommutatorVariable, IsCommutatorVariable, IsNCSuffixed, type/anticommutative, type/noncommutative

IsAntiCommutatorVariable

  

Calling Sequence

  

Physics:-Library:-IsAntiCommutatorVariable(x)

  

Parameters

  

x : any name variable or a tensor, of type PhysicsType:-Tensor

  

Description

  

IsAntiCommutatorVariable return true or false according to whether x entered an AntiCommutator algebra rule with right-hand side equal to zero, set using Setup.

  

Examples

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

Setup(%AntiCommutator(A, B) = 0);

algebrarules=A,B+=0

(270)

IsAntiCommutatorVariable(A);

false

(271)

IsAntiCommutatorVariable(B);

false

(272)

IsAntiCommutatorVariable(C);

false

(273)
  

See Also

  

IsACSuffixed, IsCommutatorVariable, IsNCSuffixed, type/anticommutative, type/noncommutative

IsCommutatorVariable

  

Calling Sequence

  

Physics:-Library:-IsCommutatorVariable(x)

  

Parameters

  

x : any name variable or a tensor, of type PhysicsType:-Tensor

  

Description

  

IsCommutatorVariable return true or false according to whether x entered a Commutator algebra rule with right-hand side not equal to zero, set using Setup.

  

Examples

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

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

algebrarules=A,B=C

(274)

IsCommutatorVariable(A);

true

(275)

IsCommutatorVariable(B);

true

(276)

IsCommutatorVariable(C);

false

(277)
  

See Also

  

IsACSuffixed, IsAntiCommutatorVariable, IsNCSuffixed, type/anticommutative, type/noncommutative

IsContravariant

  

Calling Sequence

  

Physics:-Library:-IsContravariant(mu)

  

Parameters

  

mu    : a symbol or an algebraic expression

  

Description

  

IsContravariant receives an index mu, and returns true or false depending on whether mu is contravariant or not. The distinction between covariant and contravariant is that the second one is prefixed with ~.

  

Examples

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

IsContravariant(~mu);

true

(278)

IsCovariant(mu);

true

(279)
  

See Also

  

IsCovariant

IsCovariant

  

Calling Sequence

  

Physics:-Library:-IsCovariant(mu)

  

Parameters

  

mu    : a symbol or an algebraic expression

  

Description

  

IsCovariant receives an index mu, and returns true or false depending on whether mu is covariant or not. The distinction between covariant and contravariant is that the second one is prefixed with ~.

  

Examples

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

IsCovariant(~mu);

false

(280)

IsCovariant(mu);

true

(281)
  

See Also

  

IsContravariant

IsHermitianOperator

  

Calling Sequence

  

Physics:-Library:-IsHermitianOperator(A)

  

Parameters

  

A    : a symbol or an algebraic expression

  

Description

  

IsHermitianOperator returns true or false depending on whether A is a Hermitian operator operator or not.

  

Examples

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

Setup(hermitian = {A, B}, unitary = {C}, quantumoperators = {F,G});

* Partial match of 'hermitian' against keyword 'hermitianoperators'

* Partial match of 'unitary' against keyword 'unitaryoperators'

_______________________________________________________

hermitianoperators=A&comma;B&comma;quantumoperators=A&comma;B&comma;C&comma;F&comma;G&comma;unitaryoperators=C

(282)
  

[hermitianoperators = {A, B}, quantumoperators = {A, B, C, F, G}, unitaryoperators = {C}]

IsHermitianOperator(A);

true

(283)

IsHermitianOperator(C);

false

(284)

IsUnitaryOperator(C);

true

(285)

IsUnitaryOperator(F);

false

(286)

IsHermitianOperator(F);

false

(287)

select(type, [A, B, C, F, G], PhysicsType:-QuantumOperator);

A&comma;B&comma;C&comma;F&comma;G

(288)

select(type, [A, B, C, F, G], PhysicsType:-HermitianOperator);

A&comma;B

(289)

select(type, [A, B, C, F, G], PhysicsType:-UnitaryOperator);

C

(290)
  

See Also

  

IsUnitaryOperator

IsLiteralSubscript

  

Calling Sequence

  

Physics:-Library:-IsLiteralSubscript(u)

  

Parameters

  

u : any symbol variable

  

Description

  

IsLiteralSubscript returns true or false depending on whether a symbol u is of the form x__y, that is, it has the substring __ after the first or next characters and before the last one.

  

Examples

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

[x, x_y, __y, x__y, x__, x___y];

x&comma;x_y&comma;__y&comma;x__y&comma;x__&comma;x___y

(291)

map(IsLiteralSubscript, (291));

false&comma;false&comma;false&comma;true&comma;false&comma;true

(292)
  

See Also

  

IsACSuffixed, IsNCSuffixed

IsNCSuffixed

  

Calling Sequence

  

Physics:-Library:-IsNCSuffixed(x0)

  

Parameters

  

x0 : any symbol variable

  

Description

  

IsACSuffixed and IsNCSuffixed return true or false according to whether x0 is or not a symbol of type global and, respectively, an anticommutative (IsACSuffixed) or noncommutative (IsNCSuffixed) prefix itself, set using Setup, or suffixed by any of these anticommutative or noncommutative prefixes and followed by an integer. Note that the (new in Maple 17) so-called literal subscripted variables are allowed, so that if Q is an anticommutative prefix, then both Q5 and Q_5 are considered anticommutative. Likely, if Z is an noncommutative prefix, then both Z5 and Z_5 are considered noncommutative.

  

Examples

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

Setup(anticommutativeprefix = {Q, theta});

anticommutativeprefix=Q&comma;θ

(293)

IsACSuffixed(Q);

true

(294)

IsACSuffixed(Q5);

true

(295)

IsACSuffixed(Qn);

false

(296)

IsACSuffixed(Q__5);

true

(297)
  

See Also

  

IsACSuffixed, IsAntiCommutatorVariable, IsCommutatorVariable, type/anticommutative, type/noncommutative

IsRealObject

  

Calling Sequence

  

Physics:-Library:-IsRealObject(A)

  

Parameters

  

A : an algebraic expression, could be a function or just a symbol

  

Description

  

IsRealObject returns true or false according to whether a function or variable passed is known to be real, either because it was assumed to be real, or because it was set to be real using Setup and its realobjects keyword.

  

Examples

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

  

The real objects after loading Vectors are

Setup(realobjects);

realobjects=φ&comma;r&comma;ρ&comma;θ&comma;x&comma;y&comma;z

(298)

F_ &x G_;

F×G

(299)

IsRealObject((299));

false

(300)

Setup(real = {F_, G_});

* Partial match of 'real' against keyword 'realobjects'

_______________________________________________________

realobjects=F&comma;G&comma;φ&comma;r&comma;ρ&comma;θ&comma;x&comma;y&comma;z

(301)

IsRealObject((299));

true

(302)
  

Note also that the is command queries IsRealObject and therefore knows that the product of these two vectors is real, and through it, the rest of the Maple library has access to this information.

is((299), real);

true

(303)

F_ . G_;

F·G

(304)

IsRealObject((304));

true

(305)

is((304), real);

true

(306)
  

See Also

  

assume, assuming, is, coulditbe, RealObjects, Physics[Setup]

IsTensorInCurrentCoordinates

  

Calling Sequence

  

Physics:-Library:-IsTensorInCurrentCoordinates(T,{ignore::set := {}})

  

Parameters

  

T : a tensor, of type PhysicsType:-Tensor

  

ignore : a set with galilean tensor exceptions

  

Description

  

IsTensorInCurrentCoordinates returns true or false depending on whether T is a tensor or not (of type PhysicsType:-Tensor) in the current coordinates (spacetime metric). For example, in a nongalilean spacetime, neither the spacetime vector nor its differentials are tensors.

  

Examples

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

Coordinates(X):

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

(307)

Define(A, quiet):

IsTensorInCurrentCoordinates(A[mu]);

true

(308)

IsTensorInCurrentCoordinates(X[mu]);

true

(309)

IsTensorInCurrentCoordinates(d_[mu](A[nu](X)));

true

(310)
  

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μ,ν=

(311)

IsTensorInCurrentCoordinates(A[mu]);

true

(312)

IsTensorInCurrentCoordinates(X[mu]);

false

(313)

IsTensorInCurrentCoordinates(d_[mu](A[nu](X)));

false

(314)

IsTensorInCurrentCoordinates(D_[mu](A[nu](X)));

true

(315)
  

See Also

  

Physics[g_]

IsTensorialAntisymmetric

  

Calling Sequence

  

Physics:-Library:-IsTensorialAntisymmetric(EE::algebraic, idx::list := NULL,{covariantandcontravariant::truefalse := true, totensorinternalrepresentation::truefalse := true})

  

Parameters

  

EE : an algebraic, tensorial expression with free indices; of type PhysicsType:-ExtendedTensor

  

idx : optional, a list of indices. If this is not given, all free indices of EE are included. The antisymmetry is with respect to all the permutations of pairs of these indices

  

totensorinternalrepresentation : optional, true (default) or false, to rewrite tensors in EE in the tensor internal Physics representation before proceeding.

  

Description

  

IsTensorialAntisymmetric and IsTensorialSymmetric return true or false depending on whether E is, totally antisymmetric or totally symmetric with respect to all of its free indices, or only with respect to permutations of an optional idx list of indices that is passed. By default, before proceeding, IsTensorialAntisymmetric and IsTensorialSymmetric rewrite the tensors in the expression EE in the internal Physics representation; this can be avoided using the optional argument totensorinternalrepresentation = false

  

Examples

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

Coordinates(X):

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

(316)

Define(A, quiet):

Define(H, symmetric, quiet):

Define(G, antisymmetric, quiet):

EM := F[mu,nu] = d_[mu](A[nu](X)) - d_[nu](A[mu](X));

EMFμ,ν=μAνXνAμX

(317)

Define(EM, quiet):

IsTensorialAntisymmetric(H[mu, nu]);

false

(318)

IsTensorialAntisymmetric(G[mu, nu]);

true

(319)

IsTensorialAntisymmetric(F[mu, nu]);

true

(320)
  

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μ,ν=

(321)

IsTensorialAntisymmetric(Riemann[alpha, beta, mu, nu]);

false

(322)

IsTensorialAntisymmetric(Riemann[alpha, beta, mu, nu], [mu, nu]);

true

(323)

IsTensorialSymmetric(Christoffel[mu, alpha, beta]);

false

(324)

IsTensorialSymmetric(Christoffel[mu, alpha, beta], [alpha, beta]);

true

(325)
  

See Also

  

FromTensorInternalRepresentation, IsTensorialSymmetric, ToTensorInternalRepresentation, Physics[g_]

IsTensorialSymmetric

  

Calling Sequence

  

Physics:-Library:-IsTensorialSymmetric(EE::algebraic, idx::list := NULL,{covariantandcontravariant::truefalse := true, totensorinternalrepresentation::truefalse := true})

  

Parameters

  

EE : an algebraic, tensorial expression with free indices, of type PhysicsType:-ExtendedTensor

  

idx : optional, a list of indices. If this is not given, all free indices of EE are included. The antisymmetry is with respect to all the permutations of pairs of these indices

  

totensorinternalrepresentation : optional, true (default) or false, to rewrite tensors in EE in the tensor internal Physics representation before proceeding.

  

Description

  

IsTensorialAntisymmetric and IsTensorialSymmetric return true or false depending on whether E is, respectively totally antisymmetric or totally symmetric with respect to all of its free indices, or only with respect to permutations of an optional idx list of indices that is passed. By default, before proceeding, IsTensorialAntisymmetric and IsTensorialSymmetric rewrite the tensors in the expression EE in the internal Physics representation; this can be avoided using the optional argument totensorinternalrepresentation = false

  

Examples

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

Coordinates(X):

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

(326)

Define(A, quiet):

Define(H, symmetric, quiet):

Define(G, antisymmetric, quiet):

EM := F[mu,nu] = d_[mu](A[nu](X)) - d_[nu](A[mu](X));

EMFμ,ν=μAνXνAμX

(327)

Define(EM, quiet):

IsTensorialAntisymmetric(H[mu, nu]);

false

(328)

IsTensorialAntisymmetric(G[mu, nu]);

true

(329)

IsTensorialAntisymmetric(F[mu, nu]);

true

(330)
  

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μ,ν=

(331)

IsTensorialAntisymmetric(Riemann[alpha, beta, mu, nu]);

false

(332)

IsTensorialAntisymmetric(Riemann[alpha, beta, mu, nu], [mu, nu]);

true

(333)

IsTensorialSymmetric(Christoffel[mu, alpha, beta]);

false

(334)

IsTensorialSymmetric(Christoffel[mu, alpha, beta], [alpha, beta]);

true

(335)
  

See Also

  

FromTensorInternalRepresentation, IsTensorialAntisymmetric, ToTensorInternalRepresentation, Physics[g_]

IsUnitaryOperator

  

Calling Sequence

  

Physics:-Library:-IsUnitaryOperator(A)

  

Parameters

  

A    : a symbol or an algebraic expression

  

Description

  

IsUnitaryOperator returns true or false based on whether A is a Unitary operator or not.

  

Examples

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

Setup(hermitian = {A, B}, unitary = {C}, quantumoperators = {F,G});

* Partial match of 'hermitian' against keyword 'hermitianoperators'

* Partial match of 'unitary' against keyword 'unitaryoperators'

_______________________________________________________

hermitianoperators=A&comma;B&comma;quantumoperators=A&comma;B&comma;C&comma;F&comma;G&comma;unitaryoperators=C

(336)

IsHermitianOperator(A);

true

(337)

IsHermitianOperator(C);

false

(338)

IsUnitaryOperator(C);

true

(339)

IsUnitaryOperator(F);

false

(340)

IsHermitianOperator(F);

false

(341)

select(type, [A, B, C, F, G], PhysicsType:-QuantumOperator);

A&comma;B&comma;C&comma;F&comma;G

(342)

select(type, [A, B, C, F, G], PhysicsType:-HermitianOperator);

A&comma;B

(343)

select(type, [A, B, C, F, G], PhysicsType:-UnitaryOperator);

C

(344)
  

See Also

  

IsHermitianOperator

IsVectorSymbol

  

Calling Sequence

  

Physics:-Library:-IsVectorSymbol(v)

  

Parameters

  

v : an object of type symbol

  

Description

  

IsVectorSymbol returns true or false if v is a vector symbol, that is, one suffixed by the value of Setup(vectorpostfix), by any of the orthonormal unit vectors of the cartesian, cylindrical, or spherical basis, or by any of the vectorial differential operators Nabla, Gradient, Divergence, or Curl. You can also use a literal subscript variable as a vector symbol: suppose the vectorpostfix is the underscore, _, then A__x_ is a vector symbol, displayed as A indexed x with an arrow on top of A.

  

Examples

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

Setup(vectorpostfix);

vectorpostfix=none

(345)

with(Vectors):

Setup(vectorpostfix);

vectorpostfix=_

(346)

IsVectorSymbol(Nabla);

true

(347)

IsVectorSymbol(_i);

true

(348)

IsVectorSymbol(A_);

true

(349)

IsVectorSymbol(A__x_);

true

(350)
  

See Also

  

Physics[Vectors]

ListPhysicsTypes

  

Calling Sequence

  

Physics:-Library:-ListPhysicsTypes({showdefinition::truefalse := false})

  

Parameters

  

showdefinition : optional, when given, the output consists of a list of equations with the type in the left-hand side and its definition in the right-hand side

  

Description

  

ListPhysicsTypes returns a list of all the Physics types, the exports of the module Library:-PhysicsType, but without loading any of them into the global space of names. ListPhysicsTypes can also show the definition of the type when passing the optional argument showdefinition. This is handy and more readable than the equivalent call to TypeTools:-GetType(PhysicsType:-any_Physics_type_here).

  

Examples

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

ListPhysicsTypes();

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

(351)

ListPhysicsTypes(AnnihilationCreationOperator, showdefinition);

AnnihilationCreationOperator=AnnihilationOperatorCreationOperator

(352)
  

See Also

  

PhysicsType, type, TypeTools[GetType]

NestLeftAssociative

  

Calling Sequence

  

Physics:-Library:-NestLeftAssociative(p, a, b)

  

Parameters

  

p : anything representing a procedure that takes two arguments

  

a, b, ... : to be the arguments of p

  

Description

  

NestLeftAssociative applies p to the received arguments, recursively, assuming p takes only two arguments at a time, and that it is left associative. The expression is constructed without actually applying p at any moment. This is the same operation that transforms diff(f(x, y, z), x, y, z) into diff(diff(diff(f(x, y, z), x), y), z).

  

Examples

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

NestLeftAssociative(p, a,b,c,d);

pppa&comma;b&comma;c&comma;d

(353)
  

See Also

  

eval

NormalizeTensor

  

Calling Sequence

  

Physics:-Library:-NormalizeTensor(T,{usedefinition::truefalse := true})

  

Parameters

  

T : a tensor, of type PhysicsType:-Tensor

  

Description

  

NormalizeTensor normalizes the tensor T with respect to the symmetry properties of its indices. This normalization aims to return the different manners of expression T that are mathematically equivalent in a canonical form. Symmetry properties of tensors are indicated when the tensor is defined using Define. Note that tensors defined using a tensorial equation are automatically normalized, so NormalizeTensor is mostly relevant for definitions not using a tensorial equation or when performing manipulations of indices inside a program.

  

Examples

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

Coordinates(X):

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

(354)

Define(F, antisymmetric, quiet):

F[alpha, beta];

Fα,β

(355)
  

The normalization is not automatic; use NormalizeTensor

ee := F[beta, alpha];

eeFβ,α

(356)

NormalizeTensor(ee);

Fα,β

(357)

Define(A, quiet);

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

(358)

EM := F[mu,nu] = d_[mu](A[nu](X)) - d_[nu](A[mu](X));

EMFμ,ν=μAνXνAμX

(359)

Define(EM, quiet):

F[mu,nu];

Fμ,ν

(360)
  

The normalization is automatic when the definition used a tensorial equation

F[nu, mu];

Fμ,ν

(361)
  

See Also

  

GetTensorSymmetryProperties, NormalizeTensorExpression, Physics[Define]

NormalizeTensorExpression

  

Calling Sequence

  

Physics:-Library:-NormalizeTensorExpression(EE, {tensors::set(Physics:-Tensor) := {}, totensorinternalrepresentation::truefalse := true})

  

Parameters

  

EE : an algebraic tensorial expression tensor or a relation between them, or an Array of them

  

tensors : optional, a set of tensors, to normalize only occurrences of these tensors in EE

  

totensorinternalrepresentation : optional, it can be true (default) or false, to rewrite the tensors in the tensor internal Physics representation before proceeding

  

Description

  

NormalizeTensorExpression normalizes all the tensors found in EE as explained in NormalizeTensor. To restrict this operation to a subset of the tensors found in EE, use the optional argument tensors = {...}. To avoid rewriting all the tensors in EE in the tensor internal Physics representation, use totensorinternalrepresentation = false. Note that NormalizeTensorExpression does not perform any simplification of contracted indices - it only rewrites the tensors of EE in a canonical form permitting identifying that two tensors with the same indices are actually the same tensor (this not obvious when the tensor has symmetry properties).

  

Examples

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

Coordinates(X):

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

(362)

Define(F, antisymmetric, quiet):

ee := F[alpha, beta] + F[beta, alpha];

eeFα,β+Fβ,α

(363)
  

The normalization is not automatic; use NormalizeTensorExpression.

NormalizeTensorExpression(ee);

0

(364)
  

See Also

  

GetTensorSymmetryProperties, NormalizeTensor

OperationOnInertCommand

  

Calling Sequence

  

Physics:-Library:-OperationOnInertCommand(operation, inert_command, {inertize::set(symbol) := {}})

  

Parameters

  

operation : an operation to be performed on an inert_command function call, in a case where it is known how to perform the same operation on the related command function call (the non-inert version)

  

inert_command : the inert_command name, a symbol starting with % and followed by the name of a Maple command

  

inertize : optional, a set of non-inert command names that should be inertized before proceeding with the operation to be performed

  

Description

  

OperationOnInertCommand is a handy tool to perform operations on an inert command - say F - when operation/F is a procedure, so the system knows how to apply that operation on F, just no particular instruction exists about %F. The operation to be performed is the first argument, the name of the inert command is the second argument, inert_command, and the _rest of arguments passed to OperationOnInertCommand are the arguments of inert_command. Optionally, a set inertize = {.. other command names ..} makes these other command names be inertized (replacing each foo by %foo) before proceeding. CAVEAT: as of Maple 17, the only operations handled by this command are operations that take only one argument, so for instance, it can be used for normal, but not for int or diff.

  

Examples

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

OperationOnInertCommand(expand, %exp, f(x) + g(x));

&ExponentialE;fx&ExponentialE;gx

(365)

OperationOnInertCommand(expand, %exp, f(x) + g(x), inertize = {f});

&ExponentialE;fx&ExponentialE;gx

(366)

OperationOnInertCommand(expand, %exp, sin(a + b));

&ExponentialE;sinacosb&ExponentialE;cosasinb

(367)

OperationOnInertCommand(expand, %exp, sin(a + b), inertize = {sin, cos});

&ExponentialE;sinacosb&ExponentialE;cosasinb

(368)
  

See Also

  

value

PhysicsType

• 

The Physics types available are:

with(PhysicsType);

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

(369)

nops((369));

124

(370)
• 

To see the definition of the type, either use ListPhysicsTypes or TypeTools:-GetType.

ListPhysicsTypes(ExtendedTensor, showdefinition);

ExtendedTensor=algebraicsatisfiesuCheckIndicesu&comma;free,noerror::¬identicalFAIL&comma;

(371)

TypeTools:-GetType(ExtendedTensor);

algebraicsatisfiesuCheckIndicesu&comma;free,noerror::¬identicalFAIL&comma;

(372)
  

See Also

  

ListPhysicsTypes, type, TypeTools[GetType]

PowerToProduct

  

Calling Sequence

  

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

  

Parameters

  

A, B : the base and the exponent of a power

  

Description

  

If A is not commutative and B is an integer, PowerToProduct returns a non-evaluated product of A and B using the Physics:-* operator. This appears either in the numerator or in the denominator depending on whether B is positive or negative; and if B is not an integer, PowerToProduct returns an unevaluated AB where ^ is the Physics:-^ power operator. On the other hand, if A is commutative, it returns the A^B using the global commutative :-^ operator.

  

Examples

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

Setup(noncommutativeprefix = Z);

noncommutativeprefix=Z

(373)

PowerToProduct(A,3);

A3

(374)

PowerToProduct(Z,3);

ZZZ

(375)

lprint(PowerToProduct(A,n));

A^n

lprint(PowerToProduct(Z,n));

Physics:-`^`(Z,n)

  

See Also

  

InertProductToInertPower, Physics[*], Physics[^]

PrintWithTypesetting

  

Calling Sequence

  

Physics:-Library:-PrintWithTypesetting(msgString, msgParam1, msgParam2, ...)

  

Parameters

  

msgString : the text container, as a message string, as the first argument of the error command

  

msgParam1, msgParam2 : parameters to substitute into msgString

  

Description

• 

The difference between the standard print command and PrintWithTypesetting is that with the latter you can construct sentences mixing text and mathematical formulas systematically, such that the formulas appear in the middle of the text and with full typesetting. The syntax being the same as that of the WARNING and error messages.

  

The msgString is thus a string value that is independent of any parameters that are to be part of the message. The string typically contains numbered parameters of the form %n, where n is an integer, to be replaced by the text or formulas or any valid computational Maple object (lists, sets, etc.).

  

Examples

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

PrintWithTypesetting("This is %1 and that is %2, so formulas within the text, involving special characters like %3 and %4, and with typesetting", cos(theta), exp(Int(sin(varphi),varphi=1..2)), theta, varphi);

This is cosθ and that is &ExponentialE;12sinϕ&DifferentialD;ϕ, so formulas within the text, involving special characters like θ and ϕ, and with typesetting

(376)
  

See Also

  

print

PutCharacterAttributesBack

  

Calling Sequence

  

Physics:-Library:-PutCharacterAttributesBack(T::indexed)

  

Parameters

  

T : an indexed object, typically a tensor or also a tensor in the Physics internal representation (see ToTensorInternalRepresentation)

  

Description

  

PutCharacterAttributesBack receives an indexed object T, typically a tensor, that has attributes regarding its indices as explained in the section for PutCharacterAttributesInTensor, and replaces each index of T by the equivalent index using the character specified in the attributes. So this is the reverse of the operation done by PutCharacterAttributesInTensor.

  

Examples

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

Define(A, quiet):

A_i_contravariant := setattribute(A[i], i = "contravariant");

A_i_contravariantAi

(377)

PutCharacterAttributesBack(A_i_contravariant);

Aii

(378)
  

See Also

  

PutCharacterAttributesInExpression, PutCharacterAttributesInTensor, PutCharacterAttributesBack, UpdateCharacterAttributesInTensor, UpdateCharacterAttributesInExpression

PutCharacterAttributesInExpression

  

Calling Sequence

  

Physics:-Library:-PutCharacterAttributesInExpression(ee, Repeated, {indexedfunction::set := indets(ee, And(Or(indexed,function)))})

  

Parameters

  

ee : typically an expression involving tensors, it can be any Maple object which is not of type last_name_eval

  

Repeated : a set or list of indices, typically these are indices that appear repeated in ee

  

indexedfunction = ... : optional, an equation where the right-hand side is a set of tensors; if this is not given, all indexed or function objects that have the indices found in Repeated are considered as indexedfunction

  

Description

  

When working with curvilinear coordinates (a curved spacetime - so that the Christoffel symbols are not zero), PutCharacterAttributesInExpression puts attributes in all the tensors that were indicated in indexedfunction and the ones that have the indices indicated in Repeated. This operation is performed using PutCharacterAttributesInTensor and is explained in PutCharacterAttributesInTensor. If the Christoffel symbols are zero, ee is returned untouched; in such a case you can still put attributes in tensors using PutCharacterAttributesInTensor.

  

Examples

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

Define(A, quiet):

  

Set the spacetime to be curvilinear, for example, via:

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: - - - +

_______________________________________________________

(379)

T := A[mu, ~nu];

TAμνμν

(380)
  

You can put attributes in a tensor itself with PutCharacterAttributesInTensor.

eq := PutCharacterAttributesInTensor(T);

eqAμνμν=Aμνμν

(381)

attributes(rhs(eq));

μ=covariant,~&nu;=contravariant

(382)
  

For expressions, use PutCharacterAttributesInExpression

e1 := T + 1;

e1Aμνμν+1

(383)
  

All tensors in e1 having the index mu will have received attributes regarding their indices.

e2 := PutCharacterAttributesInExpression(e1, [mu]);

e2Aμνμν+1

(384)

Ts := indets(e2, PhysicsType:-Tensor);

TsAμνμν

(385)

attributes(Ts[1]);

μ=covariant,~&nu;=contravariant

(386)
  

See Also

  

PutCharacterAttributesBack, PutCharacterAttributesInTensor, Physics[g_], UpdateCharacterAttributesinExpression, UpdateCharacterAttributesInTensor

PutCharacterAttributesInTensor

  

Calling Sequence

  

Physics:-Library:-PutCharacterAttributesInTensor(T)

  

Parameters

  

T : a spacetime Tensor, of type PhysicsType:-Tensor

  

Description

  

PutCharacterAttributesInTensor receives a tensor T and returns an equation where the left-hand side is a tensor index of T, and the right-hand side is either the string covariant or contravariant according to the character of that index. This equation is useful in that it permits keeping a representation of the tensor with all its indices as subscripts (so an index is just an index, regardless of being covariant or contravariant) while keeping the information  of the true character in the attributes. Note that the subs command will substitute indices both in T and also in its attributes, so that substitutions can happen without loosing information on the character of the indices.

  

Examples

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

Define(A, quiet):

T := A[mu, ~nu];

TAμνμν

(387)

eq := PutCharacterAttributesInTensor(T);

eqAμνμν=Aμνμν

(388)

attributes(rhs(eq));

μ=covariant,~&nu;=contravariant

(389)

T_indices_all_subscripts := subs(~nu = nu, rhs(eq));

T_indices_all_subscriptsAμ,ν

(390)

attributes(T_indices_all_subscripts);

μ=covariant,ν=contravariant

(391)
  

See Also

  

PutCharacterAttributesBack, PutCharacterAttributesInExpression, UpdateCharacterAttributesInTensor, UpdateCharacterAttributesInExpression

PutZeroDimensionEntries

  

Calling Sequence

  

Physics:-Library:-PutZeroDimensionEntries(A::Or(Array, Matrix))

  

Parameters

  

A : a Maple object of type Array where all of its indices range from 1 to the spacetime dimension returned by Setup(spacetimedimension)

  

Description

  

PutZeroDimensionEntries receives an Array where all of its indices range from 1 to the spacetime dimension returned by Setup(spacetimedimension) - say n - and returns an equivalent Array adding to it indices equal to 0 and corresponding entries so that A[.., 0, ..] = A[.., n, ..]. This is relevant in the context of the Physics package, where in a spacetime of dimension n, any spacetime tensor T can have its components referred as T[.., 0, ..] = T[.., n, ..]. For example, in the default 4-D spacetime, g_[0, 0] gives you the same metric component as g_[4, 4].

  

Examples

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

Setup(dimension = 2);

Warning, unable to define the Pauli sigma matrices (Psigma) as a tensor in a space with dimension = 2 < 3. You can still refer to the Pauli matrices using Psigmax, Psigmay and Psigmaz

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

dimension=2

(392)

A := Array(1..2, 1..2, 1..2, [[a,b], [c,d], [e,f]]):

ArrayElems(A);

1&comma;1&comma;1=a&comma;1&comma;2&comma;1=b&comma;2&comma;1&comma;1=c&comma;2&comma;2&comma;1=d

(393)

A0 := PutZeroDimensionEntries(A):

ArrayElems(A0);

0&comma;0&comma;1=d&comma;0&comma;1&comma;1=c&comma;1&comma;0&comma;1=b&comma;1&comma;1&comma;1=a&comma;1&comma;2&comma;1=b&comma;2&comma;1&comma;1=c&comma;2&comma;2&comma;1=d

(394)

A0[0,0,1] = A[2,2,1];

d=d

(395)
  

See Also

  

Array, ArrayElems

Quiet

  

Calling Sequence

  

Physics:-Library:-Quiet(quiet::truefalse, Args::list)

  

Parameters

  

quiet : it can be true or false

  

Args : a list of arguments that may or not include the word quiet or the equation quiet = true (or false).

  

Description

  

Quiet is called from another routine to return true or false regarding whether to display (print) messages on the screen. In the typical case, the caller routine has the option {quiet::truefalse := <either true or false>}. Quiet returns true or false according to: if quiet or quiet = <either true or false> are present in Args, then return the value of the first argument passed to Quiet, otherwise, decide between the first argument, quiet and the value of _Env_Physics_print, with priority for _Env_Physics_print. This routine is uniformly used across the Physics package to handle when should messages be displayed on the screen.

  

Examples

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

  

Create a procedure P that returns arguments with (default) or without displaying messages on the screen, and when quiet is given, then according to its value:

P := proc({quiet::truefalse := false}) _Env_Physics_print := not Quiet(quiet, [args]); if _Env_Physics_print then print(`arguments received` = [_rest]); fi; [_rest] end;

Pprocquiet::truefalsefalse_Env_Physics_printnotLibrary:-Quietquiet&comma;args&semi;if_Env_Physics_printthenprintarguments received&equals;_restend if&semi;_restend proc

(396)

P(x,y,z);

arguments received=x&comma;y&comma;z

x&comma;y&comma;z

(397)

P(x,y,z, quiet);

x&comma;y&comma;z

(398)
  

When _Env_Physics_print is of type truefalse and quiet is not passed to P, the value of _Env_Physics_print, gets passed, otherwise the value of quiet has the priority.

_Env_Physics_print := false;

_Env_Physics_printfalse

(399)

P(x,y,z);

x&comma;y&comma;z

(400)

P(x,y,z, quiet = false);

arguments received=x&comma;y&comma;z

x&comma;y&comma;z

(401)
  

See Also

  

TypesetPrint

RealObjects

  

Calling Sequence

  

Physics:-Library:-RealObjects(A)

  

Parameters

  

A : a function or a variable of type name

  

Description

  

RealObjects sets and unsets mathematical variables and functions as real, and answers queries about them.

  

Examples

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

  

The real objects entering a mathematical computation can be set in different ways: using assume, Physics[Setup] and its parameter realobjects, and directly with the Library:-RealObjects. The advantage of using the last two methods compared to using assume is that you can reuse expressions entered before you set the objects real, and that contain those objects.

  

When setting or unsetting objects as real, like Physics[Setup], RealObjects returns all the objects that are real.

RealObjects(set, F, G);

F&comma;G

(402)

F * G;

FG

(403)

is((403), real);

true

(404)

RealObjects(unset, G);

F

(405)

is((403), real);

false

(406)
  

See Also

  

assume, assuming, is, IsRealObject, Physics[Setup]

RecycleArguments

  

Calling Sequence

  

Physics:-Library:-RecycleArguments(Rest, valid_keywords,{Args::list := NULL})

  

Parameters

  

Rest : a list of arguments, typically received by the routine that calls RecycleArguments, such that each element of the list is either a keyword (of type symbol) or an equation with such a keyword in the left-hand side

  

valid_keywords : a list of keywords that RecycleArguments accepts as valid

  

Args : optional, a list typically containing the actual arguments received by the routine that calls RecycleArguments

  

Description

  

RecycleArguments receives a list Rest where each element is a keywords or a keyword = ..., typically the _rest arguments received by the routine that calls RecycleArguments, and performs a text matching of each keyword against the valid_keywords, then returns either the match when there is only one, as a list with that argument, or a set with a sequence of possible matches when there is more than one. This is particularly useful for programming routines that expect optional arguments as keyword = ... and receive just a portion of keyword - say ey. RecycleArgments is used by all the Physics commands to process optional arguments that can then be passed misspelled or incomplete, facilitating in that way the use of the Physics commands.

  

Examples

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

kernelopts(opaquemodules = false):

debug(Physics:-RecycleArguments);

RecycleArguments

(407)

`tools/GetKeywords`(Simplify);

indices&comma;int&comma;quiet&comma;sum&comma;tryhard&comma;algebrarules&comma;bracketrules&comma;ordering&comma;completeprojector&comma;dodgammaproducts&comma;equalizerepeatedindices&comma;noncommutativeproducts&comma;replaceimaginaryunit&comma;simplifyelementaryfunctions&comma;tryexpandvectorfunctions

(408)

Simplify(A, ind):

{--> enter RecycleArguments, args = [ind], [algebrarules, bracketrules, completeprojector, dodgammaproducts, equalizerepeatedindices, indices, int, noncommutativeproducts, ordering, quiet, replaceimaginaryunit, simplifyelementaryfunctions, sum, tryexpandvectorfunctions, tryhard]

* Partial match of 'ind' against keyword 'indices'

<-- exit RecycleArguments (now in Simplify:-ModuleApply) = [indices]}

Setup(op = A):

{--> enter RecycleArguments, args = [op = A], [abbreviations, algebrarules, anticommutativecolor, anticommutativeprefix, assumingusesAssume, automaticsimplification, bracketbasis, bracketrules, combinepowersofsamebase, coordinatesystems, cosmologicalconstant, Dgammarepresentation, differentialoperators, differentiationvariables, dimension, disjointedspaces, genericindices, geometricdifferentiation, hermitianoperators, hideketlabel, lapseandshift, levicivita, masslessfields, mathematicalnotation, metric, noncommutativeprefix, noncommutativecolor, normusesconjugate, primedvariables, quantumbasisdimension, quantumcontinuousbasis, quantumdiscretebasis, quantumoperators, realobjects, redefinesum, signature, spacetimeindices, spaceindices, spinorindices, su2indices, su2matrixindices, su3indices, su3matrixindices, tensorproductnotation, tensorsimplifier, tetrad, tetradindices, tetradmetric, traceonlymatrices, unitaryoperators, unitvectordisplay, usecoordinatesastensorindices, usephysicsevaluator, minimizetensorcomponents, usewirtingerderivatives, vectordisplay, vectorpostfix, deletesetup, hilbertspaces, operators, readsetup, realobjects, savecurrent, advanced, additionally, clear, conventions, default, deletesavedsetup, keywords, query, quiet, readusersetup, redo, savesetup], Args = [op = A]

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

<-- exit RecycleArguments (now in Setup:-ModuleApply) = [quantumoperators = A]}

_______________________________________________________

(409)
  

See Also

  

parameter keywords

ReformatRepeatedIndices

  

Calling Sequence

  

Physics:-Library:-ReformatRepeatedIndices(ee, repeatedindices::Or(list(symbol), not given) := not given , {normalizecontractedindices::truefalse := normalizecontractedproducts , normalizecontractedproducts::truefalse := false , reformatoperands::truefalse := true} , repeatedindicescovariant::truefalse := evalb(Library:-GetSetupINFO(kindofspacetime) = Euclidean) , $)

  

Parameters

  

ee : any Maple expression, relation, or Array of them

  

repeatedindices : optional, it can be a list of tensor indices expected to appear repeatedly in ee; if given, only these repeated indices will be reformatted in ee, as one covariant and the other contravariant. Otherwise, all tensor repeated indices in ee will be reformatted

  

normalizecontractedproducts : optional, it can be true or false (default), so that in addition to reformatting the contracted indices, a normalization of the tensors whose indices were reformatted is carried equivalent to applying NormalizeTensor to them. See also NormalizeTensor.

  

normalizecontractedindices : optional, it can be true or false (default value is the value of normalizecontractedproducts), so that in addition to a normalization of the tensors whose indices were reformatted, a normalization of their indices is also performed.

  

reformatoperands : optional, it can be true (default) or false. This parameter is also used to reformat the indices in contracted products that appear within functions - so that ee is not linear in these products.

  

repeatedindicescovariant : optional, it can be true (default value when the metric is Euclidean) or false (default value otherwise). It only applies to tensors (see IsTensorInCurrentCoordinates) or their products, and is used to rewrite each pair of repeated indices as all-covariant instead of one covariant and one contravariant.

  

Description

  

ReformatRepeatedIndices reformats the indices of contracted products of tensors within ee such that for each pair of repeated indices, in the output one index is covariant and the other is contravariant. If the pair is already one covariant and the other contravariant, it is kept as it is. Aiming at reformatting the expression entirely with the less computational cost, by default contracted products within functions are also reformatted and the tensors with repeated indices reformatted are not normalized after the process; you can override any of these defaults with the options reformatoperands = false and normalizecontractedproducts = true.

  

When the option normalizecontractedproducts is given, by default the option normalizecontractedindices is activated so that contracted indices are also normalized. For example, if A is a tensor then occurrences of A[j, ~j] and A[~j, j] are both normalized to A[j, ~j]. To avoid this normalization of indices, pass normalizecontractedindices = false.

  

By default, when the metric is Euclidean, all repeated indices are automatically reformatted as covariant. In order to have repeated indices expressed all-covariant when the metric is not Euclidean, pass the option repeatedindicescovariant. NOTE: while this option will produce the desired result within the programs, to have the repeated indices all-covariant on the screen, you need to set the Physics evaluator to false (see Setup), otherwise the repeated indices will be automatically reformatted to one covariant the other contravariant before returning a result on the screen.

  

Examples

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

Define(A, B);

Defined objects with tensor properties

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

(410)

Setup(evaluator = false);

* Partial match of 'evaluator' against keyword 'usephysicsevaluator'

_______________________________________________________

usephysicsevaluator=false

(411)

ee := A[mu] * B[mu];

eeAμBμ

(412)

ReformatRepeatedIndices(ee);

AμBμμ

(413)

ReformatRepeatedIndices((413), repeatedindicescovariant);

AμBμ

(414)

Define(F, antisymmetric);

Defined objects with tensor properties

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

(415)

ReformatRepeatedIndices(F[mu,mu]);

Fμμμμ

(416)

ReformatRepeatedIndices(F[mu,mu], normalizecontractedproducts);

0

(417)

F[mu, nu] + F[nu, mu];

Fμ,ν+Fν,μ

(418)

NormalizeTensorExpression((418));

0

(419)

(418) * A[mu] * B[nu];

Fμ,ν+Fν,μAμBν

(420)

ReformatRepeatedIndices((420));

Fμ,ν+Fν,μAμμBνν

(421)

ReformatRepeatedIndices((420), normalizecontractedproducts);

0

(422)
  

See Also

  

Physics[Setup]

RemoveIntegerIndices

  

Calling Sequence

  

Physics:-Library:-RemoveIntegerIndices({dimension::nonnegint := Physics:-GetSetupINFO(dimension)})

  

Parameters

  

rest : any sequence of arguments

  

dimension : optional, the dimension of spacetime as returned by Setup(dimension); if not given, it is obtained using GetSetupINFO("dimension")

  

Description

  

RemoveIntegerIndices receives a sequence of objects, or a set or list of them, and returns them after removing all those that could be an integer spacetime index. For example, the number 1, and the symbols 1 and ~1 all represent integer spacetime indices.

  

Examples

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

GetSetupINFO("dimension");

4

(423)

L := mu, 1, `1`, ~1, nu, 5;

Lμ,1,1,~1,ν,5

(424)

RemoveIntegerIndices(L);

μ,ν,5

(425)

RemoveIntegerIndices([L]);

μ&comma;ν&comma;5

(426)
  

See Also

  

ReplaceCommonRepeatedIndices, ReplaceRepeatedIndices

ReplaceCommonRepeatedIndices

  

Calling Sequence

  

Physics:-Library:-ReplaceCommonRepeatedIndices(A)

  

Parameters

  

A, rest : a sequence of tensorial expressions, each one typically having contracted indices

  

Description

  

ReplaceCommonRepeatedIndices receives a sequence of tensorial expressions, each one typically having contracted indices, and returns an equivalent sequence such that the contracted indices of each element does not appear in the contracted indices of the other elements. In other words, only the common repeated indices are replaced. See also the similar command ReplaceRepeatedIndices.

  

Examples

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

Define(A);

Defined objects with tensor properties

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

(427)

ee := A[mu]^2;

eeAμAμμ

(428)

ReplaceCommonRepeatedIndices(ee);

AμAμμ

(429)

ee := A[mu]^2*A[nu]^2 + A[rho]^2;

eeAμAμμAνAνν+AρAρρ

(430)

ReplaceCommonRepeatedIndices(ee, A[mu]^2);

AμAμμAνAνν+AρAρρ,AαAαα

(431)

ReplaceCommonRepeatedIndices(ee, A[mu]^2*A[nu]^2);

AμAμμAνAνν+AρAρρ,AαAααAβAββ

(432)

ReplaceCommonRepeatedIndices(ee, ee);

AμAμμAνAνν+AρAρρ,AαAααAβAββ+AκAκκ

(433)
  

See Also

  

RemoveIntegerIndices, ReplaceRepeatedIndices

ReplaceRepeatedIndices

  

Calling Sequence

  

Physics:-Library:-ReplaceRepeatedIndices(A, to_be_replaced)

  

Parameters

  

A : a tensorial expression

  

to_be_replaced : a set with indices, expressed as covariant indices, to be replaced in A whenever they appear contracted

  

Description

  

ReplaceRepeatedIndices receives a tensorial expression A and replaces in it all repeated (contracted) indices indicated in the set to_be_replaced.

  

Examples

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

Define(A);

Defined objects with tensor properties

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

(434)

ee := A[mu]^2;

eeAμAμμ

(435)

ReplaceRepeatedIndices(ee, {mu});

AνAνν

(436)

ee := A[mu]^2*A[nu]^2 + A[rho]^2;

eeAμAμμAνAνν+AρAρρ

(437)

ReplaceRepeatedIndices(ee, {mu, nu});

AαAβAααAββ+AρAρρ

(438)

ReplaceRepeatedIndices(ee, {rho});

AμAμμAνAνν+AαAαα

(439)
  

See Also

  

RemoveIntegerIndices, ReplaceCommonRepeatedIndices

Restore

  

Calling Sequence

  

Physics:-Library:-Restore({quiet::truefalse := false})

  

Parameters

  

: no parameters

  

Description

  

Restore uses the Physics:-Library:-Backup() command to restore from memory a Physics Setup that was backed-up in the same Maple session. Restore returns NULL.

  

Examples

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

Setup(noncommutativeprefix);

noncommutativeprefix=none

(440)

Backup();

Setup(noncommutativeprefix = Z);

noncommutativeprefix=Z

(441)

Commute(Z1, Z2);

false

(442)

Restore();

Setup(noncommutativeprefix);

noncommutativeprefix=none

(443)

Commute(Z1, Z2);

true

(444)
  

See Also

  

Backup

RootOfIndex

  

Calling Sequence

  

Physics:-Library:-RootOfIndex(mu, mi := 1, ma := 7)

  

Parameters

  

mu : a tensor index, it could be a greek or latin letter, lowercase or uppercase, or such a letter followed by a number, say a1, or followed by the literal subscript suffix __ and then followed by a number, such as in a__1

  

Description

  

RootOfIndex receives a tensor index mu and returns its root; that is, the letter prefix, greek or latin, lowercase or uppercase. Contravariant indices as well as literal subscript indices are also handled.

  

Examples

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

RootOfIndex(mu);

μ

(445)

RootOfIndex(~mu);

μ

(446)

RootOfIndex(~mu1);

μ

(447)
  

A contravariant literal subscript index:

RootOfIndex(~mu__1);

μ

(448)

RootOfIndex(~a__1);

a

(449)
  

See Also

  

GetTypeOfIndex, IndicesOfKindOfLetter

SearchDGMetricTable

  

Calling Sequence

  

Physics:-Library:-SearchDGMetricTable(keyword)

  

Parameters

  

keyword : any text or portion of it, as a Maple symbol (enclosed by ) or as a string (enclosed by )

  

Description

  

SearchDGMetricTable, searches the DifferentialGeometry database of solutions to Einstein's equations for occurrences of the portion of text keyword in the description of the solution.

  

Examples

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

  

The keys for all the metrics found in the database that contain the portion of word sc:

SearchDGMetricTable(sc);

5&comma;21&comma;1&comma;12&comma;13&comma;1&comma;12&comma;27&comma;1&comma;12&comma;31&comma;1&comma;12&comma;32&comma;1&comma;13&comma;31&comma;1&comma;13&comma;32&comma;1&comma;14&comma;26&comma;2&comma;15&comma;17&comma;1&comma;15&comma;19&comma;1&comma;15&comma;19&comma;2&comma;16&comma;18&comma;1&comma;17&comma;16&comma;1&comma;33&comma;15&comma;1&comma;33&comma;44&comma;1&comma;36&comma;11&comma;1

(450)
  

For example:

g_[[12, 13, 1]];

_______________________________________________________

Systems of spacetime coordinates are:X=v&comma;x&comma;y&comma;u

Default differentiation variables for d_, D_ and dAlembertian are:X=v&comma;x&comma;y&comma;u

The Ozsvath, Schucking (1962) metric in coordinates v&comma;x&comma;y&comma;u

Comments: g&ExponentialE;o&DifferentialD;&ExponentialE;sⅈcally compl&ExponentialE;t&ExponentialE;, no curvatur&ExponentialE; sⅈngularⅈtⅈ&ExponentialE;s

Resetting the signature of spacetime from - - - + to + + + - in order to match the signature in the database of metrics

_______________________________________________________

Setting lowercaselatin_is letters to represent space indices

gμ,ν=

(451)

g_[[16, 18, 1]];

_______________________________________________________

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

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

Parameters: &kappa;0&comma;R&comma;a&comma;b

Comments: To mak&ExponentialE; th&ExponentialE; pr&ExponentialE;ssur&ExponentialE; posⅈtⅈv&ExponentialE; n&ExponentialE;ar r =0, w&ExponentialE; r&ExponentialE;quⅈr&ExponentialE; (a - 3*b)/(a-b) > 0. Not&ExponentialE; also that that th&ExponentialE; m&ExponentialE;trⅈc ⅈs unchang&ExponentialE;&DifferentialD; by a sⅈmultan&ExponentialE;ous chang&ExponentialE; sⅈgn of a, b

Domain: 0<r&comma;r<R

Assumptions: 0<&kappa;0&comma;b<a&comma;a<3b

Signature: + + + -

_______________________________________________________

gμ,ν=

(452)
  

Search the database about the metrics published in the year 1974:

SearchDGMetricTable("1974");

(453)

g_[[15, 31, 1]];

_______________________________________________________

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

Default differentiation variables for d_, D_ and dAlembertian are:X=x&comma;y&comma;z&comma;t

The Novotny, Horsky (1974) metric in coordinates x&comma;y&comma;z&comma;t

Parameters: a

Domain: 0<z&comma;z<π2a

Assumptions: 0<a

Signature: + + + -

_______________________________________________________

gμ,ν=

(454)
  

See Also

  

Physics[g_], DifferentialGeometry[Library][MetricSearch]

ShieldDummyIndicesInFunctionArguments

  

Calling Sequence

  

Physics:-Library:-ShieldDummyIndicesInFunctionArguments(ee, use_indices_not_in_here := NULL)

  

Parameters

  

ee : any Maple object that is not of type last_name_eval

  

use_indices_not_in_here : optional, any Maple object that is not of type last_name_eval

  

Description

  

ShieldDummyIndicesInFunctionArguments replaces in ee all spacetime dummy (contracted) indices that appear inside functions (in their arguments) and that also appear outside the functions. If there are no functions or the dummies within them are not found outside them, nothing gets changed. To indicate that some indices are not to be used as replacements, pass a second argument, use_indices_not_in_here, that can be an expression or any other Maple object that contains the indices not to be used.

  

Examples

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

Define(A, B);

Defined objects with tensor properties

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

(455)

ee := G(A[mu], B[mu])*B[mu]*B[mu];

eeGAμ&comma;BμBμBμμ

(456)
  

In this expression, the index mu appearing in the arguments of G is not a dummy, so nothing is changed

ShieldDummyIndicesInFunctionArguments(ee);

GAμ&comma;BμBμBμμ

(457)
  

In this other expression, mu within G is a contracted index so it is changed

ee2 := A[nu]^2*G(A[mu]*B[mu]) + A[mu]*B[mu];

ee2AνAννGAμBμμ+AμBμμ

(458)

ShieldDummyIndicesInFunctionArguments(ee2);

AνAννGAαBαα+AμBμμ

(459)
  

Indicate that alpha should not be used as new dummy contracted index

ShieldDummyIndicesInFunctionArguments(ee2, alpha);

AνAννGAβBββ+AμBμμ

(460)
  

See Also

  

SubsTensorIndices

SortAnticommutativeList

  

Calling Sequence

  

Physics:-Library:-SortAnticommutativeList(L1::list, L2::list := sort(L1), {verifyanticommutativity::truefalse := false})

  

Parameters

  

L1 : a list of anticommutative objects

  

L2 : optional, another list of anticommutative objects indicating the preferred ordering to be achieved

  

verifyanticommutativity : optional, can be true or false (default), to verify that the elements of L1 and L2 are indeed anticommutative before proceeding with reordering them

  

Description

  

SortAnticommutativeList receives two lists of anticommutative objects and sorts the first one according to the ordering of the second one, then returns a sequence of two objects: the number 1 or -1 according to the number of permutations performed during the sorting, followed by the sorted L1. If L2 is not given, the pattern used to reorder L1 is the one returned by sort(L1). Note that L2 does not need to have the same number of elements as L1.

  

Examples

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

Setup(anticommutativeprefix = a);

anticommutativeprefix=a

(461)

L1 := [a[1], a[2], a[3]];

L1a1&comma;a2&comma;a3

(462)

L2 := [a[3], a[1]];

L2a3&comma;a1

(463)

SortAnticommutativeList(L1, L2);

1,a3&comma;a1&comma;a2

(464)

L2 := [a[3], a[2]];

L2a3&comma;a2

(465)

SortAnticommutativeList(L1, L2);

−1,a3&comma;a2&comma;a1

(466)
  

See Also

  

sort, antisymmetric

SortQuantumObjectsThatCommute

  

Calling Sequence

  

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

  

Parameters

  

A : a quantum object (so of type noncommutative) that is assumed to commute with B, another quantum object

  

B : same as A, a quantum object assumed to commute with A

  

Description

  

Suppose two noncommutative objects, A and B, are given, and in addition, suppose they commute. In these situations, in order to recognize that AB is equal to BA it is necessary to express both with the same ordering. SortQuantumObjectsThatCommute accomplishes that task choosing an ordering for the sequence A, B, and returning true or false according to whether the ordering given matches the one preferred by this command. The preferred ordering is an extension of the concept of normal ordering in field theories (creation operators to the left of annihilation operators, or if A and B refer to the same basis of quantum states, then sort ascending by quantum numbers, or fermionic operators to the left of bosonic ones, and so on).

  

Examples

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

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

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

_______________________________________________________

algebrarules=A,B=0&comma;quantumoperators=A&comma;B

(467)

am := Annihilation(A);

ama

(468)

ap := Creation(A);

apa+

(469)

SortQuantumObjectsThatCommute(am, ap);

false

(470)

SortQuantumObjectsThatCommute(A[1], A[2]);

true

(471)

SortQuantumObjectsThatCommute(B, A);

false

(472)
  

See Also

  

AntiCommute, Commute

StripTilde

  

Calling Sequence

  

Physics:-Library:-StripTilde(mu, {actonpowers::truefalse := false})

  

Parameters

  

mu : a tensor index, of type symbol

  

actonpowers : optional, to act on powers stripping the tilde ~ in the base of the power, expected to be a tensor index of type symbol

  

Description

  

StripTilde receives mu, a tensor index, of type symbol, and if mu is a contravariant index, so that its first character is the tilde ~, it strips out the tilde, otherwise it returns mu unchanged. If the option actonpowers is passed, then if mu is actually a power where the base is a symbol, then StripTilde returns the power after stripping the tilde from its base.

  

Examples

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

~mu;

~&mu;

(473)

StripTilde(~mu);

μ

(474)

StripTilde(mu);

μ

(475)

StripTilde(~mu^2);

~&mu;2

(476)

StripTilde(~mu^2, actonpowers);

μ2

(477)
  

See Also

  

Contravariant, Covariant, FlipCharacter, StripTildeFromRepeatedIndices

StripTildeFromRepeatedIndices

  

Calling Sequence

  

Physics:-Library:-StripTildeFromRepeatedIndices(L)

  

Parameters

  

L : a list of indices, possibly containing powers or products of them, or a power or product of indices, or an an object of indexed with indices of type symbol, that it is a tensor defined using Define

  

Description

  

StripTildeFromRepeatedIndices detects the repeated indices in L, and if there are contravariant indices in this subset, so prefixed with the tilde ~, it strips the tilde from them.

  

Examples

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

Define(A);

Defined objects with tensor properties

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

(478)

L := [mu, ~mu, nu, ~nu];

Lμ&comma;~&mu;&comma;ν&comma;~&nu;

(479)

StripTildeFromRepeatedIndices(L);

μ&comma;μ&comma;ν&comma;ν

(480)

L := `*`(op(L));

Lμ~&mu;ν~&nu;

(481)

StripTildeFromRepeatedIndices(L);

μ2ν2

(482)

L := map(u -> u^2, [op(L)]);

Lμ2&comma;~&mu;2&comma;ν2&comma;~&nu;2

(483)

StripTildeFromRepeatedIndices(L);

μ2&comma;μ2&comma;ν2&comma;ν2

(484)

ee := A[mu,~mu];

eeAμμμμ

(485)

StripTildeFromRepeatedIndices(ee);

Aμμμμ

(486)
  

See Also

  

Contravariant, Covariant, FlipCharacter, StripTilde

SubsTensorIndices

  

Calling Sequence

  

Physics:-Library:-SubsTensorIndices(eqs, ee, Tensors::set := indets(ee,Physics:-Tensor))

  

Parameters

  

eqs : a list of substitution equations for indices

  

ee : the object where indices are to be substituted, typically an expression, it could be any Maple object not of type last_name_eval

  

Tensors : optional, a set with the tensors where substitutions are to be performed - if not given, the substitutions are performed in all the objects of type PhysicsType:-Tensor found in ee

  

Description

  

SubsTensorIndices substitutes the list of equations eqs with indices substitutions into the object ee, typically an expression containing tensors (defined using Physics:-Define, so of type PhysicsType:-Tensor). You can restrict the substitutions to only some tensors by giving them within a set as a third argument. The tensors in ee are expected to be either indexed objects, as in T[mu, nu, ...], or indexed functions, say as in T[mu, nu, ...](X). Given a covariant index equation like mu = alpha, SubsTensorIndices automatically replaces both the covariant mu = alpha and contravariant ~mu = ~alpha indices. SubsTensorIndices is a simplified and fast version of the command Physics:-SubstituteTensorIndices, useful when the tensors in ee are of this specific simple form mentioned: indexed or indexed functions.

  

Examples

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

Define(A, B, quiet):

ee := A[mu]*B[mu] + A[mu]*A[mu] + B[mu]*B[mu] + C[mu,mu];

eeAμAμμ+AμBμμ+BμBμμ+Cμ,μ

(487)
  

In the above, C[mu,mu] is not a tensor, so substitutions are not performed in it

SubsTensorIndices([mu = nu], ee);

AνAνν+AνBνν+BνBνν+Cμ,μ

(488)
  

See Also

  

Physics[SubstituteTensor], Physics[SubstituteTensorIndices], ShieldDummyIndicesInFunctionArguments

TensorComponents

  

Calling Sequence

  

Physics:-Library:-TensorComponents(T::Or(algebraic,rtable,relation(Or(algebraic,rtable))))

  

Parameters

  

T : a tensorial expression, or a relation between tensorial expressions, or an rtable (typically Array) of them

  

Description

  

TensorComponents returns an ordered list of the tensor components of the tensorial expression T. Covariant and contravariant (prefixed by ~) indices are respected. The ordering in the list returned corresponds to the ascending numerical positions of these components in the corresponding tensor Array of components. See TensorArray.

  

Examples

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

Coordinates(X);

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

X

(489)
  

The contravariant spacetime vector X[mu]

TensorComponents(X[~mu]);

X

(490)
  

The covariant spacetime vector X[mu]

TensorComponents(X[mu]);

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

(491)

Define(A);

Defined objects with tensor properties

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

(492)

TensorComponents(A[~mu]);

A11&comma;A22&comma;A33&comma;A44

(493)

TensorComponents(A[mu]);

A1&comma;A2&comma;A3&comma;A4

(494)
  

See Also

  

Physics[SumOverRepeatedIndices], Physics[TensorArray]

ToContravariant

  

Calling Sequence

  

Physics:-Library:-ToContravariant(EE, {evaluatetensor::truefalse := true, evaluateexpression::truefalse := true, totensorinternalrepresentation::truefalse := true, fromtensorinternalrepresentation::truefalse := true})

  

Parameters

  

EE : any maple object where subs and eval can perform substitutions, typically a tensorial expression with free and repeated (contracted) tensor indices

  

evaluatetensor : optional, default value is true, to evaluate the tensor after rewriting it with contravariant indices; this may be relevant when the tensor has symmetry properties under permutation of its indices

  

evaluateexpression : optional, default value is true, to evaluate the expression EE after rewriting it with all tensors in contravariant form

  

totensorinternalrepresentation : optional, default value is true, to rewrite the tensors in EE using the internal Physics representation before proceeding

  

fromtensorinternalrepresentation : optional, default value is true, to rewrite back,using the user-level representation, all the tensors entering the result

  

Description

  

ToContravariant rewrites all covariant indices of tensors in EE as contravariant ones by replacing the tensors with contracted products using the metric, say as in replacing A[mu] by g_[mu, nu] * A[~nu]. Note that this rewriting does not change their covariant or contravariant character of the free indices of EE, so this rewriting is different from multiplying EE by the metric in order to raise its free indices.

  

Examples

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

Define(A, B, C, F);

Defined objects with tensor properties

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

(495)
  

A tensorial expression with mu and nu as free indices and rho as contracted index

A[mu]*B[`~nu`]+C[mu, `~nu`]*F[rho, rho];

AμBνν+CμνμνFρρρρ

(496)

ToContravariant((496));

gα,μCα,να,νgβ,ρFβ,ρβ,ρ+gα,μAααBνν

(497)
  

Note that the free indices have not changed:

Check((497), all);

The repeated indices per term are: ...&comma;...&comma;..., the free indices are: ...

α&comma;β&comma;ρ&comma;α,μ&comma;~&nu;

(498)

ToCovariant((496));

gα,να,νCμ,αgβ,ρβ,ρFρ,β+Aμgα,να,νBα

(499)

ToContravariant((499));

gα,να,νgκ,μgα,λCκ,λκ,λgβ,ρβ,ρgρ,σgβ,τFσ,τσ,τ+gβ,μAββgα,να,νgα,κBκκ

(500)

Simplify((500));

AμBνν+CμνμνFττττ

(501)
  

See Also

  

Contravariant, eval, Physics[Check], subs, SubstituteTensor, ToCovariant

ToCovariant

  

Calling Sequence

  

Physics:-Library:-ToCovariant(EE, {evaluatetensor::truefalse := true, evaluateexpression::truefalse := true, totensorinternalrepresentation::truefalse := true, fromtensorinternalrepresentation::truefalse := true})

  

Parameters

  

EE : any maple object where subs and eval can perform substitutions, typically a tensorial expression with free and repeated (contracted) tensor indices

  

evaluatetensor : optional, default value is true, to evaluate the tensor after rewriting it with covariant indices; this may be relevant when the tensor has symmetry properties under permutation of its indices

  

evaluateexpression : optional, default value is true, to evaluate the expression EE after rewriting it with all tensors in contravariant form

  

totensorinternalrepresentation : optional, default value is true, to rewrite the tensors in EE using the internal Physics representation before proceeding

  

fromtensorinternalrepresentation : optional, default value is true, to rewrite back,using the user-level representation, all the tensors entering the result

  

Description

  

ToCovariant rewrites all contravariant indices of tensors in EE as covariant ones by replacing the tensors with contracted products using the metric, say as in replacing A[~mu] by g_[~mu, ~nu] * A[nu]. Note that this rewriting does not change their covariant or contravariant character of the free indices of EE, so this rewriting is different from multiplying EE by the metric in order to lower its free indices.

  

Examples

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

Define(A, B, C, F);

Defined objects with tensor properties

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

(502)
  

A tensorial expression with mu and nu as free indices and rho as contracted index

A[mu]*B[`~nu`]+C[mu, `~nu`]*F[rho, rho];

AμBνν+CμνμνFρρρρ

(503)

ToCovariant((503));

gα,να,νCμ,αgβ,ρβ,ρFρ,β+Aμgα,να,νBα

(504)
  

Note that the free indices have not changed:

Check((504), all);

The repeated indices per term are: ...&comma;...&comma;..., the free indices are: ...

α&comma;β&comma;ρ&comma;α,μ&comma;~&nu;

(505)

ToCovariant((503));

gα,να,νCμ,αgβ,ρβ,ρFρ,β+Aμgα,να,νBα

(506)

ToCovariant((506));

gα,να,νCμ,αgβ,ρβ,ρFρ,β+Aμgα,να,νBα

(507)

Simplify((507));

AμBνν+CμνμνFρρρρ

(508)
  

See Also

  

Contravariant, eval, Physics[Check], subs, SubstituteTensor, ToContravariant

ToGeneralRelativityTensorFunctionalForm

  

Calling Sequence

  

Physics:-Library:-ToGeneralRelativityTensorFunctionalForm(A, $)

  

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

  

Description

  

ToGeneralRelativityTensorFunctionalForm receives an expression A containing general relativity tensors without functionality and returns the same expression after introducing the functionality found in the spacetime metric g_, including parameters if any, followed by a set with the substitution equations used. This is useful when intermediate computations should take into account (or not) this functionality - see also FromGeneralRelativityTensorFunctionalForm.

  

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μ,ν=

(509)

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

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

(510)

ToGeneralRelativityTensorFunctionalForm(e1);

Rα,β,μ,νr&comma;θ&comma;m+gμ,νr&comma;θ&comma;m,Rα,β,μ,ν=Rα,β,μ,νr&comma;θ&comma;m&comma;gμ,ν=gμ,νr&comma;θ&comma;m

(511)
  

See Also

  

FromGeneralRelativityTensorFunctionalForm, GetGeneralRelativityTensorFunctionalForm, Physics[g_]

ToSpaceTimeVector

  

Calling Sequence

  

Physics:-Library:-ToSpaceTimeVector(ee,{evaluateatintegers::truefalse := true})

  

Parameters

  

ee  : a mathematical expression possibly involving the spacetime vectors written as a sequence of spacetime coordinates X indexed, as in X[mu]

  

Description

  

ToSpaceTimeVector converts to the SpaceTimeVector[mu](X) notation all occurrences of spacetime vectors, written as 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

(512)

X_mu := X[mu];

X_muXμ

(513)

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

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

(514)

ToSpaceTimeVector(X_mu);

Xμ

(515)
  

See Also

  

FromSpaceTimeVector, GetSpaceTimeVectors

ToTensorFunctionalForm

  

Calling Sequence

  

Physics:-Library:-ToTensorFunctionalForm(A, $)

  

Parameters

  

A  : an algebraic expression involving tensors that appear as indexed objects, which however do have functional dependency,

  

Description

  

ToTensorFunctionalForm receives an expression A containing tensors that appear as indexed objects - say as in T[i,j] - which however do have functional dependency, either because they were defined as such, or because they are the general relativity tensors and the spacetime is non nongalilean - the metric depends on the spacetime coordinates, and returns the same expression after inserting the functionality of these tensors - say as in T[i,j](X) - 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, ToTensorFunctionalForm is a generalization of the Maple 17 FromGeneralRelativityTensorFunctionalForm command that handles also user defined tensor functions, and performs the reverse operation of FromTensorFunctionalForm.

  

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

(516)

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μ

(517)
  

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μ

(518)
  

Put and remove the functionality

ToTensorFunctionalForm((518));

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

(519)

FromTensorFunctionalForm((519)[1]);

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

(520)
  

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μ,ν=

(521)

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

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

(522)

ToTensorFunctionalForm(e1);

Rα,β,μ,νr&comma;θ&comma;m+gμ,νr&comma;θ&comma;m,Rα,β,μ,ν=Rα,β,μ,νr&comma;θ&comma;m&comma;gμ,ν=gμ,νr&comma;θ&comma;m

(523)
  

See Also

  

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

ToTensorInternalRepresentation

  

Calling Sequence

  

Physics:-Library:-ToTensorInternalRepresentation(expr)

  

Parameters

  

expr             : a mathematical expression containing tensors (see Physics:-Define)

  

Description

  

ToTensorInternalRepresentation replaces in the given expression all tensor functions defined using the Physics Define command by an internal representation that contains the same information and is of type indexed, permitting a more uniform manipulation of the different kinds of tensors that can be constructed composing tensors and linear or tensorial operators. The output consists of a sequence of two elements: first there is a set with all the tensors found in expr written in the internal representation, then comes the expression itself after having replaced the tensors by their internal representation.

  

This internal representation involves three local variables of the Physics package; these are: Physics:-_tenop, used when a linear tensorial operator has for arguments a tensor; Physics:-_tenfunc, used when the arguments of the operator do not contain tensors and Physics:-_dotidx, used to represent the indices within the 0th operand of this internal indexed representation.

  

Examples

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

Coordinates(X):

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

(524)

Define(A):

Defined objects with tensor properties

(525)

ToTensorInternalRepresentation(d_[mu](A(X)));

_tenfunc&DifferentialD;&comma;AX&comma;Xμ,_tenfunc&DifferentialD;&comma;AX&comma;Xμ

(526)

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

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

(527)

FromTensorInternalRepresentation(ir[2]);

μAνX

(528)
  

See Also

  

FromTensorInternalRepresentation

TypesetPrint

  

Calling Sequence

  

Physics:-Library:-TypesetPrint(text,{shieldcoordinatesalias::truefalse := true})

  

Parameters

  

text, rest : any mathematical expression in Maple syntax, or symbol, or a sequence of any of them, typically portions of text enclosed between `` and meant to be displayed without the surrounding '

  

Description

  

TypesetPrint receives a sequence of text and mathematical formulas, the former as Maple symbols, normal text enclosed between ``, the latter written in Maple syntax, and displays the sequence on the screen, without commas in between the text and the formulas (different from the standard print command), with the text italicized and the formulas with typesetting in 2D math, using traditional mathematical notation for Physics objects (equivalent to setting interface(typesetting = extended)). Additionally, if the environment variable _Env_Physics_print = false, nothing is displayed. This routine is used across the Physics package together with Quiet, in order to display (Yes or No) text or text and formulas on the screen with full mathematical notation.

  

Examples

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

Define(A);

Defined objects with tensor properties

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

(529)

TypesetPrint(`The greek letters of the list `, [alpha, beta, gamma], ` enter this integral `, Int('d_[alpha](A[~beta])'*A[~gamma], x));

The greek letters of the list α&comma;β&comma;γ enter this integral αAββAγγ&DifferentialD;x

(530)
  

See Also

  

print, Quiet, Typesetting

UpdateCharacterAttributesInExpression

  

Calling Sequence

  

Physics:-Library:-UpdateCharacterAttributesInExpression(ee,S,{idx_in := [attributes(S)], idx_out := idx_in})

  

Parameters

  

ee : typically an expression containing tensors, it could be any Maple object not of type last_name_eval

  

S : a tensor or list of them

  

idx_in : optional, the indices of S whose attributes should be used to update the attributes of these indices in the tensors found in ee

  

idx_out : optional, the indices of tensors in ee whose attributes should be updated with the attributes of these indices in S

  

Description

  

When the Christoffel symbols are not zero (curved spacetime) UpdateCharacterAttributesInExpression will update the attributes of the indices of all the tensors in ee with the attributes of the same indices found in the tensor S or in the list of tensors S. Optionally you can indicate which indices are to be considered in S with the optional argument indx_in = ... where the right-hand side is a list of indices; likewise you can optionally specify which indices must have their attributes updated with the optional argument idx_out = ... and the right-hand side is a list with these indices. Note: Only the indices of tensors in ee that already have attributes when calling UpdateCharacterAttributesInExpression will have their attributes updated. This type of manipulation is used together with PutCharacterAttributesInTensor, PutCharacterAttributesInExpression, UpdateCharacterAttributesInTensor and PutCharacterAttributesBack to manipulate tensorial expressions in curved spacetimes, that have covariant and contravariant indices, while having all them expressed as subscripts.

  

Examples

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

Define(A, B, C, quiet):

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: - - - +

_______________________________________________________

(531)

A_i_contravariant := setattribute(A[i], i = "contravariant");

A_i_contravariantAi

(532)

B_k_contravariant := setattribute(B[k], k = "contravariant");

B_k_contravariantBk

(533)

C_ik_covariant := setattribute(C[i,k], i = "covariant", k = "covariant");

C_ik_covariantCi,k

(534)

ee := A_i_contravariant * B_k_contravariant + g_[i,k];

eeAiBk+gi,k

(535)

ee_covariant := UpdateCharacterAttributesInExpression(ee, C_ik_covariant);

ee_covariantAiBk+gi,k

(536)

Ts := indets(ee_covariant, PhysicsType:-Tensor);

Tsgi,k&comma;Ai&comma;Bk

(537)
  

Only the indices that have attributes (so only in A and B) have their attributes updated

map(u -> (u = attributes(u)), Ts);

gi,k=&comma;Ai=i=covariant&comma;Bk=i=covariant

(538)
  

See Also

  

PutCharacterAttributesInExpression, PutCharacterAttributesBack, UpdateCharacterAttributesInTensor, UpdateCharacterAttributesInExpression

UpdateCharacterAttributesInTensor

  

Calling Sequence

  

Physics:-Library:-UpdateCharacterAttributesInTensor(T,S,{idx_in := map(lhs,[if(S::(list),op(map(attributes,S)),attributes(S))]), idx_out := idx_in})

  

Parameters

  

T : a tensor, of type PhysicsType:-Tensor

  

S : a tensor or list of them

  

idx_in : optional, the indices of S whose attributes should be used to update the attributes of these indices in T

  

idx_out : optional, the indices of T whose attributes should be updated with the attributes of these indices in S

  

Description

  

UpdateCharacterAttributesInTensor will update the attributes of the indices of the tensor T with the attributes of the same indices found in the tensor S or in the list of tensors S. Optionally you can indicate which indices are to be considered in S with the optional argument idx_in = ... where the right-hand side is a list of indices; likewise you can optionally specify which indices must have their attributes updated with the optional argument idx_out = ... and the right-hand side is a list with these indices. Note: Only the indices of T that already have attributes when calling UpdateCharacterAttributesInTensor will have their attributes updated. This type of manipulation is used together with PutCharacterAttributesInTensor, PutCharacterAttributesInExpression, UpdateCharacterAttributesInExpression and PutCharacterAttributesBack to manipulate tensorial expressions in curved spacetimes, that have covariant and contravariant indices, while having all them expressed as subscripts.

  

Examples

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

Define(A, B, quiet):

  

Set attributes to A[i] indicating the character of its index, regardless of it being a subscript

A_i := setattribute(A[i], i = "contravariant");

A_iAi

(539)

attributes(A_i);

i=contravariant

(540)
  

The same for B[i, k]

B_ik_covariant := setattribute(B[i,k], i = "covariant", k = "covariant");

B_ik_covariantBi,k

(541)

A_i := UpdateCharacterAttributesInTensor(A_i, B_ik_covariant);

A_iAi

(542)

attributes(A_i);

i=covariant

(543)
  

See Also

  

PutCharacterAttributesInExpression, PutCharacterAttributesBack, UpdateCharacterAttributesInTensor, UpdateCharacterAttributesInExpression, Physics[Define], Physics[g_]

UpdateQnInUse

  

Calling Sequence

  

Physics:-Library:-UpdateQnInUse()

  

Parameters

  

rest : any sequence of parameters

  

Description

  

UpdateQnInUse returns the indets of type symbol found in the arguments received and in the environment variable _Env_Qn_in_use. This is used to update the value of _Env_Qn_in_use within programs: variables present in _Env_Qn_in_use are discarded by GetAntiCommutativeSymbol, GetCommutativeSymbol, GetNonCommutativeSymbol, GetIndicesOfType and in general by all the Physics:-Library commands that return symbol variables for different purposes (e.g. for representing contracted indices in an expression that already has indices that are not these contracted ones).

  

Examples

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

UpdateQnInUse();

(544)

GetIndicesOfType(spacetimeindex, []);

μ

(545)

_Env_Qn_in_use := mu;

_Env_Qn_in_useμ

(546)

UpdateQnInUse();

μ

(547)

GetIndicesOfType(spacetimeindex, []);

ν

(548)

_Env_Qn_in_use := UpdateQnInUse([mu, nu]);

_Env_Qn_in_useμ&comma;ν

(549)

GetIndicesOfType(spacetimeindex, []);

α

(550)
  

See Also

  

Environment Variables

See Also

Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists

Compatibility

• 

The Physics:-Library command was introduced in Maple 17.

• 

For more information on Maple 17 changes, see Updates in Maple 17.

• 

The Physics:-Library command was updated in Maple 2017.