tensor
compare
compare two objects each of which can be a tensor_type, spin coefficient table or a curvature component table.
Calling Sequence
Parameters
Description
Examples
compare( U, V)
U, V
-
U and V can be any of tensor_type, spin coefficient table or curvature component table. See the help file for the tensor package for the explanation of the structures of the three types of objects mentioned above.
Important: The tensor package has been deprecated. Use the superseding packages DifferentialGeometry and Physics instead.
This function compares the input parameters U and V with the restriction that both of them must be one of the three recognized structures.
If they are not of the same structure, then this routine reports the structure each has.
If they are both spin coefficient tables or both curvature component table, then the routine compares each pair of corresponding elements of U and V, and returns the sequence of indices of unmatching elements.
If U and V are both tensor_types, then this routine first compares their ranks, dimensions, then characters and returns an appropriate flag if detects any distinction. If U and V share the same rank, dimension, and character then compare() goes on to compare each "independently defined" corresponding pair of components of the two tensor_types as well as the indexing functions of the component arrays. compare() then returns the sequence of the indices of the unmatching components, and the name 'indexfunc' if the two component arrays have different indexing functions.
The name 'Identical' is returned if U and V are found identical in each aspect checked.
Simplification :
compare() has one simplifier, `tensor/compare/simp`, used to simplify the difference of each pair of corresponding components/elements of the two objects being compared. The simplified difference is then checked if vanishing or not.
`tensor/compare/simp` is initialized to `tensor/simp`, but it is recommended that it be customized to suit the needs of a particular comparison.
Caution : When compare() reports that two objects differ in a set of their components/elements, what it really means is that the employed simplifier fails to simplify the pairwise differences of those reported components. The user is hence advised to double check with another simplifier (more powerful presumably) or by inspecting each pair of the reported components.
This function is part of the tensor package, and can be used in the form compare(..) only after performing the command with(tensor), or with(tensor, compare). The function can always be accessed in the long form tensor[compare].
with⁡tensor:
I3≔array⁡identity,1..3,1..3:
I4≔array⁡identity,1..4,1..4:
U≔create⁡1,1,op⁡I3
U≔table⁡index_char=1,1,compts=100010001
compare⁡U,U
Identical
V≔create⁡1,1,op⁡I4
V≔table⁡index_char=1,1,compts=1000010000100001
compare⁡U,V
Dimensions unmatched
Z≔create⁡1,1,array⁡sparse,1..4,1..4
Z≔table⁡index_char=1,1,compts=0000000000000000
compare⁡V,Z
indexfunc
Note here that neither V nor Z has independently defined components. The various 0's and 1's in the two tensor_types come from the respective indexing functions in the component arrays and that is why compare() only returns indexfunc. See the following example for more details.
T_compts≔array⁡symmetric,1..3,1..3,1,1=x,2,2=y,3,3=z,1,2=0,1,3=0,2,3=0:
T≔create⁡1,1,op⁡T_compts
T≔table⁡index_char=1,1,compts=x000y000z
compare⁡T,U
indexfunc,1,1,2,2,3,3
S_tble≔table⁡λ=0,κ=0,σ=0,ρ=0,τ=0,ε=0,α=0,β=0,γ=0,ν=0,μ=0,pi=0
S_tble≔table⁡γ=0,β=0,ν=0,α=0,π=0,κ=0,λ=0,ε=0,μ=0,τ=0,ρ=0,σ=0
compare⁡S_tble,U
S_tble is a spin coefficient table; whereas U is a tensor_type.
compare⁡S_tble,S_tble
S2_tble≔table⁡λ=1,κ=1,σ=1,ρ=1,τ=0,ε=0,α=0,β=0,γ=0,ν=0,μ=0,pi=0
S2_tble≔table⁡γ=0,β=0,ν=0,α=0,π=0,κ=1,λ=1,ε=0,μ=0,τ=0,ρ=1,σ=1
compare⁡S_tble,S2_tble
κ,λ,ρ,σ
PHI≔array⁡0..2,0..2:
forifrom0to2doforjfrom0to2doPHIi,j≔1enddoenddo:PSI≔array⁡0..4,0,1,2,3,4:C_tble≔table⁡Φ=op⁡PHI,Ψ=op⁡PSI,R=r
C_tble≔table⁡Ψ=array⁡0..4,0=0,1=1,2=2,3=3,4=4,Φ=array⁡0..2,0..2,0,0=1,0,1=1,0,2=1,1,0=1,1,1=1,1,2=1,2,0=1,2,1=1,2,2=1,R=r
C2_tble≔table⁡Φ=op⁡PHI,Ψ=op⁡PSI,R=2⁢r
C2_tble≔table⁡Ψ=array⁡0..4,0=0,1=1,2=2,3=3,4=4,Φ=array⁡0..2,0..2,0,0=1,0,1=1,0,2=1,1,0=1,1,1=1,1,2=1,2,0=1,2,1=1,2,2=1,R=2⁢r
compare⁡C_tble,C2_tble
R
compare⁡C_tble,C_tble
compare⁡C_tble,S_tble
C_tble is a curvature component table; whereas S_tble is a spin coefficient table.
See Also
tensor(deprecated)
Download Help Document