ecterrab

14540 Reputation

24 Badges

20 years, 22 days

MaplePrimes Activity


These are answers submitted by ecterrab

Hi

Yes, it is possible to calculate the energy momentum in the Physics package. Incidentally I showed this in the IOP webinar on the Physics package, Below I am reproducing from there, then showing a new command Physics:-EnergyMoment

 

So suppose, for instance, that you have the Tolman metric loaded,

restart; with(Physics); g_[tol]

`Systems of spacetime Coordinates are: `*{X = (r, theta, phi, t)}

 

`Default differentiation variables for d_, D_ and dAlembertian are: `*{X = (r, theta, phi, t)}

 

`The Tolman metric in coordinates `[r, theta, phi, t]

 

`Parameters: `[R(t, r), E(r)]

 

g[mu, nu] = (Matrix(4, 4, {(1, 1) = -(diff(R(t, r), r))^2/(1+2*E(r)), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 2) = -R(t, r)^2, (2, 3) = 0, (2, 4) = 0, (3, 3) = -R(t, r)^2*sin(theta)^2, (3, 4) = 0, (4, 4) = 1}, storage = triangular[upper], shape = [symmetric]))

(1)

Here CompactDisplay is a new Physics faciliity command  (for now just forwarding to PDEtools:-declare)

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

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

 

R(t, r)*`will now be displayed as`*R

(2)

and now you want to compute the energy momentum tensor. You know, it is eq

T[mu, nu] = Physics:-`*`(Einstein[mu, nu], Physics:-`^`(Physics:-`*`(8, Pi), -1))

T[mu, nu] = (1/8)*Physics:-Einstein[mu, nu]/Pi

(3)

where the right-hand side is a tensor, but the left-hand side is just some indexed object.

OK, tell the system the left-hand side is also a tensor whose components are given by the right-hand side:

Physics:-Define(T[mu, nu] = (1/8)*Physics:-Einstein[mu, nu]/Pi)

`Defined objects with tensor properties`

 

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

(4)

So now `T__μ,ν` is a tensor, and so all the facilites for working with tensors are there:

T[definition]

T[mu, nu] = (1/8)*Physics:-Einstein[mu, nu]/Pi

(5)

and these give you the covariant and contravariant components (derivatives of R and E appear indexed because of using CompactDisplay)

T[]

T[mu, nu] = Matrix(%id = 18446744078380085366)

(6)

"T[~]"

T[`~mu`, `~nu`] = Matrix(%id = 18446744078380064150)

(7)

And in that way you can set not just the EnergyMomentum tensor but actually any tensor that passes through your mind: right an equation with the tensor's definition on the right-hand side and call Physics:-Define. Everything else follows automatically.

 

But as said I added a new command, EnergyMomentum, so that when you load Physics the command is there:

EnergyMomentum[definition]

Physics:-EnergyMomentum[mu, nu] = (1/8)*Physics:-Einstein[mu, nu]/Pi

(8)

(Note the display, it is visually slightly different than the letter T used above to define the same tensor manually.)

 

Now: because EnergyMomentum is part of the Physics package, its conversion routines know about it:

EnergyMomentum[mu, nu]

Physics:-EnergyMomentum[mu, nu]

(9)

Physics:-EnergyMomentum[mu, nu] = convert(Physics:-EnergyMomentum[mu, nu], Einstein, evaluatetrace = false)

Physics:-EnergyMomentum[mu, nu] = (1/8)*Physics:-Einstein[mu, nu]/Pi

(10)

Physics:-EnergyMomentum[mu, nu] = convert(Physics:-EnergyMomentum[mu, nu], Ricci, evaluatetrace = false)

Physics:-EnergyMomentum[mu, nu] = (1/8)*(Physics:-Ricci[mu, nu]-(1/2)*Physics:-g_[mu, nu]*Physics:-Ricci[alpha, `~alpha`])/Pi

(11)

Physics:-EnergyMomentum[mu, nu] = convert(Physics:-EnergyMomentum[mu, nu], Christoffel, evaluatetrace = false)

Physics:-EnergyMomentum[mu, nu] = (1/8)*(Physics:-d_[beta](Physics:-Christoffel[`~beta`, mu, nu], [X])-Physics:-d_[nu](Physics:-Christoffel[`~beta`, beta, mu], [X])+Physics:-Christoffel[`~kappa`, mu, nu]*Physics:-Christoffel[`~beta`, beta, kappa]-Physics:-Christoffel[`~kappa`, beta, mu]*Physics:-Christoffel[`~beta`, kappa, nu]-(1/2)*Physics:-g_[mu, nu]*Physics:-Ricci[alpha, `~alpha`])/Pi

(12)

Physics:-EnergyMomentum[mu, nu] = convert(Physics:-EnergyMomentum[mu, nu], g_, evaluatetrace = false)

Physics:-EnergyMomentum[mu, nu] = (1/8)*((1/2)*Physics:-d_[beta](Physics:-g_[`~beta`, `~upsilon`], [X])*(Physics:-d_[nu](Physics:-g_[mu, upsilon], [X])+Physics:-d_[mu](Physics:-g_[nu, upsilon], [X])-Physics:-d_[upsilon](Physics:-g_[mu, nu], [X]))+(1/2)*Physics:-g_[`~beta`, `~upsilon`]*(Physics:-d_[beta](Physics:-d_[nu](Physics:-g_[mu, upsilon], [X]), [X])+Physics:-d_[beta](Physics:-d_[mu](Physics:-g_[nu, upsilon], [X]), [X])-Physics:-d_[beta](Physics:-d_[upsilon](Physics:-g_[mu, nu], [X]), [X]))-(1/2)*Physics:-d_[nu](Physics:-g_[`~beta`, `~sigma`], [X])*Physics:-d_[mu](Physics:-g_[beta, sigma], [X])-(1/2)*Physics:-g_[`~beta`, `~sigma`]*Physics:-d_[nu](Physics:-d_[mu](Physics:-g_[beta, sigma], [X]), [X])+(1/4)*Physics:-g_[`~kappa`, `~psi`]*(Physics:-d_[nu](Physics:-g_[mu, psi], [X])+Physics:-d_[mu](Physics:-g_[nu, psi], [X])-Physics:-d_[psi](Physics:-g_[mu, nu], [X]))*Physics:-g_[`~beta`, `~lambda`]*Physics:-d_[kappa](Physics:-g_[beta, lambda], [X])-(1/4)*Physics:-g_[`~chi`, `~kappa`]*(Physics:-d_[mu](Physics:-g_[beta, chi], [X])+Physics:-d_[beta](Physics:-g_[chi, mu], [X])-Physics:-d_[chi](Physics:-g_[beta, mu], [X]))*Physics:-g_[`~beta`, `~tau`]*(Physics:-d_[nu](Physics:-g_[kappa, tau], [X])+Physics:-d_[kappa](Physics:-g_[nu, tau], [X])-Physics:-d_[tau](Physics:-g_[kappa, nu], [X]))-(1/2)*Physics:-g_[mu, nu]*Physics:-Ricci[alpha, `~alpha`])/Pi

(13)

Also, you know this definition depends on the value of the cosmological constant, that in Physics by default it is set to 0, but one may want to use a value different from zero. You can set that using Setup. Check first the current value

Physics:-Setup(cosmo)

`* Partial match of  'cosmo' against keyword 'cosmologicalconstant'`

 

[cosmologicalconstant = 0]

(14)

Set it to - say - Lambda (could be any algebraic expression)

Physics:-Setup(cosmo = Lambda)

`* Partial match of  'cosmo' against keyword 'cosmologicalconstant'`

 

[cosmologicalconstant = Lambda]

(15)

Try again the definition and conversions:

EnergyMomentum[definition]

Physics:-EnergyMomentum[mu, nu] = (1/8)*(Lambda*Physics:-g_[mu, nu]+Physics:-Einstein[mu, nu])/Pi

(16)

Physics:-EnergyMomentum[mu, nu] = convert(Physics:-EnergyMomentum[mu, nu], Ricci, evaluatetrace = false)

Physics:-EnergyMomentum[mu, nu] = (1/8)*(Lambda*Physics:-g_[mu, nu]+Physics:-Ricci[mu, nu]-(1/2)*Physics:-g_[mu, nu]*Physics:-Ricci[alpha, `~alpha`])/Pi

(17)

``


Download EnergyMomentum.mw

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

Hi

Without further details, yes, you can formulate and perform the simulations you are mentioning. The question is then what would be an easy entry point for someone who has not used computer algebra before. Such an entry point could be the "Mini-Course: Computer Algebra for Physicists", where the first 5 sections are about Maple 101, and the last 5 about Physics and examples in different physics areas.

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

This gives you the indeterminates

> du := indets(pd2, specindex(u));

This gives you the coefficients you are asking

> coeffs(expand(pd2[1]), du);

If what you intended to do is actually "collecting" the coefficients, as in using the collect command, then

> collect(pd2[1], du);

If you want u(x, t), represented by u after your call to Tojet, to also be considered a collecting variabile (say as the derivative of order 0), so to be included in du, then when you construct pd2 by calling ToJet, use the optional argument notation = jetvariableswithbrackets.

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

Hi Suresh

Maple R5 is from 1997 ... it does not run in current machines (not in the macs I use).

The only solution I could see to your problem is for you to update to current Maple: the latest Maple 2016 or closer - and also update the package: the old 'tensor' you are using is deprecated, not maintained since years, and its functionality superseded by both the Physics and DifferentialGeometry packages, the latter including the spinor formalism you are interested in.

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


Example with the `Schwarzschild metric`

with(Physics)

Set the metric and coordinates in one go (you could use Setup, but this is just faster)

g_[sc]

`Systems of spacetime Coordinates are: `*{X = (r, theta, phi, t)}

 

`Default differentiation variables for d_, D_ and dAlembertian are: `*{X = (r, theta, phi, t)}

 

`The Schwarzschild metric in coordinates `[r, theta, phi, t]

 

`Parameters: `[m]

 

g[mu, nu] = (Matrix(4, 4, {(1, 1) = r/(-r+2*m), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 2) = -r^2, (2, 3) = 0, (2, 4) = 0, (3, 3) = -r^2*sin(theta)^2, (3, 4) = 0, (4, 4) = (r-2*m)/r}, storage = triangular[upper], shape = [symmetric]))

(1)

The Weyl scalars are there

Weyl[scalars]

psi__0 = 0, psi__1 = 0, psi__2 = -m/r^3, psi__3 = 0, psi__4 = 0

(2)

The definition

Weyl[scalarsdefinition]

psi__0 = -Physics:-Weyl[`~mu`, `~nu`, `~alpha`, `~beta`]*Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-m_[nu]*Physics:-Tetrads:-l_[alpha]*Physics:-Tetrads:-m_[beta], psi__1 = -Physics:-Weyl[`~mu`, `~nu`, `~alpha`, `~beta`]*Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-n_[nu]*Physics:-Tetrads:-l_[alpha]*Physics:-Tetrads:-m_[beta], psi__2 = -Physics:-Weyl[`~mu`, `~nu`, `~alpha`, `~beta`]*Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-m_[nu]*Physics:-Tetrads:-mb_[alpha]*Physics:-Tetrads:-n_[beta], psi__3 = -Physics:-Weyl[`~mu`, `~nu`, `~alpha`, `~beta`]*Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-n_[nu]*Physics:-Tetrads:-mb_[alpha]*Physics:-Tetrads:-n_[beta], psi__4 = -Physics:-Weyl[`~mu`, `~nu`, `~alpha`, `~beta`]*Physics:-Tetrads:-n_[mu]*Physics:-Tetrads:-mb_[nu]*Physics:-Tetrads:-n_[alpha]*Physics:-Tetrads:-mb_[beta]

(3)

Supose you change the metric, say change r in 1/r in (1)

simplify(subs(r = 1/r, g[mu, nu] = (Matrix(4, 4, {(1, 1) = r/(-r+2*m), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 2) = -r^2, (2, 3) = 0, (2, 4) = 0, (3, 3) = -r^2*sin(theta)^2, (3, 4) = 0, (4, 4) = (r-2*m)/r}, storage = triangular[upper], shape = [symmetric]))))

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

(4)

Set this as the new metric

"Setup(?)"

[metric = {(1, 1) = 1/(2*m*r-1), (2, 2) = -1/r^2, (3, 3) = -sin(theta)^2/r^2, (4, 4) = -2*m*r+1}]

(5)

The Weyl scalars for this new metric

Weyl[scalars]

psi__0 = 0, psi__1 = 0, psi__2 = (1/6)*(-r^4-1)/r^2, psi__3 = 0, psi__4 = 0

(6)

``

For the spin formalism you may want to give a look at the DifferentialGeometry[Tensor][NPSpinCoefficients]  command


Download WeylScalars.mw

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

Hi

This question is already answered ; as explained there this issue is resolved in Maple 2016 (without further updates) and also Maple 215 (installing the update mentioned in that answer given),

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

Both the DifferentialGeometry and Physics packages have commands for computing Lie derivatives, check for instance the help pages for Physics:-LieDerivative and DifferentialGeometry:-LieDerivative.

Edgardo S. Cheb-Terrab 

Physics, Differential Equations and Mathematical Functions, Maplesoft

Dear Ogilvie
This new feature, FunctionAdvisor(plot, ...), as any other Maple feature, is part of an alive project, in this case, the one of bringing visualization to the mathematical functions.

My approach for these visualizations - plots -  was/is

  1. have in Maple 2016 all those shown in the Digital Library of Mathematical Functions (NIST-DLMF) for functions that do exist in Maple;
  2. add to that plots showing branch cuts when it is the case and are not present in 1.;
  3. add to that when appropriate for other reasons (mainly periodicity or symmetry).

For Maple 2016 we finished 1. for functions that do exist in Maple. And I am very happy with the result, a really nice step forward. Incidentally, regarding your actual question, note that there are no plots for the Heun functions in the NIST-DLMF.

Independent of that, we already started moving with 2. and 3. and, as usual, these further developments are posted every week to everybody in the Maplesoft R&D webpage for Mathematical Functions and Differential Equations, together with the updates for Physics.

In brief, then, update your library with the one available in that web page and you will see your Maple 2016 FunctionAdvisor(plot, ...) displaying plots for all the Heun functions, including the HeunPrime ones, among other new developments.

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

This issue, related to the display of products, is resolved in Maple 2016, also in the update distributed on the web for Maple 2015, available from the Maplesoft R&D Physics webpage.

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


restart; with(PDEtools)

DepVars := [u(x, t), v(x, t), r[1](t), r[2](t), s[1](t), s[2](t), p[1](t), p[2](t), alpha[1](x, t), beta[1](x, t), beta[2](x, t), delta[1](x, t), delta[2](x, t)]

[u(x, t), v(x, t), r[1](t), r[2](t), s[1](t), s[2](t), p[1](t), p[2](t), alpha[1](x, t), beta[1](x, t), beta[2](x, t), delta[1](x, t), delta[2](x, t)]

(1)

alias(u = u(x, t), v = v(x, t), r[1] = r[1](t), r[2] = r[2](t), s[1] = s[1](t), s[2] = s[2](t), p[1] = p[1](t), p[2] = p[2](t), alpha[1] = alpha[1](x, t), beta[1] = beta[1](x, t), beta[2] = beta[2](x, t), delta[1] = delta[1](x, t), delta[2] = delta[2](x, t))

FA, `y'''''''`, `y''''''`, `y'''''`, `y''''`, `y'''`, `y''`, `y'`, u, v, r[1], r[2], s[1], s[2], p[1], p[2], alpha[1], beta[1], beta[2], delta[1], delta[2]

(2)

As you noticed, dcoeffs works with one variable. You can still use it in the case of many variables as follows: enclose your system between square brackets, to form a list of equations (even then there is only one of them) and remove dependent variables from denominators

map(numer, [(diff(r[1], t))*(-s[1]*u*(diff(u, x))-p[1]*((diff(u, x))*v+u*(diff(v, x)))-alpha[1]*(diff(u, x))-beta[1]*u-delta[1])/r[1]+r[1]*(diff(alpha[1]*(diff(u, x))+beta[1]*u+delta[1], x, x))+(diff(s[1], t))*u*(diff(u, x))+s[1]*(alpha[1]*(diff(u, x))+beta[1]*u+delta[1])*(diff(u, x))+s[1]*u*(diff(alpha[1]*(diff(u, x))+beta[1]*u+delta[1], x))+(diff(p[1], t))*((diff(u, x))*v+u*(diff(v, x)))+p[1]*((diff(alpha[1]*(diff(u, x))+beta[1]*u+delta[1], x))*v+(diff(u, x))*(alpha[1]*(diff(v, x))+beta[2]*v+delta[2])+(alpha[1]*(diff(u, x))+beta[1]*u+delta[1])*(diff(v, x))+u*(diff(alpha[1]*(diff(v, x))+beta[2]*v+delta[2], x)))+(diff(alpha[1], t))*(diff(u, x))+alpha[1]*(diff(alpha[1]*(diff(u, x))+beta[1]*u+delta[1], x))+(diff(beta[1], t))*u+beta[1]*(alpha[1]*(diff(u, x))+beta[1]*u+delta[1])+diff(delta[1], t)])

[u*alpha[1]*r[1]*(diff(beta[1], x))+(diff(u, x))*p[1]*r[1]*delta[2]+(diff(u, x))*v*r[1]*(diff(p[1], t))+2*(diff(u, x))*alpha[1]*beta[1]*r[1]+(diff(u, x))*alpha[1]*r[1]*(diff(alpha[1], x))+p[1]*v*r[1]*(diff(delta[1], x))+p[1]*(diff(v, x))*delta[1]*r[1]+s[1]*u^2*r[1]*(diff(beta[1], x))+s[1]*(diff(u, x))^2*alpha[1]*r[1]-(diff(r[1], t))*s[1]*u*(diff(u, x))-(diff(r[1], t))*u*p[1]*(diff(v, x))-(diff(r[1], t))*(diff(u, x))*p[1]*v+s[1]*u*r[1]*(diff(delta[1], x))+s[1]*(diff(u, x))*delta[1]*r[1]+(diff(s[1], t))*u*(diff(u, x))*r[1]+u*p[1]*r[1]*(diff(delta[2], x))+u*(diff(v, x))*r[1]*(diff(p[1], t))+u*r[1]^2*(diff(diff(beta[1], x), x))+(diff(u, x))*r[1]^2*(diff(diff(alpha[1], x), x))+2*(diff(u, x))*r[1]^2*(diff(beta[1], x))+alpha[1]^2*r[1]*(diff(diff(u, x), x))+alpha[1]*r[1]^2*(diff(diff(diff(u, x), x), x))+beta[1]*r[1]^2*(diff(diff(u, x), x))+2*r[1]^2*(diff(alpha[1], x))*(diff(diff(u, x), x))-(diff(r[1], t))*u*beta[1]-(diff(r[1], t))*(diff(u, x))*alpha[1]+(diff(beta[1], t))*u*r[1]+(diff(alpha[1], t))*(diff(u, x))*r[1]+alpha[1]*r[1]*(diff(delta[1], x))+beta[1]*delta[1]*r[1]+u*beta[1]^2*r[1]+r[1]^2*(diff(diff(delta[1], x), x))-(diff(r[1], t))*delta[1]+(diff(delta[1], t))*r[1]+2*s[1]*u*(diff(u, x))*beta[1]*r[1]+s[1]*u*(diff(u, x))*r[1]*(diff(alpha[1], x))+s[1]*u*alpha[1]*r[1]*(diff(diff(u, x), x))+u*p[1]*v*r[1]*(diff(beta[1], x))+u*p[1]*v*r[1]*(diff(beta[2], x))+u*p[1]*(diff(v, x))*beta[1]*r[1]+u*p[1]*(diff(v, x))*r[1]*(diff(alpha[1], x))+u*p[1]*(diff(v, x))*r[1]*beta[2]+u*p[1]*alpha[1]*r[1]*(diff(diff(v, x), x))+(diff(u, x))*p[1]*v*beta[1]*r[1]+(diff(u, x))*p[1]*v*r[1]*(diff(alpha[1], x))+(diff(u, x))*p[1]*v*r[1]*beta[2]+2*(diff(u, x))*p[1]*(diff(v, x))*alpha[1]*r[1]+p[1]*v*alpha[1]*r[1]*(diff(diff(u, x), x))]

(3)

Now initialize 'L', the list of coefficients, to be the system itself, and loop mapping dcoeffs with respect to each F in DepVars. To avoid long output, end the lop with `:`

L := [u*r[1]^2*(diff(diff(beta[1], x), x))+(diff(u, x))*r[1]^2*(diff(diff(alpha[1], x), x))+alpha[1]^2*r[1]*(diff(diff(u, x), x))+alpha[1]*r[1]^2*(diff(diff(diff(u, x), x), x))+beta[1]*r[1]^2*(diff(diff(u, x), x))-(diff(r[1], t))*u*beta[1]-(diff(r[1], t))*(diff(u, x))*alpha[1]+(diff(beta[1], t))*u*r[1]+(diff(alpha[1], t))*(diff(u, x))*r[1]+alpha[1]*r[1]*(diff(delta[1], x))+beta[1]*delta[1]*r[1]+u*beta[1]^2*r[1]+2*(diff(u, x))*r[1]^2*(diff(beta[1], x))+2*r[1]^2*(diff(alpha[1], x))*(diff(diff(u, x), x))+r[1]^2*(diff(diff(delta[1], x), x))-(diff(r[1], t))*delta[1]+(diff(delta[1], t))*r[1]+s[1]*u*(diff(u, x))*r[1]*(diff(alpha[1], x))+s[1]*u*alpha[1]*r[1]*(diff(diff(u, x), x))+u*p[1]*v*r[1]*(diff(beta[1], x))+u*p[1]*v*r[1]*(diff(beta[2], x))+u*p[1]*(diff(v, x))*beta[1]*r[1]+u*p[1]*(diff(v, x))*r[1]*(diff(alpha[1], x))+u*p[1]*(diff(v, x))*r[1]*beta[2]+u*p[1]*alpha[1]*r[1]*(diff(diff(v, x), x))+(diff(u, x))*p[1]*v*beta[1]*r[1]+(diff(u, x))*p[1]*v*r[1]*(diff(alpha[1], x))+(diff(u, x))*p[1]*v*r[1]*beta[2]+p[1]*v*alpha[1]*r[1]*(diff(diff(u, x), x))+2*s[1]*u*(diff(u, x))*beta[1]*r[1]+2*(diff(u, x))*p[1]*(diff(v, x))*alpha[1]*r[1]+u*alpha[1]*r[1]*(diff(beta[1], x))+(diff(u, x))*p[1]*r[1]*delta[2]+(diff(u, x))*v*r[1]*(diff(p[1], t))+(diff(u, x))*alpha[1]*r[1]*(diff(alpha[1], x))+p[1]*v*r[1]*(diff(delta[1], x))+p[1]*(diff(v, x))*delta[1]*r[1]+s[1]*u^2*r[1]*(diff(beta[1], x))+s[1]*(diff(u, x))^2*alpha[1]*r[1]-(diff(r[1], t))*s[1]*u*(diff(u, x))-(diff(r[1], t))*u*p[1]*(diff(v, x))-(diff(r[1], t))*(diff(u, x))*p[1]*v+s[1]*u*r[1]*(diff(delta[1], x))+s[1]*(diff(u, x))*delta[1]*r[1]+(diff(s[1], t))*u*(diff(u, x))*r[1]+u*p[1]*r[1]*(diff(delta[2], x))+u*(diff(v, x))*r[1]*(diff(p[1], t))+2*(diff(u, x))*alpha[1]*beta[1]*r[1]]

for F in DepVars do L := map(dcoeffs, L, F) end do

This is the result

L

[1, 1, 1, 2, 1, 1, 1, -1, 1, 1, 2, 2, -1, 1, 1, 1, 1, -1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1]

(4)

Alternatively, you can convert to Jet notation and use the standard coeffs Maple command

ToJet([u*r[1]^2*(diff(diff(beta[1], x), x))+(diff(u, x))*r[1]^2*(diff(diff(alpha[1], x), x))+alpha[1]^2*r[1]*(diff(diff(u, x), x))+alpha[1]*r[1]^2*(diff(diff(diff(u, x), x), x))+beta[1]*r[1]^2*(diff(diff(u, x), x))-(diff(r[1], t))*u*beta[1]-(diff(r[1], t))*(diff(u, x))*alpha[1]+(diff(beta[1], t))*u*r[1]+(diff(alpha[1], t))*(diff(u, x))*r[1]+alpha[1]*r[1]*(diff(delta[1], x))+beta[1]*delta[1]*r[1]+u*beta[1]^2*r[1]+2*(diff(u, x))*r[1]^2*(diff(beta[1], x))+2*r[1]^2*(diff(alpha[1], x))*(diff(diff(u, x), x))+r[1]^2*(diff(diff(delta[1], x), x))-(diff(r[1], t))*delta[1]+(diff(delta[1], t))*r[1]+s[1]*u*(diff(u, x))*r[1]*(diff(alpha[1], x))+s[1]*u*alpha[1]*r[1]*(diff(diff(u, x), x))+u*p[1]*v*r[1]*(diff(beta[1], x))+u*p[1]*v*r[1]*(diff(beta[2], x))+u*p[1]*(diff(v, x))*beta[1]*r[1]+u*p[1]*(diff(v, x))*r[1]*(diff(alpha[1], x))+u*p[1]*(diff(v, x))*r[1]*beta[2]+u*p[1]*alpha[1]*r[1]*(diff(diff(v, x), x))+(diff(u, x))*p[1]*v*beta[1]*r[1]+(diff(u, x))*p[1]*v*r[1]*(diff(alpha[1], x))+(diff(u, x))*p[1]*v*r[1]*beta[2]+p[1]*v*alpha[1]*r[1]*(diff(diff(u, x), x))+2*s[1]*u*(diff(u, x))*beta[1]*r[1]+2*(diff(u, x))*p[1]*(diff(v, x))*alpha[1]*r[1]+u*alpha[1]*r[1]*(diff(beta[1], x))+(diff(u, x))*p[1]*r[1]*delta[2]+(diff(u, x))*v*r[1]*(diff(p[1], t))+(diff(u, x))*alpha[1]*r[1]*(diff(alpha[1], x))+p[1]*v*r[1]*(diff(delta[1], x))+p[1]*(diff(v, x))*delta[1]*r[1]+s[1]*u^2*r[1]*(diff(beta[1], x))+s[1]*(diff(u, x))^2*alpha[1]*r[1]-(diff(r[1], t))*s[1]*u*(diff(u, x))-(diff(r[1], t))*u*p[1]*(diff(v, x))-(diff(r[1], t))*(diff(u, x))*p[1]*v+s[1]*u*r[1]*(diff(delta[1], x))+s[1]*(diff(u, x))*delta[1]*r[1]+(diff(s[1], t))*u*(diff(u, x))*r[1]+u*p[1]*r[1]*(diff(delta[2], x))+u*(diff(v, x))*r[1]*(diff(p[1], t))+2*(diff(u, x))*alpha[1]*beta[1]*r[1]][1], DepVars)

u^2*r[1]*s[1]*beta[1][x]+u*v*p[1]*r[1]*beta[1][x]+u*v*p[1]*r[1]*beta[2][x]+u*alpha[1]*p[1]*r[1]*v[x, x]+u*alpha[1]*r[1]*s[1]*u[x, x]+u*beta[1]*p[1]*r[1]*v[x]+2*u*beta[1]*r[1]*s[1]*u[x]+u*beta[2]*p[1]*r[1]*v[x]+u*p[1]*r[1]*v[x]*alpha[1][x]+u*r[1]*s[1]*u[x]*alpha[1][x]+v*alpha[1]*p[1]*r[1]*u[x, x]+v*beta[1]*p[1]*r[1]*u[x]+v*beta[2]*p[1]*r[1]*u[x]+v*p[1]*r[1]*u[x]*alpha[1][x]+2*alpha[1]*p[1]*r[1]*u[x]*v[x]+alpha[1]*r[1]*s[1]*u[x]^2+u*alpha[1]*r[1]*beta[1][x]+u*beta[1]^2*r[1]+u*p[1]*r[1]*delta[2][x]-u*p[1]*v[x]*r[1][t]+u*r[1]^2*beta[1][x, x]+u*r[1]*s[1]*delta[1][x]+u*r[1]*u[x]*s[1][t]+u*r[1]*v[x]*p[1][t]-u*s[1]*u[x]*r[1][t]+v*p[1]*r[1]*delta[1][x]-v*p[1]*u[x]*r[1][t]+v*r[1]*u[x]*p[1][t]+alpha[1]^2*r[1]*u[x, x]+2*alpha[1]*beta[1]*r[1]*u[x]+alpha[1]*r[1]^2*u[x, x, x]+alpha[1]*r[1]*u[x]*alpha[1][x]+beta[1]*r[1]^2*u[x, x]+delta[1]*p[1]*r[1]*v[x]+delta[1]*r[1]*s[1]*u[x]+delta[2]*p[1]*r[1]*u[x]+r[1]^2*u[x]*alpha[1][x, x]+2*r[1]^2*u[x]*beta[1][x]+2*r[1]^2*u[x, x]*alpha[1][x]-u*beta[1]*r[1][t]+u*r[1]*beta[1][t]+alpha[1]*r[1]*delta[1][x]-alpha[1]*u[x]*r[1][t]+beta[1]*delta[1]*r[1]+r[1]^2*delta[1][x, x]+r[1]*u[x]*alpha[1][t]-delta[1]*r[1][t]+r[1]*delta[1][t]

(5)

coeffs(beta[1]*delta[1]*r[1]+u*beta[1]^2*r[1]+r[1]^2*delta[1][x, x]-delta[1]*r[1][t]+r[1]*delta[1][t]+u*v*p[1]*r[1]*beta[1][x]+u*v*p[1]*r[1]*beta[2][x]+u*alpha[1]*p[1]*r[1]*v[x, x]+u*alpha[1]*r[1]*s[1]*u[x, x]+u*beta[1]*p[1]*r[1]*v[x]+u*beta[2]*p[1]*r[1]*v[x]+u*p[1]*r[1]*v[x]*alpha[1][x]+u*r[1]*s[1]*u[x]*alpha[1][x]+v*alpha[1]*p[1]*r[1]*u[x, x]+v*beta[1]*p[1]*r[1]*u[x]+v*beta[2]*p[1]*r[1]*u[x]+v*p[1]*r[1]*u[x]*alpha[1][x]+2*u*beta[1]*r[1]*s[1]*u[x]+2*alpha[1]*p[1]*r[1]*u[x]*v[x]-u*p[1]*v[x]*r[1][t]+u*r[1]*s[1]*delta[1][x]+u*r[1]*u[x]*s[1][t]+u*r[1]*v[x]*p[1][t]-u*s[1]*u[x]*r[1][t]+v*p[1]*r[1]*delta[1][x]-v*p[1]*u[x]*r[1][t]+v*r[1]*u[x]*p[1][t]+alpha[1]*r[1]*u[x]*alpha[1][x]+delta[1]*p[1]*r[1]*v[x]+delta[1]*r[1]*s[1]*u[x]+delta[2]*p[1]*r[1]*u[x]+2*alpha[1]*beta[1]*r[1]*u[x]+u^2*r[1]*s[1]*beta[1][x]+alpha[1]*r[1]*s[1]*u[x]^2+u*alpha[1]*r[1]*beta[1][x]+u*p[1]*r[1]*delta[2][x]+u*r[1]^2*beta[1][x, x]+alpha[1]^2*r[1]*u[x, x]+alpha[1]*r[1]^2*u[x, x, x]+beta[1]*r[1]^2*u[x, x]+r[1]^2*u[x]*alpha[1][x, x]-u*beta[1]*r[1][t]+u*r[1]*beta[1][t]+alpha[1]*r[1]*delta[1][x]-alpha[1]*u[x]*r[1][t]+r[1]*u[x]*alpha[1][t]+2*r[1]^2*u[x]*beta[1][x]+2*r[1]^2*u[x, x]*alpha[1][x])

1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 2, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, -1, 1, -1, 1, 1, 1, 1, 1

(6)

NULL


Download Coefficients_in_differential_expression_(reviewed).mw

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

Hi wgraf

First and foremost, why are you using GRTensor in Maple 18? Note please that the functionality installed in the Physics and DifferentialGeometry packages of Maple 18 - and in the case of Physics you can also updated it using the large number of improvements that went into Physics of Maple 2015 by (see the Maplesoft R&D Physics webpage) - superseed in various ways the functionality offered by GRTensor (a great package, but by now old and incomplete).

Besides that, if sqrt(5) does not terminate after you load GRTensor as you say, it can only be that some internal Maple routines are being redefined by the version of GRTensor you are loading (and this should really not be done, but as it happens with any package that is not built by Maplesoft, the company has no way to assure that people won't build a package in inappropriate ways).

In summary, why don't you post here more about the problem you are tackling using GRTensor and perhaps we can help you showing how you could do the same with the existing Maple packages mentioned above.

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

Hi

This is the same question you posted in Symmetry analysis with parameters. I am copying from there the answer to your question:


In your worksheet, you input:

parameters = A, B

parameters = A, B

(1)

What you are missing here is the order of precedence of operations. You intended one object, an equation, with left-hand side being parameters and right-hand side being A, B. But = has higher precedence than `,` so you got two objects instead of one equation,

nops([parameters = A, B])

2

(2)

Where the first and second objects are, respectively,

op(1, [parameters = A, B])

parameters = A

(3)

op(2, [parameters = A, B])

B

(4)

So how do you input what you intended? Enclosing the parameters as a set or list, for instance as follows:

parameters = {A, B}

parameters = {A, B}

(5)

nops([parameters = {A, B}])

1

(6)

op(1, [parameters = {A, B}])

parameters = {A, B}

(7)

This is explained in the help page of the commands you are using.

``

 

So, by passing the parameters as a set (enclosed within {...}) or as a list (enclosed within [...]) you can work with an unlimited number of parameters and split into cases, as shown in my first reply to Symmetry analysis with parameters, with respect to some or all of them.

 

Download parameters_as_a_set.mw

 

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


Define the Laplace operator; use simplify/size (not mandatory, but useful in cases like this)

L := proc (F) options operator, arrow; simplify(diff(r^2*(diff(F, r)), r)+(diff(sin(theta)*(diff(F, theta)), theta))/sin(theta)+(diff(F, phi, phi))/sin(theta), size) end proc

proc (F) options operator, arrow; simplify(diff(r^2*(diff(F, r)), r)+(diff(sin(theta)*(diff(F, theta)), theta))/sin(theta)+(diff(F, phi, phi))/sin(theta), size) end proc

(1)

For readability, use compact display (derivatives are displayed indexed and the function dependency ommited - check the help page for declare)

PDEtools:-declare(F(r, theta, phi))

F(r, theta, phi)*`will now be displayed as`*F

(2)

Try first Laplace operator itself on a function of r only

L(F(r))

r*((diff(diff(F(r), r), r))*r+2*(diff(F(r), r)))

(3)

The "second power" of the operator is just the composition of the operator with itself. In Maple, the composition operator is @ (check its help page)

L__2 := `@`(L, L)

L@@2

(4)

L__2(F(r, theta, phi))

(sin(theta)^3*(diff(diff(diff(diff(F(r, theta, phi), theta), theta), theta), theta))+2*(diff(diff(diff(diff(F(r, theta, phi), phi), phi), theta), theta))*sin(theta)^2+sin(theta)*(diff(diff(diff(diff(F(r, theta, phi), phi), phi), phi), phi))+2*r^2*(diff(diff(diff(diff(F(r, theta, phi), r), r), theta), theta))*sin(theta)^3+2*sin(theta)^2*(diff(diff(diff(diff(F(r, theta, phi), phi), phi), r), r))*r^2+sin(theta)^3*(diff(diff(diff(diff(F(r, theta, phi), r), r), r), r))*r^4+2*cos(theta)*sin(theta)^2*(diff(diff(diff(F(r, theta, phi), theta), theta), theta))+4*r*(diff(diff(diff(F(r, theta, phi), r), theta), theta))*sin(theta)^3+4*sin(theta)^2*(diff(diff(diff(F(r, theta, phi), phi), phi), r))*r+2*cos(theta)*sin(theta)^2*(diff(diff(diff(F(r, theta, phi), r), r), theta))*r^2+8*sin(theta)^3*(diff(diff(diff(F(r, theta, phi), r), r), r))*r^3+(-cos(theta)^2*sin(theta)-2*sin(theta)^3)*(diff(diff(F(r, theta, phi), theta), theta))+(cos(theta)^2+sin(theta)^2)*(diff(diff(F(r, theta, phi), phi), phi))+4*cos(theta)*sin(theta)^2*(diff(diff(F(r, theta, phi), r), theta))*r+14*sin(theta)^3*(diff(diff(F(r, theta, phi), r), r))*r^2+(cos(theta)^3+cos(theta)*sin(theta)^2)*(diff(F(r, theta, phi), theta))+4*sin(theta)^3*(diff(F(r, theta, phi), r))*r)/sin(theta)^3

(5)

You can also use the repeated composition operator, for instance to compose more than twice:

L__3 := L@@3

L@@3

(6)

L__3(F(phi))

(sin(theta)^2*(diff(diff(diff(diff(diff(diff(F(phi), phi), phi), phi), phi), phi), phi))+(5*cos(theta)^2*sin(theta)+3*sin(theta)^3)*(diff(diff(diff(diff(F(phi), phi), phi), phi), phi))+(9*cos(theta)^4+12*cos(theta)^2*sin(theta)^2+3*sin(theta)^4)*(diff(diff(F(phi), phi), phi)))/sin(theta)^5

(7)

``


Download powers_of_operators.mw

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

Hi

The PDEtools:-dcoeffs command is probably what you are looking for. 

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

Hi zia,

Your question "Plot Heun in Maple" from October 24 is the same as this one now on "How to plot HeunTprime in Maple": you are entering your expressions using the (default) 2D input mode, which in my opinion works well for most things and is nicer than 1D, but for this "Smart Operators" (default is "checked") which keeps putting invisible multiplication operators between ][ and )( and that ends corrupting your input without you perceiving. So it is not you but this Smart Operators default. You can change that in "Maple -> Preferences -> Interface -> Smart operators", just uncheck it then click "Apply Global", and you will never have this problem again; i.e in your example in this post your [7.6613, 8.0102, 8.1790][1] will become 7.6613 instead of the nonsensical [7.6613, 8.0102, 8.1790]*[1].

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

First 38 39 40 41 42 43 44 Last Page 40 of 59