Maple Questions and Posts Maple Questions and Posts Feed

These are Posts and Questions associated with the product, Maple

Is it possible to subscript within a plot?

for example I have

this in principle is what I want but, the N is cursive while is O is not (and it's a bit shifted to the right, not right next to the [2] !???

Also I didnt find the meanings of mi(),mn(),mo(),mfenced()... in the help documentation which I stumbled across while googling.

for example in this case:


what do I need them for since without the mi it doesnt work?!

Is it possible to use latex notation within the plot options for more convenience?

BTW: When plotting a .ps or .eps the plotting device takes over all the features (like the examples above) but when using png instead it just prints the code behind it ( for example the `#mover(mi("x"),mi("~"))` ) and not would it should lead to

How long will MAPLE 16 and future versions of MAPLE will support running on Windows 7? 


(I hope to defer transferring to Windows 10 until MS stop supporting for Windows 7.)



I am unable to use subs() command when using subscript : I'd like to replace YP__1 with dGx in the equation :

"Eq:= YP__1 = Y__2" (Eq:= YP1=Y2)


 so I have tried : subs({YP__1=dGx},Eq)


But it doesn't work... It give me : YP__1 = Y__2 and I would like to have dGx = Y__2


I have tried also with subs({YP[1]=dGx},Eq) but doesn't work too.


If I am not using subscript, for exemple : Eq:= YP1 = Y2


And do : subs({YP1=dGx},Eq)


That works great...


But I must use subscript __ because Eq is a result from ODEtools (convertsys).


Can you help me please ?


Thanks you very much.



Consider the list [x,y,z], say. Does there in Maple exist some fundamental function for querying the position in the list of x,y, and z, respectively? I am unable to locate any such. Such a function can, of course, be constructed, an example being the following:

listPos := (l::list) -> table(zip(`=`,l,[$(1..nops(l))])):
pos := listPos([x,y,z]);

But that seems unsatisfactory. The same question concerning Vectors: Consider Vector([x,y,z]), say. Here, the following code, say, will perform the task:

VectorPos := (V::Vector) -> table([map(rhs = lhs,op(2,V))[]]):
pos := VectorPos(Vector([x,y,z]));

PS: Of course, list and Vectors can be converted into one another, so any one of the codes above can in practice be used to perform both tasks.

The following code is part of my attempt to answer the recent Question about the bifurcation of the map f:= x-> exp(x^2*(a-x)). Two very weird things are happening. They can be seen by applying trace to f. The first is that the input argument to f seems to be changed to a very large integer. The second is that for some real values of a and x, I get imaginary results from this obviously real-valued function. Why are these things happening?


f:= x-> exp(x^2*(a-x)):


Iterate:= proc(a, x0:= 1., n:= 2000)
local A:= hfarray(1..n, [x0]), f:= subs(:-a= a, eval(:-f));          
          proc(f, A, n)
          local k;
               for k from 2 to n do A[k]:= f(A[k-1]) end do
          end proc
          (f, A, n);
     evalf[4]~(convert(A[1000..], set))
end proc:


{--> enter f, args = 4607182418800017408




<-- exit f (now in unknown) = 4607413323290551347}
{--> enter f, args = 4607413323290551347




<-- exit f (now in unknown) = 4607169774561176020}
{--> enter f, args = 4607169774561176020




Warning,  computation interrupted



{--> enter f, args = 4607182418800017408




<-- exit f (now in unknown) = HFloat(0.7545897527558614)+HFloat(0.19267839720238844)*I}

Error, (in unknown) unable to store 'HFloat(0.7545897527558614)+HFloat(0.19267839720238844)*I' when datatype=float[8]





How to show what class of bifurcation is in this function :   exp(x2*(a-x)) ?

I have a long list of two element lists, for example,

A := [ [2,3], [4,5] ,[6,7]];

I want apply '/' to the elements of each sublist.

The result will be

R := [2/3, 4/5, 6/7];

I do not need the list, I could use vectors or matrices.

Is it possible to do this other than by iteration?

Tom Dean

I want to set up a couple of tables. One problem I have is setting up the list of names for the columns.  u0 etc are actual variables. Being trying to use  ` ` and ' ' to stop them evaluating. I have even more problems with  h6 as a name and symbols Sigma etc.

How do you do this so it looks neat and the name preferably doesn`t display the  ` ` or " " or '  '?



"Names:=[`u0`,`u1`,`u2`,`u3`,`Px`,`Py`,`Pz`,`-`,`'g0'`,`'g1'`,`'g2'`,`'g3'`,`-`,`\`&sum;u`^(2)`,`-`\`,&sum;p`^(2)`,`-`,` &sum;g^(2)`]"

Error, unable to delimit strings/identifiers

"Names:=[`u0`,`u1`,`u2`,`u3`,`Px`,`Py`,`Pz`,`-`,`'g0'`,`'g1'`,`'g2'`,`'g3'`,`-`,`\`&sum;u`^2`,`-`\`,&sum;p`^2`,`-`,` &sum;g^2`]"






greatings all,

I want to calculate energy momentum tensor for a given metric. is it possible to calculate it in the physics package?


Please find the attached file

The command PolynomialInterpolation doesn't work, I will be appreciate if you can help me


hi.i am a problem for solving this non linear algebric equation.

please help me...thanks


When I was editing the head of the question (? instead of .), its body disappeared. Please, insert it again.


Markiyan Hirnyk

Maple 15.

I have a set of equations I can solve manually, but, solve fails.

eq1 := tgtX[1] = 0;
eq2 := tgtY[2] - y[2]    = m[2]*(tgtX[2]-x[2]);
eq3 := tgtY[3] - y[3]    = m[3]*(tgtX[3]-x[3]);
eq4 := tgtY[4] - y[4]    = m[4]*(tgtX[4]-x[4]);
eq5 := tgtY[2] - tgtY[1] = vy*t[2];
eq6 := tgtY[3] - tgtY[1] = vy*t[3];
eq7 := tgtY[4] - tgtY[1] = vy*t[4];
eq8 := tgtX[2]           = vx*t[2];
eq9 := tgtX[3]           = vx*t[3];
eq10:= tgtX[4]           = vx*t[4];
# solve the equations
eqs  := {eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10};

solvx := solve(eq10,vx);
solvy := solve(eq7,vy);
sol1  := subs(vx=solvx,{eq8,eq9});
sol2  := subs(vy=solvy,{eq5,eq6});

soln  := subs(sol1,{eq2,eq3});

soln  := subs(tgtY[2]=solve(sol2[1],tgtY[2]),soln);
soln  := subs(tgtY[3]=solve(sol2[2],tgtY[3]),soln);
soln  := subs(tgtY[1]=solve(soln[1],tgtY[1]),soln[2]);
soln  := solve({eq4,soln},{tgtX[4],tgtY[4]});

# this returns empty solution

Any ideas?

Tom Dean


Is there an option/ or a way so as to ask pointplots to plot a interpolated curve for the points defined ?

Thank you for you help.

Below is the worksheet with the whole material presented yesterday in the webinar, “Applying the power of computer algebra to theoretical physics”, broadcasted by the “Institute of Physics” (IOP, England). The material was very well received, rated 4.5 out of 5 (around 30 voters among the more than 300 attendants), and generated a lot of feedback. The webinar was recorded so that it is possible to watch it (for free, of course, click the link above, it will ask you for registration, though, that’s how IOP works).

Anyway, you can reproduce the presentation with the worksheet below (mw file linked at the end, or the corresponding pdf also linked with all the input lines executed). As usual, to reproduce the input/output you need to have installed the latest version of Physics, available in the Maplesoft R&D Physics webpage.

Why computer algebra?




... and why computer algebra?

We can concentrate more on the ideas instead of on the algebraic manipulations


We can extend results with ease


We can explore the mathematics surrounding a problem


We can share results in a reproducible way


Representation issues that were preventing the use of computer algebra in Physics



Notation and related mathematical methods that were missing:

coordinate free representations for vectors and vectorial differential operators,

covariant tensors distinguished from contravariant tensors,

functional differentiation, relativity differential operators and sum rule for tensor contracted (repeated) indices

Bras, Kets, projectors and all related to Dirac's notation in Quantum Mechanics


Inert representations of operations, mathematical functions, and related typesetting were missing:


inert versus active representations for mathematical operations

ability to move from inert to active representations of computations and viceversa as necessary

hand-like style for entering computations and textbook-like notation for displaying results


Key elements of the computational domain of theoretical physics were missing:


ability to handle products and derivatives involving commutative, anticommutative and noncommutative variables and functions

ability to perform computations taking into account custom-defined algebra rules of different kinds

(commutator, anticommutator and bracket rules, etc.)





The Maple computer algebra environment


Classical Mechanics


Inertia tensor for a triatomic molecule


Classical Field Theory


*The field equations for the lambda*Phi^4 model


*Maxwell equations departing from the 4-dimensional Action for Electrodynamics


*The Gross-Pitaevskii field equations for a quantum system of identical particles


Quantum mechanics


*The quantum operator components of  `#mover(mi("L",mathcolor = "olive"),mo("&rarr;",fontstyle = "italic"))` satisfy "[L[j],L[k]][-]=i `&epsilon;`[j,k,m] L[m]"


Quantization of the energy of a particle in a magnetic field


Unitary Operators in Quantum Mechanics


*Eigenvalues of an unitary operator and exponential of Hermitian operators


Properties of unitary operators



Consider two set of kets " | a[n] >" and "| b[n] >", each of them constituting a complete orthonormal basis of the same space.

One can always build an unitary operator U that maps one basis to the other, i.e.: "| b[n] >=U | a[n] >"

*Verify that "U=(&sum;) | b[k] >< a[k] |" implies on  "| b[n] >=U | a[n] >"


*Show that "U=(&sum;) | b[k] > < a[k] | "is unitary


*Show that the matrix elements of U in the "| a[n] >" and  "| b[n] >" basis are equal


Show that A and `&Ascr;` = U*A*`#msup(mi("U"),mo("&dagger;"))`have the same spectrum



Schrödinger equation and unitary transform



Consider a ket "| psi[t] > " that solves the time-dependant Schrödinger equation:


"i `&hbar;` (&PartialD;)/(&PartialD;t) | psi[t] >=H(t) | psi[t] >"

and consider

"| phi[t] > =U(t) | psi[t] >",


where U(t) is a unitary operator.


Does "| phi[t] >" evolves according a Schrödinger equation

 "i*`&hbar;` (&PartialD;)/(&PartialD;t) | phi[t] >=`&Hscr;`(t) | phi[t] >"

and if yes, which is the expression of `&Hscr;`(t)?




Translation operators using Dirac notation


In this section, we focus on the operator T[a] = exp((-I*a*P)*(1/`&hbar;`))



The Action (translation) of the operator T[a]"=(e)^(-i (a P)/(`&hbar;`))" on a ket


Action of T[a] on an operatorV(X)


General Relativity


*Exact Solutions to Einstein's Equations  Lambda*g[mu, nu]+G[mu, nu] = 8*Pi*T[mu, nu]


*"Physical Review D" 87, 044053 (2013)


Given the spacetime metric,

g[mu, nu] = (Matrix(4, 4, {(1, 1) = -exp(lambda(r)), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = -r^2, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -r^2*sin(theta)^2, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = exp(nu(r))}))

a) Compute the Ricci and Weyl scalars


b) Compute the trace of


"Z[alpha]^(beta)=Phi R[alpha]^(beta)+`&Dscr;`[alpha]`&Dscr;`[]^(beta) Phi+T[alpha]^(beta)"


where `&equiv;`(Phi, Phi(r)) is some function of the radial coordinate, R[alpha, `~beta`] is the Ricci tensor, `&Dscr;`[alpha] is the covariant derivative operator and T[alpha, `~beta`] is the stress-energy tensor


T[alpha, beta] = (Matrix(4, 4, {(1, 1) = 8*exp(lambda(r))*Pi, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 8*r^2*Pi, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 8*r^2*sin(theta)^2*Pi, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 8*exp(nu(r))*Pi*epsilon}))

c) Compute the components of "W[alpha]^(beta)"" &equiv;"the traceless part of  "Z[alpha]^(beta)" of item b)


d) Compute an exact solution to the nonlinear system of differential equations conformed by the components of  "W[alpha]^(beta)" obtained in c)


Background: paper from February/2013, "Withholding Potentials, Absence of Ghosts and Relationship between Minimal Dilatonic Gravity and f(R) Theories", by P. Fiziev.


a) The Ricci and Weyl scalars


b) The trace of "  Z[alpha]^(beta)=Phi R[alpha]^(beta)+`&Dscr;`[alpha]`&Dscr;`[]^(beta) Phi+T[alpha]^(beta)"


b) The components of "W[alpha]^(beta)"" &equiv;"the traceless part of " Z[alpha]^(beta)"


c) An exact solution for the nonlinear system of differential equations conformed by the components of  "W[alpha]^(beta)"


*The Equivalence problem between two metrics



From the "What is new in Physics in Maple 2016" page:


In the Maple PDEtools package, you have the mathematical tools - including a complete symmetry approach - to work with the underlying [Einstein’s] partial differential equations. [By combining that functionality with the one in the Physics and Physics:-Tetrads package] you can also formulate and, depending on the metrics also resolve, the equivalence problem; that is: to answer whether or not, given two metrics, they can be obtained from each other by a transformation of coordinates, as well as compute the transformation.

Example from: A. Karlhede, "A Review of the Geometrical Equivalence of Metrics in General Relativity", General Relativity and Gravitation, Vol. 12, No. 9, 1980


*Equivalence for Schwarzschild metric (spherical and Krustal coordinates)


Tetrads and Weyl scalars in canonical form



Generally speaking a canonical form is obtained using transformations that leave invariant the tetrad metric in a tetrad system of references, so that theWeyl scalars are fixed as much as possible (conventionally, either equal to 0 or to 1).


Bringing a tetrad in canonical form is a relevant step in the tackling of the equivalence problem between two spacetime metrics.

The implementation is as in "General Relativity, an Einstein century survey", edited by S.W. Hawking (Cambridge) and W. Israel (U. Alberta, Canada), specifically Chapter 7 written by S. Chandrasekhar, page 388:








Residual invariance

Petrov type I







Petrov type II







Petrov type III







Petrov type D






`&Psi;__2`  remains invariant under rotations of Class III

Petrov type N






`&Psi;__4` remains invariant under rotations of Class II



The transformations (rotations of the tetrad system of references) used are of Class I, II and III as defined in Chandrasekar's chapter - equations (7.79) in page 384, (7.83) and (7.84) in page 385. Transformations of Class I can be performed with the command Physics:-Tetrads:-TransformTetrad using the optional argument nullrotationwithfixedl_, of Class II using nullrotationwithfixedn_ and of Class III by calling TransformTetrad(spatialrotationsm_mb_plan, boostsn_l_plane), so with the two optional arguments simultaneously.


The determination of appropriate transformation parameters to be used in these rotations, as well as the sequence of transformations happens all automatically by using the optional argument, canonicalform of TransformTetrad .


restart; with(Physics); with(Tetrads)

`Setting lowercaselatin letters to represent tetrad indices `


0, "%1 is not a command in the %2 package", Tetrads, Physics


0, "%1 is not a command in the %2 package", Tetrads, Physics


[IsTetrad, NullTetrad, OrthonormalTetrad, PetrovType, SimplifyTetrad, TransformTetrad, e_, eta_, gamma_, l_, lambda_, m_, mb_, n_]


Petrov type I


Petrov type II


Petrov type III


Petrov type N


Petrov type D


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

1 2 3 4 5 6 7 Last Page 1 of 1211