ecterrab

13431 Reputation

24 Badges

19 years, 362 days

MaplePrimes Activity


These are answers submitted by ecterrab

small_perturbations_(reviewed).mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft


 

Hi Trace,

Some comments and answers are intercalated below, all in italic, while keeping your text non-italic

restart

with(Physics); Setup(coordinates = (X = [t, r, x, y]), metric = -Physics:-`*`(A(r), Physics:-`^`(dt, 2))+Physics:-`*`(B(r), Physics:-`^`(dr, 2))+Physics:-`*`(C(r), Physics:-`^`(dx, 2)+Physics:-`^`(dy, 2)), quiet)

Setup(math = true)

`* Partial match of  'math' against keyword 'mathematicalnotation'`

 

[mathematicalnotation = true]

(1)

PDEtools:-declare([mathematicalnotation = true], Phi(r), Q(Phi), T(Phi))

` Phi`(r)*`will now be displayed as`*Phi

 

` Q`(Phi)*`will now be displayed as`*Q

 

` T`(Phi)*`will now be displayed as`*T

(2)

NOTE: The name Phi is a constant with respect to the coordinates, while the function Phi(r) is not. I imagine that what you wanted to say is that Q and T depend on r through Phi. You can say that either entering Q(Phi(r)) or simpler: Q(r) and keep in mind that the dependency is through Phi, to be used at the end -- and of course the same for T(Phi), so I will introduce a line here with this change. I also got used to CompactDisplay, just to keep everything within Physics, anyway it is the same as PDEtools:-declare,

CompactDisplay((Q, T)(r))

` Q`(r)*`will now be displayed as`*Q

 

` T`(r)*`will now be displayed as`*T

(3)

For the same reason, to avoid seeng redundant functionality,

CompactDisplay((A, B, C)(r))

` A`(r)*`will now be displayed as`*A

 

` B`(r)*`will now be displayed as`*B

 

` C`(r)*`will now be displayed as`*C

(4)

g_[]

Physics:-g_[mu, nu] = Matrix(%id = 18446744078341410198)

(5)

I want to define electromagnetic field strength tensor F[mu,nu]=(D_[mu](N[nu])-D_[nu](N[mu]))and  taking ansatz A=A(r) dt  as follows;

(Question: what is that dt at the end of the sentence?)

N[mu] = [A(r), 0, 0, 0]

N[mu] = [A(r), 0, 0, 0]

(6)

Define(N[mu] = [A(r), 0, 0, 0])

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], N[mu], Physics:-Psigma[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], Physics:-Weyl[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(7)

N[]

N[mu] = Array(%id = 18446744078305151326)

(8)

F[mu, nu] = D_[mu](N[nu])-D_[nu](N[mu])

F[mu, nu] = Physics:-D_[mu](N[nu], [X])-Physics:-D_[nu](N[mu], [X])

(9)

Define(F[mu, nu] = Physics[D_][mu](N[nu], [X])-Physics[D_][nu](N[mu], [X]))

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], F[mu, nu], N[mu], Physics:-Psigma[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], Physics:-Weyl[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(10)

F[definition]

F[mu, nu] = Physics:-D_[mu](N[nu], [X])-Physics:-D_[nu](N[mu], [X])

(11)

F[]

F[mu, nu] = Matrix(%id = 18446744078490186806)

(12)

I have problem with these terms !! (where is Q derivation with respect to r)

The problem is that you are using Q(Phi), which as such it does not depend on r. I am indicating the dependency on r, mentioned in the NOTE some lines above

``

"D_[mu](Q(r) F[~mu,~nu]);               #` `D_[mu](Q(Phi)F[~mu,~nu])"

Physics:-d_[mu](Q(r), [X])*F[`~mu`, `~nu`]+Q(r)*Physics:-D_[mu](F[`~mu`, `~nu`], [X])

(13)

"D_[mu]( (Q(r)+Q(r)A(r))F[~mu,~nu])             #` D_`[mu]( (Q(Phi)+Q(Phi)A(r))F[~mu,~nu])"

(Physics:-d_[mu](Q(r), [X])+Physics:-d_[mu](Q(r), [X])*A(r)+Q(r)*Physics:-d_[mu](A(r), [X]))*F[`~mu`, `~nu`]+(Q(r)+Q(r)*A(r))*Physics:-D_[mu](F[`~mu`, `~nu`], [X])

(14)

Here you are entering d_[mu]*A(r)*d_[`~mu`]*A(r), that is "multiplication", not application, whereas I imagine you meant application not multiplication. I am adjusting here your input.

d_[mu](A(r))*d_[`~mu`](A(r))

Physics:-d_[mu](A(r), [X])*Physics:-d_[`~mu`](A(r), [X])

(15)

SumOverRepeatedIndices(Physics[d_][mu](A(r), [X])*Physics[d_][`~mu`](A(r), [X]))

(diff(A(r), r))^2/B(r)

(16)

NULL

It's there. If this is all your question I imagine the problem is fully resolved?


 

Download ansatz1_(reviewed).mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

Hi

By default, TransformCoordinates does not set the metric, it only transforms it. This permits experimentation until the metric is the one you want. At that point, in a second operation, you set the metric.

You can do this second operation using Setup. Say you want the metric to be the output of TransformCoordinates and say that output is the "previous expression". Then you can use Setup(metric = %);, where % represents the previous expression.

Alternatively, if you are using Maple 2017, you can perform the two operations in one go using the option setmetric. I.e.: play with TransformCoordinates until the result is what you want, then return to the input line and just add the keyword setmetric and re-execute the input line. This option, and the use of Setup mentioned in the previous paragraph are explained in the help page of TransformCoordinates.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft


 

Load Physics

with(Physics)

From the line element I see in your worksheet, you are using Cartesian coordinates and a signature with the time component negative? If so,

Setup(coordinates = cartesian, signature = `+++-`)

`* Partial match of  'coordinates' against keyword 'coordinatesystems'`

 

`Default differentiation variables for d_, D_ and dAlembertian are: `*{X = (x, y, z, t)}

 

`Systems of spacetime Coordinates are: `*{X = (x, y, z, t)}

 

[coordinatesystems = {X}, signature = `+ + + -`]

(1)

If you are using a different signature, just change the one above by the one you are using.

 

The line element as shown in your worksheet (you can change by any other one)

`#msup(mi("ds"),mn("2"))` := -dt^2+a(t)*(dx^2+dy^2+dz^2)/(1+(1/4)*k*(x^2+y^2+z^2))^2

-dt^2+a(t)*(dx^2+dy^2+dz^2)/(1+(1/4)*k*(x^2+y^2+z^2))^2

(2)

Set now the metric using this line element

Setup(metric = -dt^2+a(t)*(dx^2+dy^2+dz^2)/(1+(1/4)*k*(x^2+y^2+z^2))^2)

 

Check that the metric is the one you intended

g_[]

Physics:-g_[mu, nu] = Matrix(%id = 18446744078271418846)

(3)

 

And that is all you need to do. The Christoffel symbols, and all the general relativity tensors are now automatically computed on background.

 

For example, the nonzero components of the all-covariant Christoffel symbols are

Christoffel[nonzero]

Physics:-Christoffel[alpha, mu, nu] = {(1, 1, 1) = -32*a(t)*k*x/(4+k*(x^2+y^2+z^2))^3, (1, 1, 2) = -32*a(t)*k*y/(4+k*(x^2+y^2+z^2))^3, (1, 1, 3) = -32*a(t)*k*z/(4+k*(x^2+y^2+z^2))^3, (1, 1, 4) = 8*(diff(a(t), t))/(4+k*(x^2+y^2+z^2))^2, (1, 2, 1) = -32*a(t)*k*y/(4+k*(x^2+y^2+z^2))^3, (1, 2, 2) = 32*a(t)*k*x/(4+k*(x^2+y^2+z^2))^3, (1, 3, 1) = -32*a(t)*k*z/(4+k*(x^2+y^2+z^2))^3, (1, 3, 3) = 32*a(t)*k*x/(4+k*(x^2+y^2+z^2))^3, (1, 4, 1) = 8*(diff(a(t), t))/(4+k*(x^2+y^2+z^2))^2, (2, 1, 1) = 32*a(t)*k*y/(4+k*(x^2+y^2+z^2))^3, (2, 1, 2) = -32*a(t)*k*x/(4+k*(x^2+y^2+z^2))^3, (2, 2, 1) = -32*a(t)*k*x/(4+k*(x^2+y^2+z^2))^3, (2, 2, 2) = -32*a(t)*k*y/(4+k*(x^2+y^2+z^2))^3, (2, 2, 3) = -32*a(t)*k*z/(4+k*(x^2+y^2+z^2))^3, (2, 2, 4) = 8*(diff(a(t), t))/(4+k*(x^2+y^2+z^2))^2, (2, 3, 2) = -32*a(t)*k*z/(4+k*(x^2+y^2+z^2))^3, (2, 3, 3) = 32*a(t)*k*y/(4+k*(x^2+y^2+z^2))^3, (2, 4, 2) = 8*(diff(a(t), t))/(4+k*(x^2+y^2+z^2))^2, (3, 1, 1) = 32*a(t)*k*z/(4+k*(x^2+y^2+z^2))^3, (3, 1, 3) = -32*a(t)*k*x/(4+k*(x^2+y^2+z^2))^3, (3, 2, 2) = 32*a(t)*k*z/(4+k*(x^2+y^2+z^2))^3, (3, 2, 3) = -32*a(t)*k*y/(4+k*(x^2+y^2+z^2))^3, (3, 3, 1) = -32*a(t)*k*x/(4+k*(x^2+y^2+z^2))^3, (3, 3, 2) = -32*a(t)*k*y/(4+k*(x^2+y^2+z^2))^3, (3, 3, 3) = -32*a(t)*k*z/(4+k*(x^2+y^2+z^2))^3, (3, 3, 4) = 8*(diff(a(t), t))/(4+k*(x^2+y^2+z^2))^2, (3, 4, 3) = 8*(diff(a(t), t))/(4+k*(x^2+y^2+z^2))^2, (4, 1, 1) = -8*(diff(a(t), t))/(4+k*(x^2+y^2+z^2))^2, (4, 2, 2) = -8*(diff(a(t), t))/(4+k*(x^2+y^2+z^2))^2, (4, 3, 3) = -8*(diff(a(t), t))/(4+k*(x^2+y^2+z^2))^2}

(4)

The nonzero for the all contravariant

"Christoffel[~,nonzero]"

Physics:-Christoffel[`~alpha`, `~mu`, `~nu`] = {(1, 1, 1) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*x/a(t)^2, (1, 1, 2) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*y/a(t)^2, (1, 1, 3) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*z/a(t)^2, (1, 1, 4) = -(1/32)*(4+k*(x^2+y^2+z^2))^2*(diff(a(t), t))/a(t)^2, (1, 2, 1) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*y/a(t)^2, (1, 2, 2) = (1/128)*(4+k*(x^2+y^2+z^2))^3*k*x/a(t)^2, (1, 3, 1) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*z/a(t)^2, (1, 3, 3) = (1/128)*(4+k*(x^2+y^2+z^2))^3*k*x/a(t)^2, (1, 4, 1) = -(1/32)*(4+k*(x^2+y^2+z^2))^2*(diff(a(t), t))/a(t)^2, (2, 1, 1) = (1/128)*(4+k*(x^2+y^2+z^2))^3*k*y/a(t)^2, (2, 1, 2) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*x/a(t)^2, (2, 2, 1) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*x/a(t)^2, (2, 2, 2) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*y/a(t)^2, (2, 2, 3) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*z/a(t)^2, (2, 2, 4) = -(1/32)*(4+k*(x^2+y^2+z^2))^2*(diff(a(t), t))/a(t)^2, (2, 3, 2) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*z/a(t)^2, (2, 3, 3) = (1/128)*(4+k*(x^2+y^2+z^2))^3*k*y/a(t)^2, (2, 4, 2) = -(1/32)*(4+k*(x^2+y^2+z^2))^2*(diff(a(t), t))/a(t)^2, (3, 1, 1) = (1/128)*(4+k*(x^2+y^2+z^2))^3*k*z/a(t)^2, (3, 1, 3) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*x/a(t)^2, (3, 2, 2) = (1/128)*(4+k*(x^2+y^2+z^2))^3*k*z/a(t)^2, (3, 2, 3) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*y/a(t)^2, (3, 3, 1) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*x/a(t)^2, (3, 3, 2) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*y/a(t)^2, (3, 3, 3) = -(1/128)*(4+k*(x^2+y^2+z^2))^3*k*z/a(t)^2, (3, 3, 4) = -(1/32)*(4+k*(x^2+y^2+z^2))^2*(diff(a(t), t))/a(t)^2, (3, 4, 3) = -(1/32)*(4+k*(x^2+y^2+z^2))^2*(diff(a(t), t))/a(t)^2, (4, 1, 1) = (1/32)*(4+k*(x^2+y^2+z^2))^2*(diff(a(t), t))/a(t)^2, (4, 2, 2) = (1/32)*(4+k*(x^2+y^2+z^2))^2*(diff(a(t), t))/a(t)^2, (4, 3, 3) = (1/32)*(4+k*(x^2+y^2+z^2))^2*(diff(a(t), t))/a(t)^2}

(5)

For mixed components, indicate the indices prefixing with ~ the contravariant ones, for example

Christoffel[`~mu`, alpha, beta, nonzero]

Physics:-Christoffel[`~mu`, alpha, beta] = {(1, 1, 1) = -2*k*x/(4+k*(x^2+y^2+z^2)), (1, 1, 2) = -2*k*y/(4+k*(x^2+y^2+z^2)), (1, 1, 3) = -2*k*z/(4+k*(x^2+y^2+z^2)), (1, 1, 4) = (1/2)*(diff(a(t), t))/a(t), (1, 2, 1) = -2*k*y/(4+k*(x^2+y^2+z^2)), (1, 2, 2) = 2*k*x/(4+k*(x^2+y^2+z^2)), (1, 3, 1) = -2*k*z/(4+k*(x^2+y^2+z^2)), (1, 3, 3) = 2*k*x/(4+k*(x^2+y^2+z^2)), (1, 4, 1) = (1/2)*(diff(a(t), t))/a(t), (2, 1, 1) = 2*k*y/(4+k*(x^2+y^2+z^2)), (2, 1, 2) = -2*k*x/(4+k*(x^2+y^2+z^2)), (2, 2, 1) = -2*k*x/(4+k*(x^2+y^2+z^2)), (2, 2, 2) = -2*k*y/(4+k*(x^2+y^2+z^2)), (2, 2, 3) = -2*k*z/(4+k*(x^2+y^2+z^2)), (2, 2, 4) = (1/2)*(diff(a(t), t))/a(t), (2, 3, 2) = -2*k*z/(4+k*(x^2+y^2+z^2)), (2, 3, 3) = 2*k*y/(4+k*(x^2+y^2+z^2)), (2, 4, 2) = (1/2)*(diff(a(t), t))/a(t), (3, 1, 1) = 2*k*z/(4+k*(x^2+y^2+z^2)), (3, 1, 3) = -2*k*x/(4+k*(x^2+y^2+z^2)), (3, 2, 2) = 2*k*z/(4+k*(x^2+y^2+z^2)), (3, 2, 3) = -2*k*y/(4+k*(x^2+y^2+z^2)), (3, 3, 1) = -2*k*x/(4+k*(x^2+y^2+z^2)), (3, 3, 2) = -2*k*y/(4+k*(x^2+y^2+z^2)), (3, 3, 3) = -2*k*z/(4+k*(x^2+y^2+z^2)), (3, 3, 4) = (1/2)*(diff(a(t), t))/a(t), (3, 4, 3) = (1/2)*(diff(a(t), t))/a(t), (4, 1, 1) = 8*(diff(a(t), t))/(4+k*(x^2+y^2+z^2))^2, (4, 2, 2) = 8*(diff(a(t), t))/(4+k*(x^2+y^2+z^2))^2, (4, 3, 3) = 8*(diff(a(t), t))/(4+k*(x^2+y^2+z^2))^2}

(6)

The same applies to the Ricci, Riemann, Einstein and Weyl tensors.

NULL


 

Download ChristoffelSymbols.mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

Before converting, try > v; and you see it comes out with a and b, not 3 and 4; ditto if you > lprint(v). I'm not debating that, only noting that convert is just converting v, therefore also returning with a and b. What you expected (albeit reasonable for me) would require an additional full evaluation of 'v' that would be incorrect generally speaking.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

1) In general, simplify does not apply the function's symmetry - that is left for the function evaluation to do. To code the function's symmetry in two place wouldn't be a good idea. Alternatively, one could think "evaluate all the functions before simplifying". so that simplify(subs(z = -z, erf(z))) would arrive at simplify as erf(-z), then evaluate the function, then attempt simplifying what resulted from the function's evaluation. Something to think about. Regarding why it works for sin and a couple of others: it is only for historical reasons, when the function's symmetry was not automatically applied by a call to the function; then for compatibility reasons, that functionality within simplify - e.g. for mapping sin(-z) -> -sin(z) was left in place.

2) This is not an 'assuming' issue, actually also not a simplify issue, but one related to the interaction between signum and is. I will pass this problem to the person who takes care of that.

3) Again, this is not an assuming issue. Try assume(x(0) > 0) and you see the same error message. I know, not everybody is familiar with the internals of the "assuming" command. Mainly: it performs some manipulation on the input expression only to "unveil" what the expression is - the expression is not evaluated during this process, only unveiled, e.g. if A := B, then occurrences of A are replaced by B. Then the variables that are involved in the assumptions placed are replaced by equivalent local ones, a call to assume with the replaced variables is performed, and only then the expression passed, unveiled and rewritten is fully evaluated. Finally, the tables of information within assume and is/coulditbe are restored to their original values before performing the computation. That is why a call to assuming is equivalent to first call assume, then compute, then unassume the assumed variables. Actually the call the assuming is cleaner.

4) Applying simplify (constant and some others) to factors; this is done in several places. Also within simplify/constant. In this case, however, simplify detects that the whole expression is not constant, then it doesn't call simplify/constant  at all ... while it should: one of the factors is indeed a constant. As you say, this is a matter of making use of simplify/constant more aggressively. I'm annotating this one too.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

Illuminates,

In your Setup you indicated spaceindices = lowercaselatin (these run from 1 to 3) but the expression you sent to Simplify has greek spacetime indices (these run from 1 to 4). If what you want is to sum from 1 to 3 you need to use spaceindices, not spacetimeindices. Also, you use a LeviCivita with 4 indices (generally speaking, that is a spacetime LeviCivita, not a space LeviCivita that would have 3 indices).

If after adjusting your input taking the above into account you see something you find problematic could you please post the adjusted input / output within a worksheet (please indicate the Maple version you are using?) and I will give it a look .

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

 

restart

with(Physics); Setup(mathematicalnotation = true, coordinatesystems = cartesian)

`Default differentiation variables for d_, D_ and dAlembertian are: `*{X = (x, y, z, t)}

 

`Systems of spacetime Coordinates are: `*{X = (x, y, z, t)}

 

[coordinatesystems = {X}, mathematicalnotation = true]

(1)

Regarding your first question, If you want t in first place, note the signature

Setup(signature)

[signature = `- - - +`]

(2)

I.e.: by default time is in 4th place. Change the signature and set the coordinates again to have this change taken into account for the coordinates

Setup(signature = `+---`, coordinates = cartesian)

`* Partial match of  'coordinates' against keyword 'coordinatesystems'`

 

`Default differentiation variables for d_, D_ and dAlembertian are: `*{X = (t, x, y, z)}

 

`Systems of spacetime Coordinates are: `*{X = (t, x, y, z)}

 

[coordinatesystems = {X}, signature = `+ - - -`]

(3)

Regarding your alias: you don't need it (see the message above), X is already an alias to t,x,y,z, the alias is placed by the package when you set coordinates (you would need it if you do not set coordinates). So,

X[1], X[4]

t, z

(4)

Next question: after your change in the signature, d_[4] is now d_[z], not d_[t], and d_[1] is now d_[t]. Because a computer starts counting at 1, the signature (- - - +) is frequently more convenient than (+ - - -) where "position 1" is referred with 0, "position 2" with 1 and so on.

 

Anyway you can set the signature to any of (- - - +), (+ - - -), (+ + + -) or (- + + +) and all the Physics commands (and formulas that depend on the signature, e.g. for the algebra of Dirac matrices) will follow your choice of signature.

 

Maybe helpful: to avoid having to remember the position of time, you can always use the Setup option usecoordinatesastensorindices

Setup(usecoordinatesastensorindices = true)

[usecoordinatesastensorindices = true]

(5)

So now you an index with numbers (then remember that the ordering 0,1,2,3 is associated to positions 1,2,3,4) or directly with coordinates (and then you do not need to worry with positions)

d_[mu](f(X))

Physics:-d_[mu](f(X), [X])

(6)

TensorArray(Physics[d_][mu](f(X), [X]))

Array(%id = 18446744078310916694)

(7)

%d_[t](f(X)) = %d_[1](f(X))

%d_[t](f(X)) = %d_[1](f(X))

(8)

value(%d_[t](f(X)) = %d_[1](f(X)))

Physics:-diff(f(X), t) = Physics:-diff(f(X), t)

(9)

On how to compute a divergence, of a tensor A[mu],

Define(A[mu])

`Defined as tensors`

 

{A[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(10)

just input it

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

Physics:-d_[mu](A[`~mu`](X), [X])

(11)

Note: you can, but you do not need to specify that one of the indices is contravariant, the system will automatically set one of them contravariant whenever the index is contracted. If you indicate which one, then that choice is respected.

 

To perform the sum over repeated indices,

SumOverRepeatedIndices(Physics[d_][mu](A[`~mu`](X), [X]))

diff(A[`~1`](X), t)+diff(A[`~2`](X), x)+diff(A[`~3`](X), y)+diff(A[`~4`](X), z)

(12)

Note: there is a distinction between a tensorial expression with repeated indices and the actual summation it implies. If we were to perform the summation automatically we would not be able to represent a contraction. So, (11) represents this contraction, with all its mathematical properties understood by the system, while (12) is the summation performed.

 

For your next question, SumOverRepeatedIndices is the command that performs the summation, but your question is more general: consider

g_[mu, nu]*A[nu]

A[nu]*Physics:-g_[mu, `~nu`]

(13)

You can always simplify the contracted indices, as in

Simplify(A[nu]*Physics[g_][mu, `~nu`])

A[mu]

(14)

But you may want a command that "performs the contraction" meaning that it actually performs this simplification of contracted indices. Yes that command exists, it is the `.` operator, so instead of multiplying with `*`, do it with `.`. Compare left-hand side (using `*` as a blank space) with right-hand side (using `.`)

g_[mu, nu]*A[nu] = g_[mu, nu].A[nu]

A[nu]*Physics:-g_[mu, `~nu`] = A[mu]

(15)

Finally, you ask how to transform free indices into repeated ones: you do that the same way you do it with paper and pencil: contracting with the metric. For instance

Define(F)

`Defined objects with tensor properties`

 

{F, A[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(16)

F[mu, nu] = d_[mu](A[nu](X))

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

(17)

g_[mu, nu]*(F[mu, nu] = Physics[d_][mu](A[nu](X), [X]))

F[mu, nu]*Physics:-g_[`~mu`, `~nu`] = Physics:-d_[mu](A[nu](X), [X])*Physics:-g_[`~mu`, `~nu`]

(18)

Simplify(%)

F[`~nu`, nu] = Physics:-d_[`~nu`](A[nu](X), [X])

(19)

Or you can directly use `.`

g_[mu, nu].(F[mu, nu] = Physics[d_][mu](A[nu](X), [X]))

F[nu, `~nu`] = Physics:-d_[nu](A[`~nu`](X), [X])

(20)

Alternatively you may want to use the SubstituteTensorIndices command (will substitute both covariant and contravariant indices automatically)

SubstituteTensorIndices(mu = nu, F[mu, nu] = Physics[d_][mu](A[nu](X), [X]))

F[nu, `~nu`] = Physics:-d_[nu](A[`~nu`](X), [X])

(21)

``


 

Download ContractionOfIndices.mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations, Mathematical Functions


 

with(PDEtools)

PDE := b1(x, y)*(diff(u(x, y), x))+b2(x, y)*(diff(u(x, y), y)) = 0

b1(x, y)*(diff(u(x, y), x))+b2(x, y)*(diff(u(x, y), y)) = 0

(1)

Consider a point symmetry (that is what Stephani's book discuss at the beginning)

X := ([`ξ__x`, `ξ__y`, eta])(x, y, u)

[xi__x(x, y, u), xi__y(x, y, u), eta(x, y, u)]

(2)

The form of the infinitesimal generator with its first prolongation, not expanded, is

G := InfinitesimalGenerator(X, u(x, y), prolongation = 1)

proc (f) options operator, arrow; add(xi[x[j]]*(diff(f, x[j])), j = 1 .. 2)+add(eta[u[m]]*(diff(f, u[m]))+eta[u[m], [x]]*(diff(f, u[m][x]))+eta[u[m], [y]]*(diff(f, u[m][y])), m = 1 .. 1) end proc

(3)

To see it expanded, add the word expanded after indicating the prolongation.

 

Use a compact display for everything

declare(X, PDE)

` eta`(x, y, u)*`will now be displayed as`*eta

 

` xi__x`(x, y, u)*`will now be displayed as`*xi__x

 

` xi__y`(x, y, u)*`will now be displayed as`*xi__y

 

` b1`(x, y)*`will now be displayed as`*b1

 

` b2`(x, y)*`will now be displayed as`*b2

 

` u`(x, y)*`will now be displayed as`*u

(4)

Rewrite PDE in jet notation

pde := ToJet(PDE, u(x, y))

b1(x, y)*u[x]+b2(x, y)*u[y] = 0

(5)

lprint(%)

b1(x, y)*u[x]+b2(x, y)*u[y] = 0

 

 

Apply now the infinitesimal generator to obtain the "determining system"

G(b1(x, y)*u[x]+b2(x, y)*u[y] = 0)

xi__x(x, y, u)*((diff(b1(x, y), x))*u[x]+(diff(b2(x, y), x))*u[y])+xi__y(x, y, u)*((diff(b1(x, y), y))*u[x]+(diff(b2(x, y), y))*u[y])+(-(diff(xi__x(x, y, u), u))*u[x]^2-(diff(xi__y(x, y, u), u))*u[x]*u[y]+u[x]*(diff(eta(x, y, u), u))-(diff(xi__x(x, y, u), x))*u[x]-(diff(xi__y(x, y, u), x))*u[y]+diff(eta(x, y, u), x))*b1(x, y)+(-(diff(xi__x(x, y, u), u))*u[x]*u[y]-(diff(xi__y(x, y, u), u))*u[y]^2-(diff(xi__x(x, y, u), y))*u[x]-(diff(xi__y(x, y, u), y))*u[y]+u[y]*(diff(eta(x, y, u), u))+diff(eta(x, y, u), y))*b2(x, y) = 0

(6)

This result is linear in b1 and b2 but this is not really the determining system, because you still need to take this equation "modulo the PDE". So the next step is

isolate(pde, u[x])

u[x] = -b2(x, y)*u[y]/b1(x, y)

(7)

followed by substituting, and the result will not be linear in b1 and b2 anymore. If you want to see the determining system before taking it modulo the PDE, use the option moduloPDESYS = false of DeterminingPDE

 

DeterminingPDE(PDE, u(x, y), X, moduloPDESYS = false)

{(-u[x]^2*b1(x, y)-u[x]*u[y]*b2(x, y))*(diff(xi__x(x, y, u), u))+(-u[x]*u[y]*b1(x, y)-u[y]^2*b2(x, y))*(diff(xi__y(x, y, u), u))+(b1(x, y)*u[x]+b2(x, y)*u[y])*(diff(eta(x, y, u), u))-b1(x, y)*(diff(xi__x(x, y, u), x))*u[x]-(diff(xi__x(x, y, u), y))*b2(x, y)*u[x]-b1(x, y)*(diff(xi__y(x, y, u), x))*u[y]-(diff(xi__y(x, y, u), y))*b2(x, y)*u[y]+b1(x, y)*(diff(eta(x, y, u), x))+(diff(eta(x, y, u), y))*b2(x, y)+xi__x(x, y, u)*(diff(b1(x, y), x))*u[x]+xi__y(x, y, u)*(diff(b1(x, y), y))*u[x]+u[y]*(xi__y(x, y, u)*(diff(b2(x, y), y))+(diff(b2(x, y), x))*xi__x(x, y, u))}

(8)

You see by eye that this expression is linear in b1, b2 and its derivatives

select(has, indets({(-u[x]^2*b1(x, y)-u[x]*u[y]*b2(x, y))*(diff(xi__x(x, y, u), u))+(-u[x]*u[y]*b1(x, y)-u[y]^2*b2(x, y))*(diff(xi__y(x, y, u), u))+(b1(x, y)*u[x]+b2(x, y)*u[y])*(diff(eta(x, y, u), u))-b1(x, y)*(diff(xi__x(x, y, u), x))*u[x]-(diff(xi__x(x, y, u), y))*b2(x, y)*u[x]-b1(x, y)*(diff(xi__y(x, y, u), x))*u[y]-(diff(xi__y(x, y, u), y))*b2(x, y)*u[y]+b1(x, y)*(diff(eta(x, y, u), x))+(diff(eta(x, y, u), y))*b2(x, y)+xi__x(x, y, u)*(diff(b1(x, y), x))*u[x]+xi__y(x, y, u)*(diff(b1(x, y), y))*u[x]+u[y]*(xi__y(x, y, u)*(diff(b2(x, y), y))+(diff(b2(x, y), x))*xi__x(x, y, u))}, function), {b1, b2})

{b1(x, y), b2(x, y), diff(b1(x, y), x), diff(b1(x, y), y), diff(b2(x, y), x), diff(b2(x, y), y)}

(9)

degree({(-u[x]^2*b1(x, y)-u[x]*u[y]*b2(x, y))*(diff(xi__x(x, y, u), u))+(-u[x]*u[y]*b1(x, y)-u[y]^2*b2(x, y))*(diff(xi__y(x, y, u), u))+(b1(x, y)*u[x]+b2(x, y)*u[y])*(diff(eta(x, y, u), u))-b1(x, y)*(diff(xi__x(x, y, u), x))*u[x]-(diff(xi__x(x, y, u), y))*b2(x, y)*u[x]-b1(x, y)*(diff(xi__y(x, y, u), x))*u[y]-(diff(xi__y(x, y, u), y))*b2(x, y)*u[y]+b1(x, y)*(diff(eta(x, y, u), x))+(diff(eta(x, y, u), y))*b2(x, y)+xi__x(x, y, u)*(diff(b1(x, y), x))*u[x]+xi__y(x, y, u)*(diff(b1(x, y), y))*u[x]+u[y]*(xi__y(x, y, u)*(diff(b2(x, y), y))+(diff(b2(x, y), x))*xi__x(x, y, u))}[1], {b1(x, y), b2(x, y), diff(b1(x, y), x), diff(b1(x, y), y), diff(b2(x, y), x), diff(b2(x, y), y)})

1

(10)

But you cannot use this system (8) to compute symmetries - for that purpose you need to use moduloPDESYS = true (that is the default value when you do not specify it), so you get

DeterminingPDE(PDE, X)

{diff(eta(x, y, u), x) = -(diff(eta(x, y, u), y))*b2(x, y)/b1(x, y), diff(xi__y(x, y, u), x) = (xi__x(x, y, u)*(diff(b2(x, y), x))*b1(x, y)-xi__x(x, y, u)*(diff(b1(x, y), x))*b2(x, y)+xi__y(x, y, u)*(diff(b2(x, y), y))*b1(x, y)-xi__y(x, y, u)*(diff(b1(x, y), y))*b2(x, y)+(diff(xi__x(x, y, u), x))*b1(x, y)*b2(x, y)+(diff(xi__x(x, y, u), y))*b2(x, y)^2-(diff(xi__y(x, y, u), y))*b1(x, y)*b2(x, y))/b1(x, y)^2}

(11)

Or in collected forms

collect(%, {b1, b2})

{diff(eta(x, y, u), x) = -(diff(eta(x, y, u), y))*b2(x, y)/b1(x, y), diff(xi__y(x, y, u), x) = ((diff(xi__x(x, y, u), x)-(diff(xi__y(x, y, u), y)))*b2(x, y)+xi__y(x, y, u)*(diff(b2(x, y), y))+(diff(b2(x, y), x))*xi__x(x, y, u))/b1(x, y)+((diff(xi__x(x, y, u), y))*b2(x, y)^2+(-xi__x(x, y, u)*(diff(b1(x, y), x))-xi__y(x, y, u)*(diff(b1(x, y), y)))*b2(x, y))/b1(x, y)^2}

(12)

collect(%, {`ξ__x`, `ξ__y`, eta})

{diff(eta(x, y, u), x) = -(diff(eta(x, y, u), y))*b2(x, y)/b1(x, y), diff(xi__y(x, y, u), x) = ((diff(b2(x, y), x))/b1(x, y)-(diff(b1(x, y), x))*b2(x, y)/b1(x, y)^2)*xi__x(x, y, u)+((diff(b2(x, y), y))/b1(x, y)-b2(x, y)*(diff(b1(x, y), y))/b1(x, y)^2)*xi__y(x, y, u)+(diff(xi__x(x, y, u), x)-(diff(xi__y(x, y, u), y)))*b2(x, y)/b1(x, y)+(diff(xi__x(x, y, u), y))*b2(x, y)^2/b1(x, y)^2}

(13)

Now, for the purpose of comparing with a textbook, note that Determining PDE not just computes the determining system but also simplifies it with respect to its integrability conditions. You may want to ask to not do that simplification passing the optional argument integrabilityconditions = false. In any case, there is no hope you can solve this PDE, it is too general (like asking for the integral of f(x) without saying who is f.). In order to get a solution (via symmetries or not) you need to make b1 and b2 less general

 

Finally, note the main commands of the symmetry method: DeterminingPDE related to InfinitesimalGenerator, then Infinitesimals, then the set{SymmetryTransformation, SimilarityTransformation, InvariantTransformation}, and finally {SimilaritySolutions, SymmetrySolutions and InvariantSolutions}. The whole set of symmetry commands is listed in the help page of PDEtools as a separate table of links to all the help pages.

integrabilityconditions = false

(14)

PDE_easier := eval(PDE, {b1 = `+`, b2 = `-`})

(x+y)*(diff(u(x, y), x))+(x-y)*(diff(u(x, y), y)) = 0

(15)

This problem can be solved in general

pdsolve(PDE_easier)

u(x, y) = _F1(-1/(x^2-2*x*y-y^2)^(1/2))

(16)

pdetest(u(x, y) = _F1(-1/(x^2-2*x*y-y^2)^(1/2)), PDE_easier)

0

(17)

The determining PDE system for this form of point symmetry X

DeterminingPDE(PDE_easier, X)

{diff(eta(x, y, u), x) = -(diff(eta(x, y, u), y))*(x-y)/(x+y), diff(xi__y(x, y, u), x) = ((x-y)^2*(diff(xi__x(x, y, u), y))+(x^2-y^2)*(diff(xi__x(x, y, u), x))+(-x^2+y^2)*(diff(xi__y(x, y, u), y))-2*xi__y(x, y, u)*x+2*xi__x(x, y, u)*y)/(x+y)^2}

(18)

Corresponding infinitesimals can be computed by solving the system above or directly calling infinitesimals

Infinitesimals(PDE_easier, u(x, y), typeofsymmetry = evolutionary)

[_xi[x](x, y, u) = 0, _xi[y](x, y, u) = 0, _eta[u](x, y, u) = _F1(-1/(-x^2+2*x*y+y^2)^(1/2), u)]

(19)

You see the infinitesimals in evolutionary form are actually also a solution of the linear PDE, this is expected.

 

In typical situations (not this one) you may prefer to have the arbitrary functions entering the infinitesimals specialized, in order to do something with these infinitesimals

Infinitesimals(PDE_easier, u(x, y), typeofsymmetry = evolutionary, specialize_Fn)

[_xi[x](x, y, u) = 0, _xi[y](x, y, u) = 0, _eta[u](x, y, u) = 1], [_xi[x](x, y, u) = 0, _xi[y](x, y, u) = 0, _eta[u](x, y, u) = u], [_xi[x](x, y, u) = 0, _xi[y](x, y, u) = 0, _eta[u](x, y, u) = -1/(-x^2+2*x*y+y^2)^(1/2)]

(20)

``


 

Download DeterminingPDE.mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

This is explained in the corresponding FunctionAdvisor help pages, when introducing variables, in most cases it uses locals by default, and you can change that in a couple of ways by indicating which global variables you want it to use, for example add f(z) as the last argument, ie FunctionAdvisor(DE, hypergeom([a, b], [c], z), f(z)), and the output will use the global f in f(z).

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

Hi

I only noticed your question today. I answered a similar question in September. For convenience I copy here the contents:

There are algebraic capabilities suitable to represent matrix operations "without specifying the matrix elements" within the Physics package.

 

The main thing: you need to indicate which objects are noncommutative. Then you can perform the operations you mention, including factorization (with restrictions, since for noncommutative products this is nontrivial), taking coefficients, and also defining algebra rules.

 

To specify noncommutative operators you can do as below, or simply specify a noncommutative prefix, all this is explained in the help page for Physics:-Setup  

 

For example

with(Physics)

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

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

 

[quantumoperators = {A, B, C}]

(1)

Note that noncommutative objects are displayed in olive. You can change the color if you prefer (see Setup).  The input equation you show

A*B = C

Physics:-`*`(A, B) = C

(2)

  Inverse  is a Physics command for the same purpose you mention in your post

Inverse(A)*(Physics[`*`](A, B) = C)

B = Physics:-`*`(Physics:-Inverse(A), C)

(3)

An example about Factor

A*C+(Physics[`*`](A, B) = C)

Physics:-`*`(A, B)+Physics:-`*`(A, C) = C+Physics:-`*`(A, C)

(4)

Factor(Physics[`*`](A, B)+Physics[`*`](A, C) = C+Physics[`*`](A, C))

Physics:-`*`(A, B+C) = Physics:-`*`(A+1, C)

(5)

Inverse(A)*(Physics[`*`](A, B+C) = Physics[`*`](A+1, C))

B+C = Physics:-`*`(Physics:-Inverse(A), A+1, C)

(6)

 

An example using Simplify , for this you can also use Expand

Simplify(B+C = Physics[`*`](Physics[Inverse](A), A+1, C))

B+C = C+Physics:-`*`(Physics:-Inverse(A), C)

(7)

An example about Coefficients , note that it applies to both sides of an equation, and are returned ordered (first the coefficient of order 0, then of order 1, etc.), so for instance if (6) is equal to 0 for all values of C then the following two equations are true

Coefficients(B+C = Physics[`*`](Physics[Inverse](A), A+1, C), C)

B = 0, 1 = 1+Physics:-Inverse(A)

(8)

An example involving algebra rules without specifying components.

Setup(redo, %Commutator(Inverse(A), C) = B)

[algebrarules = {%Commutator(Physics:-Inverse(A), C) = B}]

(9)

Suppose now you want to reorder, in (7),  C/A  as C/A using the commutator algebra rule specified, so: sort the products in (7), using the order you want, making explicit use of any commutator rules available (set by you)

Library:-SortProducts(B+C = C+Physics[`*`](Physics[Inverse](A), C), [C, Inverse(A)], usecommutator)

B+C = C+Physics:-`*`(C, Physics:-Inverse(A))+B

(10)

This kind of operation allows for further manipulations, for instance

(B+C = C+Physics[`*`](C, Physics[Inverse](A))+B)-B

C = C+Physics:-`*`(C, Physics:-Inverse(A))

(11)

From where

(C = C+Physics[`*`](C, Physics[Inverse](A)))-C

0 = Physics:-`*`(C, Physics:-Inverse(A))

(12)

An so on.


 

Download Matrix_operations_without_specifying_components.mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

@kfli 

I see you trying to differentiate "with respect to a function". Have you see the Physics:-diff command? This seems to be the command you are looking for, and then you won't need alias, macros or freezing + thawing.

Note also that you can always use the long form Physics:-diff of this command, without having to load the Physics package for that.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions

Hi

Physics should know about the algebra of Dirac matrices without having to specify it. This is an old issue, mentioned in Mapleprimes a number of times, postponed several times. Other areas of the package are more in use and therefore call more the attention, which in my radar equals to a higher priority, not to mention that the work on differential equations and mathematical functions (several things also discussed here in Mapleprimes) take a significant part of the time.

Now, the way I designed this, Pascal is correct in both counts: regarding your original question, the algebra can be set as usual (he showed how), and regarding the second issue you presented afterward you should not expect to see an identity matrix around on the right-hand side. Within Physics and Physics:-Vectors, matrix representations are avoided as much as possible.

And why is that? Because the system does not compute as we do with paper and pencil with objects that are not of type 'algebraic' (eg matrix and Matrix), and also, when we compute with paper and pencil we frequently (not always, e.g wikipedia does not) omit an explicit identity matrix, eg we write AntiCommutator(Dgamma[mu], Dgamma[nu]) = 2*g_[mu, nu], without `II` representing an identity matrix - see for instance the reference of this project, page 81 of Landau's book "Quantum Electrodynamics", formulas (22.2) to (22.6).

Related to all this, I'm on the way of giving closure to the new StandardModel package, that is visible in Maple 2017 but unfinished. Setting the algebra for the Dirac and Pauli matrices automatically plus enhancements in the simplification of their products are part of this closure.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

This was a bug. It is fixed. The fix is available to everybody within the Physics updated library distributed at the Maplesoft R&D Physics webpage.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

Hi

Give a look please to the Physics:-Vectors package (entry point: the help page ?Physics,Vectors). From that help page and the one for dot product linked there, if I understand your question correctly, the answer is straightforward.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

First 28 29 30 31 32 33 34 Last Page 30 of 55