Product Tips & Techniques

Tips and Tricks on how to get the most about Maple and MapleSim

Controlled platform with 6 degrees of freedom. It has three rotary-inclined racks of variable length:

and an example of movement parallel to the base:

Perhaps the Stewart platform may not reproduce such trajectories, but that is not the point. There is a way to select a design for those specific functions that our platform will perform. That is, first we consider the required trajectories of the platform movement, and only then we select a driving device that can reproduce them. For example, we can fix the extreme positions of the actuators during the movement of the platform and compare them with the capabilities of existing designs, or simulate your own devices.
In this case, the program consists of three parts. (The text of the program directly for the first figure : PLATFORM_6.mw) In the first part, we select the starting point for the movement of a rigid body with six degrees of freedom. Here three equations f6, f7, f8 are responsible for the six degrees of freedom. The equations f1, f2, f3, f4, f5 define a trajectory of motion of a rigid body. The coordinates of the starting point are transmitted via disk E for the second part of the program. In the second part of the program, the trajectory of a rigid body is calculated using the Draghilev method. Then the trajectory data is transferred via the disk E for the third part of the program.
In the third part of the program, the visualization is executed and the platform motion drive device is modeled.
It is like a sketch of a possible way to create controlled platforms with six degrees of freedom. Any device that can provide the desired trajectory can be inserted into the third part. At the same time, it is obvious that the geometric parameters of the movement of this device with the control of possible emergency positions and the solution of the inverse kinematics problem can be obtained automatically if we add the appropriate code to the program text.
Equations can be of any kind and can be combined with each other, and they must be continuously differentiable. But first, the equations must be reduced to uniform variables in order to apply the Draghilev method.
(These examples use implicit equations for the coordinates of the vertices of the triangle.)

In the study of the Gödel spacetime model, a tetrad was suggested in the literature [1]. Alas, upon entering the tetrad in question, Maple's Tetrad's package complained that that matrix was not a tetrad! What went wrong? After an exchange with Edgardo S. Cheb-Terrab, Edgardo provided us with awfully useful comments regarding the use of the package and suggested that the problem together with its solution be presented in a post, as others may find it of some use for their work as well.

 

The Gödel spacetime solution to Einsten's equations is as follows.

 

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 858 and is the same as the version installed in this computer, created 2020, October 27, 10:19 hours Pacific Time.`

(1)

with(Physics); with(Tetrads)

_______________________________________________________

 

`Setting `*lowercaselatin_ah*` letters to represent `*tetrad*` indices`

 

((`Defined as tetrad tensors `*`see <a href='http://www.maplesoft.com/support/help/search.aspx?term=Physics,tetrads`*`,' target='_new'>?Physics,tetrads`*`,</a> `*`&efr;`[a, mu]*`, `)*eta[a, b]*`, `*gamma[a, b, c]*`, `)*lambda[a, b, c]

 

((`Defined as spacetime tensors representing the NP null vectors of the tetrad formalism `*`see <a href='http://www.maplesoft.com/support/help/search.aspx?term=Physics,tetrads`*`,' target='_new'>?Physics,tetrads`*`,</a> `*l[mu]*`, `)*n[mu]*`, `*m[mu]*`, `)*conjugate(m[mu])

 

_______________________________________________________

(2)

Working with Cartesian coordinates,

Coordinates(cartesian)

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

 

{X}

(3)

the Gödel line element is

 

ds^2 = d_(t)^2-d_(x)^2-d_(y)^2+(1/2)*exp(2*q*y)*d_(z)^2+2*exp(q*y)*d_(z)*d_(t)

ds^2 = Physics:-d_(t)^2-Physics:-d_(x)^2-Physics:-d_(y)^2+(1/2)*exp(2*q*y)*Physics:-d_(z)^2+2*exp(q*y)*Physics:-d_(z)*Physics:-d_(t)

(4)

Setting the metric

Setup(metric = rhs(ds^2 = Physics[d_](t)^2-Physics[d_](x)^2-Physics[d_](y)^2+(1/2)*exp(2*q*y)*Physics[d_](z)^2+2*exp(q*y)*Physics[d_](z)*Physics[d_](t)))

_______________________________________________________

 

`Coordinates: `*[x, y, z, t]*`. Signature: `*`- - - +`

 

_______________________________________________________

 

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

 

_______________________________________________________

 

`Setting `*lowercaselatin_is*` letters to represent `*space*` indices`

 

[metric = {(1, 1) = -1, (2, 2) = -1, (3, 3) = (1/2)*exp(2*q*y), (3, 4) = exp(q*y), (4, 4) = 1}, spaceindices = lowercaselatin_is]

(5)

The problem appeared upon entering the matrix M below supposedly representing the alleged tetrad.

interface(imaginaryunit = i)

M := Matrix([[1/sqrt(2), 0, 0, 1/sqrt(2)], [-1/sqrt(2), 0, 0, 1/sqrt(2)], [0, 1/sqrt(2), -I*exp(-q*y), I], [0, 1/sqrt(2), I*exp(-q*y), -I]])

Matrix(%id = 18446744078162949534)

(6)

Each of the rows of this matrix is supposed to be one of the null vectors [l, n, m, conjugate(m)]. Before setting this alleged tetrad, Maple was asked to settle the nature of it, and the answer was that M was not a tetrad! With the Physics Updates v.857, a more detailed message was issued:

IsTetrad(M)

`Warning, the given components form a`*null*`tetrad, `*`with a contravariant spacetime index`*`, only if you change the signature from `*`- - - +`*` to `*`+ - - -`*`. 
You can do that by entering (copy and paste): `*Setup(signature = "+ - - -")

 

false

(7)

So there were actually three problems:

1. 

The entered entity was a null tetrad, while the default of the Physics package is an orthonormal tetrad. This can be seen in the form of the tetrad metric, or using the library commands:

eta_[]

Physics:-Tetrads:-eta_[a, b] = Matrix(%id = 18446744078354552462)

(8)

Library:-IsOrthonormalTetradMetric()

true

(9)

Library:-IsNullTetradMetric()

false

(10)
2. 

The matrix M would only be a tetrad if the spacetime index is contravariant. On the other hand, the command IsTetrad will return true only when M represents a tetrad with both indices covariant. For  instance, if the command IsTetrad  is issued about the tetrad automatically computed by Maple, but is passed the matrix corresponding to "`&efr;`[a]^(mu)"  with the spacetime index contravariant,  false is returned:

"e_[a,~mu, matrix]"

Physics:-Tetrads:-e_[a, `~&mu;`] = Matrix(%id = 18446744078297840926)

(11)

"IsTetrad(rhs(?))"

Typesetting[delayDotProduct](`Warning, the given components form a`*orthonormal*`tetrad only if the spacetime index is contravariant. 
You can construct a tetrad with a covariant spacetime index by entering (copy and paste): `, Matrix(4, 4, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = sqrt(2)*exp(-q*y), (3, 4) = -sqrt(2), (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 1}), true).rhs(g[])

 

false

(12)
3. 

The matrix M corresponds to a tetrad with different signature, (+---), instead of Maple's default (---+). Although these two signatures represent the same physics, they differ in the ordering of rows and columns: the timelike component is respectively in positions 1 and 4.

 

The issue, then, became how to correct the matrix M to be a valid tetrad: either change the setup, or change the matrix M. Below the two courses of action are provided.

 

First the simplest: change the settings. According to the message (7), setting the tetrad to be null, changing the signature to be (+---) and indicating that M represents a tetrad with its spacetime index contravariant would suffice:

Setup(tetradmetric = null, signature = "+---")

[signature = `+ - - -`, tetradmetric = {(1, 2) = 1, (3, 4) = -1}]

(13)

The null tetrad metric is now as in the reference used.

eta_[]

Physics:-Tetrads:-eta_[a, b] = Matrix(%id = 18446744078298386174)

(14)

Checking now with the spacetime index contravariant

e_[a, `~&mu;`] = M

Physics:-Tetrads:-e_[a, `~&mu;`] = Matrix(%id = 18446744078162949534)

(15)

At this point, the command IsTetrad  provided with the equation (15), where the left-hand side has the information that the spacetime index is contravariant

"IsTetrad(?)"

`Type of tetrad: `*null

 

true

(16)

Great! one can now set the tetrad M exactly as entered, without changing anything else. In the next line it will only be necessary to indicate that the spacetime index, mu, is contravariant.

Setup(e_[a, `~&mu;`] = M, quiet)

[tetrad = {(1, 1) = -(1/2)*2^(1/2), (1, 3) = (1/2)*2^(1/2)*exp(q*y), (1, 4) = (1/2)*2^(1/2), (2, 1) = (1/2)*2^(1/2), (2, 3) = (1/2)*2^(1/2)*exp(q*y), (2, 4) = (1/2)*2^(1/2), (3, 2) = -(1/2)*2^(1/2), (3, 3) = ((1/2)*I)*exp(q*y), (3, 4) = 0, (4, 2) = -(1/2)*2^(1/2), (4, 3) = -((1/2)*I)*exp(q*y), (4, 4) = 0}]

(17)

 

The tetrad is now the matrix M. In addition to checking this tetrad making use of the IsTetrad command, it is also possible to check the definitions of tetrads and null vectors using TensorArray.

e_[definition]

Physics:-Tetrads:-e_[a, `&mu;`]*Physics:-Tetrads:-e_[b, `~&mu;`] = Physics:-Tetrads:-eta_[a, b]

(18)

TensorArray(Physics:-Tetrads:-e_[a, `&mu;`]*Physics:-Tetrads:-e_[b, `~&mu;`] = Physics:-Tetrads:-eta_[a, b], simplifier = simplify)

Matrix(%id = 18446744078353048270)

(19)

For the null vectors:

l_[definition]

Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-l_[`~mu`] = 0, Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-n_[`~mu`] = 1, Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-m_[`~mu`] = 0, Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-mb_[`~mu`] = 0, Physics:-g_[mu, nu] = Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-n_[nu]+Physics:-Tetrads:-l_[nu]*Physics:-Tetrads:-n_[mu]-Physics:-Tetrads:-m_[mu]*Physics:-Tetrads:-mb_[nu]-Physics:-Tetrads:-m_[nu]*Physics:-Tetrads:-mb_[mu]

(20)

TensorArray([Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-l_[`~mu`] = 0, Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-n_[`~mu`] = 1, Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-m_[`~mu`] = 0, Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-mb_[`~mu`] = 0, Physics[g_][mu, nu] = Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-n_[nu]+Physics:-Tetrads:-l_[nu]*Physics:-Tetrads:-n_[mu]-Physics:-Tetrads:-m_[mu]*Physics:-Tetrads:-mb_[nu]-Physics:-Tetrads:-m_[nu]*Physics:-Tetrads:-mb_[mu]], simplifier = simplify)

[0 = 0, 1 = 1, 0 = 0, 0 = 0, Matrix(%id = 18446744078414241910)]

(21)

From its Weyl scalars, this tetrad is already in the canonical form for a spacetime of Petrov type "D": only `&Psi;__2` <> 0

PetrovType()

"D"

(22)

Weyl[scalars]

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

(23)

Attempting to transform it into canonicalform returns the tetrad (17) itself

TransformTetrad(canonicalform)

Matrix(%id = 18446744078396685478)

(24)

Let's now obtain the correct tetrad without changing the signature as done in (13).

Start by changing the signature back to "(- - - +)"

Setup(signature = "---+")

[signature = `- - - +`]

(25)

So again, M is not a tetrad, even if the spacetime index is specified as contravariant.

IsTetrad(e_[a, `~&mu;`] = M)

`Warning, the given components form a`*null*`tetrad, `*`with a contravariant spacetime index`*`, only if you change the signature from `*`- - - +`*` to `*`+ - - -`*`. 
You can do that by entering (copy and paste): `*Setup(signature = "+ - - -")

 

false

(26)

By construction, the tetrad M has its rows formed by the null vectors with the ordering [l, n, m, conjugate(m)]. To understand what needs to be changed in M, define those vectors, independent of the null vectors [l_, n_, m_, mb_] (with underscore) that come with the Tetrads package.

Define(l[mu], n[mu], m[mu], mb[mu], quiet)

and set their components using the matrix M taking into account that its spacetime index is contravariant, and equating the rows of M  using the ordering [l, n, m, conjugate(m)]:

`~`[`=`]([l[`~&mu;`], n[`~&mu;`], m[`~&mu;`], mb[`~&mu;`]], [seq(M[j, 1 .. 4], j = 1 .. 4)])

[l[`~&mu;`] = Vector[row](%id = 18446744078368885086), n[`~&mu;`] = Vector[row](%id = 18446744078368885206), m[`~&mu;`] = Vector[row](%id = 18446744078368885326), mb[`~&mu;`] = Vector[row](%id = 18446744078368885446)]

(27)

"Define(op(?))"

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], Physics:-Weyl[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-Tetrads:-e_[a, mu], Physics:-Tetrads:-eta_[a, b], Physics:-g_[mu, nu], Physics:-gamma_[i, j], Physics:-Tetrads:-gamma_[a, b, c], l[mu], Physics:-Tetrads:-l_[mu], Physics:-Tetrads:-lambda_[a, b, c], m[mu], Physics:-Tetrads:-m_[mu], mb[mu], Physics:-Tetrads:-mb_[mu], n[mu], Physics:-Tetrads:-n_[mu], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(28)

Check the covariant components of these vectors towards comparing them with the lines of the Maple's tetrad `&efr;`[a, mu]

l[], n[], m[], mb[]

l[mu] = Array(%id = 18446744078298368710), n[mu] = Array(%id = 18446744078298365214), m[mu] = Array(%id = 18446744078298359558), mb[mu] = Array(%id = 18446744078298341734)

(29)

This shows the [l_, n_, m_, mb_] null vectors (with underscore) that come with Tetrads package

e_[nullvectors]

Physics:-Tetrads:-l_[mu] = Vector[row](%id = 18446744078354520414), Physics:-Tetrads:-n_[mu] = Vector[row](%id = 18446744078354520534), Physics:-Tetrads:-m_[mu] = Vector[row](%id = 18446744078354520654), Physics:-Tetrads:-mb_[mu] = Vector[row](%id = 18446744078354520774)

(30)

So (29) computed from M is the same as (30) computed from Maple's tetrad.

But, from (30) and the form of Maple's tetrad

e_[]

Physics:-Tetrads:-e_[a, mu] = Matrix(%id = 18446744078297844182)

(31)

for the current signature

Setup(signature)

[signature = `- - - +`]

(32)

we see the ordering of the null vectors is [n, m, mb, l], not [l, n, m, mb] used in [1] with the signature (+ - - -). So the adjustment required in  M, resulting in "M^( ')", consists of reordering M's rows to be [n, m, mb, l]

`#msup(mi("M"),mrow(mo("&InvisibleTimes;"),mo("&apos;")))` := simplify(Matrix(4, map(Library:-TensorComponents, [n[mu], m[mu], mb[mu], l[mu]])))

Matrix(%id = 18446744078414243230)

(33)

IsTetrad(`#msup(mi("M"),mrow(mo("&InvisibleTimes;"),mo("&apos;")))`)

`Type of tetrad: `*null

 

true

(34)

Comparing "M^( ')" with the tetrad `&efr;`[a, mu]computed by Maple ((24) and (31), they are actually the same.

References

[1]. Rainer Burghardt, "Constructing the Godel Universe", the arxiv gr-qc/0106070 2001.

[2]. Frank Grave and Michael Buser, "Visiting the Gödel Universe",  IEEE Trans Vis Comput GRAPH, 14(6):1563-70, 2008.


 

Download Godel_universe_and_Tedrads.mw


In a recent question in Mapleprimes, a spacetime (metric) solution to Einstein's equations, from chapter 27 of the book of Exact Solutions to Einstein's equations [1] was discussed. One of the issues was about computing a tetrad for that solution [27, 37, 1] such that the corresponding Weyl scalars are in canonical form. This post illustrates how to do that, with precisely that spacetime metric solution, in two different ways: 1) automatically, all in one go, and 2) step-by-step. The step-by-step computation is useful to verify results and also to compute different forms of the tetrads or Weyl scalars. The computation below is performed using the latest version of the Maplesoft Physics Updates.

 

with(Physics)

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 851 and is the same as the version installed in this computer, created 2020, October 19, 13:47 hours Pacific Time.`

(1)

The starting point is this image of page 421 of the book of Exact Solutions to Einstein's equations, formulas (27.37)

 

Load the solution [27, 37, 1] from Maple's database of solutions to Einstein's equations

g_[[27, 37, 1]]

_______________________________________________________

 

`Systems of spacetime coordinates are:`*{X = (z, zb, r, u)}

 

`Default differentiation variables for d_, D_ and dAlembertian are:`*{X = (z, zb, r, u)}

 

`The `*`Robinson and Trautman (1962)`*` metric in coordinates `*[z, zb, r, u]

 

`Parameters: `*[P(z, zb, u), H(X)]

 

"`Comments: ` admits geodesic, shearfree, twistfree null congruence, rho=-1/r=rho_b"

 

`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`

 

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

(2)

"CompactDisplay(?)"

H(X)*`will now be displayed as`*H

 

P(z, zb, u)*`will now be displayed as`*P

(3)

The assumptions on the metric's parameters are

Assume(P(z, zb, u) > 0, (H(X))::real, r >= 0)

 

The line element is as shown in the second line of the image above

g_[lineelement]

2*r^2*Physics:-d_(z)*Physics:-d_(zb)/P(z, zb, u)^2-2*Physics:-d_(r)*Physics:-d_(u)-2*H(X)*Physics:-d_(u)^2

(4)

Load Tetrads

with(Tetrads)

_______________________________________________________

 

`Setting `*lowercaselatin_ah*` letters to represent `*tetrad*` indices`

 

((`Defined as tetrad tensors `*`see <a href='http://www.maplesoft.com/support/help/search.aspx?term=Physics,tetrads`*`,' target='_new'>?Physics,tetrads`*`,</a> `*`&efr;`[a, mu]*`, `)*eta[a, b]*`, `*gamma[a, b, c]*`, `)*lambda[a, b, c]

 

((`Defined as spacetime tensors representing the NP null vectors of the tetrad formalism `*`see <a href='http://www.maplesoft.com/support/help/search.aspx?term=Physics,tetrads`*`,' target='_new'>?Physics,tetrads`*`,</a> `*l[mu]*`, `)*n[mu]*`, `*m[mu]*`, `)*conjugate(m[mu])

 

_______________________________________________________

(5)

The Petrov type of this spacetime solution is

PetrovType()

"II"

(6)

The null tetrad computed by the Maple system using a general algorithms is

Setup(tetrad = null)

e_[]

Physics:-Tetrads:-e_[a, mu] = Matrix(%id = 18446744078178770326)

(7)

 

According to the help page TransformTetrad , the canonical form of the Weyl scalars for each different Petrov type is

 

So for type II, when the tetrad is in canonical form, we expect only `&Psi;__2` and `&Psi;__3` different from 0. For the tetrad computed automatically, however, the scalars are

Weyl[scalars]

psi__0 = -P(z, zb, u)*(2*(diff(P(z, zb, u), z))*(diff(H(X), z))+P(z, zb, u)*(diff(diff(H(X), z), z)))/(r^2*(H(X)^2+1)^(1/2)), psi__1 = ((1/2)*I)*(-(diff(diff(H(X), r), z))*P(z, zb, u)^2*r+2*P(z, zb, u)^2*(diff(H(X), z))-(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))*r+(diff(diff(P(z, zb, u), u), z))*r*P(z, zb, u))/(P(z, zb, u)*r^2*(H(X)^2+1)^(1/4)), psi__2 = (1/6)*((diff(diff(H(X), r), r))*r^2+2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))-2*(diff(H(X), r))*r-2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)+2*H(X))/r^2, psi__3 = 0, psi__4 = 0

(8)

The question is, how to bring the tetrad `&efr;`[a, mu] (equation (7)) into canonical form. The plan for that is outlined in Chapter 7, by Chandrasekhar, page 388, of the book "General Relativity, an Einstein centenary survey", edited by S.W. Hawking and W.Israel. In brief, for Petrov type II, use a transformation ofClass[2] to make Psi[0] = `&Psi;__1` and `&Psi;__1` = 0, then a transformation of Class[1] making Psi[4] = 0, finally use a transformation of Class[3] making Psi[3] = 1. For an explanation of these transformations see the help page for TransformTetrad . This plan, however, is applicable if and only if the starting tetrad results in `&psi;__4` <> 0, which we see in (8) it is not the case, so we need, in addition, before applying this plan, to perform a transformation of Class[1] making `&psi;__4` <> 0.

 

In what follows, the transformations mentioned are first performed automatically, in one go, letting the computer deduce each intermediate transformation, by passing to TransformTetrad the optional argument canonicalform. Then, the same result is obtained by transforming the starting tetrad  one step at at time, arriving at the same Weyl scalars. That illustrates well both how to get the result exploiting advanced functionality but also how to verify the result performing each step, and also how to get any desired different form of the Weyl scalars.

 

Although it is possible to perform both computations, automatically and step-by-step, departing from the tetrad (7), that tetrad and the corresponding Weyl scalars (8) have radicals, making the readability of the formulas at each step less clear. Both computations, can be presented in more readable form without radicals departing from the tetrad shown in the book, that is

e_[a, mu] = (Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = -1, (2, 1) = 0, (2, 2) = r/P(z, zb, u), (2, 3) = 0, (2, 4) = 0, (3, 1) = r/P(z, zb, u), (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = -1, (4, 4) = -H(X)}))

Physics:-Tetrads:-e_[a, mu] = Matrix(%id = 18446744078621688766)

(9)

"IsTetrad(?)"

`Type of tetrad: `*null

 

true

(10)

The corresponding Weyl scalars free of radicals are

"WeylScalars(?)"

psi__0 = P(z, zb, u)*(2*(diff(P(z, zb, u), z))*(diff(H(X), z))+P(z, zb, u)*(diff(diff(H(X), z), z)))/r^2, psi__1 = -(1/2)*(-(diff(diff(H(X), r), z))*P(z, zb, u)^2*r+2*P(z, zb, u)^2*(diff(H(X), z))-(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))*r+(diff(diff(P(z, zb, u), u), z))*r*P(z, zb, u))/(r^2*P(z, zb, u)), psi__2 = -(1/6)*(-(diff(diff(H(X), r), r))*r^2+2*(diff(H(X), r))*r-2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))+2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)-2*H(X))/r^2, psi__3 = 0, psi__4 = 0

(11)

So set this tetrad as the starting point

"Setup(?)"

[tetrad = {(1, 4) = -1, (2, 2) = r/P(z, zb, u), (3, 1) = r/P(z, zb, u), (4, 3) = -1, (4, 4) = -H(X)}]

(12)


All the transformations performed automatically, in one go

 

To arrive in one go, automatically, to a tetrad whose Weyl scalars are in canonical form as in (31), use the optional argument canonicalform:

T__5 := TransformTetrad(canonicalform)

WeylScalars(T__5)

psi__0 = 0, psi__1 = 0, psi__2 = -(1/6)*(-(diff(diff(H(X), r), r))*r^2+2*(diff(H(X), r))*r-2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))+2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)-2*H(X))/r^2, psi__3 = 1, psi__4 = 0

(13)

Note the length of T__5

length(T__5)

58242

(14)

That length corresponds to several pages long. That happens frequently, you get Weyl scalars with a minimum of residual invariance, at the cost of a more complicated tetrad.

 

The transformations step-by-step leading to the same canonical form of the Weyl scalars

 

Step 0

 

As mentioned above, to apply the plan outlined by Chandrasekhar, the starting point needs to be a tetrad with `&Psi;__4` <> 0, not the case of (9), so in this step 0 we use a transformation of Class[1] making `&psi;__4` <> 0. This transformation introduces a complex parameter E and to get `&psi;__4` <> 0 any value of E suffices. We use E = 1:

TransformTetrad(nullrotationwithfixedl_)

Matrix(%id = 18446744078634914990)

(15)

"`T__0` := eval(?,E=1)"

Matrix(%id = 18446744078634940646)

(16)

Indeed, for this tetrad, `&Psi;__4` <> 0:

WeylScalars(T__0)[-1]

psi__4 = ((diff(diff(H(X), r), r))*r^2*P(z, zb, u)+P(z, zb, u)^3*(diff(diff(H(X), z), z))+2*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^2+2*(diff(diff(H(X), r), z))*P(z, zb, u)^2*r+2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))*P(z, zb, u)+2*(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))*r-4*P(z, zb, u)^2*(diff(H(X), z))-2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)^2-2*(diff(H(X), r))*P(z, zb, u)*r-2*(diff(diff(P(z, zb, u), u), z))*r*P(z, zb, u)+2*H(X)*P(z, zb, u))/(r^2*P(z, zb, u))

(17)

Step 1

Next is a transformation of Class__2 to make `&Psi;__0` = 0, that in the case of Petrov type II also implies on `&Psi;__1` = 0.According to the the help page TransformTetrad , this transformation introduces a parameter B that, according to the plan outlined by Chandrasekhar in Chapter 7 page 388, is one of the two identical roots (out of the four roots) of the principalpolynomial. To see the principal polynomial, or, directly, its roots you can use the PetrovType  command:

PetrovType(principalroots = 'R')

"II"

(18)

The first two are the same and equal to -1

R[1 .. 2]

[-1, -1]

(19)

So the transformed tetrad T__1 is

T__1 := eval(TransformTetrad(T__0, nullrotationwithfixedn_), B = -1)

Matrix(%id = 18446744078641721462)

(20)

Check this result and the corresponding Weyl scalars to verify that we now have `&Psi;__0` = 0 and `&Psi;__1` = 0

IsTetrad(T__1)

`Type of tetrad: `*null

 

true

(21)

WeylScalars(T__1)[1 .. 2]

psi__0 = 0, psi__1 = 0

(22)

Step 2

Next is a transformation of Class__1 that makes `&Psi;__4` = 0. This transformation introduces a parameter E, that according to Chandrasekhar's plan can be taken equal to one of the roots of Weyl scalar `&Psi;__4`that corresponds to the transformed tetrad. So we need to proceed in three steps:

a. 

transform the tetrad introducing a parameter E in the tetrad's components

b. 

compute the Weyl scalars for that transformed tetrad

c. 

take `&Psi;__4` = 0 and solve for E

d. 

apply the resulting value of E to the transformed tetrad obtained in step a.

 

a.Transform the tetrad and for simplicity take E real

T__2 := eval(TransformTetrad(T__1, nullrotationwithfixedl_), conjugate(E) = E)

Matrix(%id = 18446744078624751238)

(23)

"IsTetrad(?)"

`Type of tetrad: `*null

 

true

(24)

b. Compute `&Psi;__4` for this tetrad

simplify(WeylScalars(T__2)[-1])

psi__4 = (r^2*P(z, zb, u)*(E-1)^2*(diff(diff(H(X), r), r))-2*r*P(z, zb, u)^2*(E-1)*(diff(diff(H(X), r), z))+P(z, zb, u)^3*(diff(diff(H(X), z), z))-2*P(z, zb, u)^2*(E-1)^2*(diff(diff(P(z, zb, u), z), zb))+2*r*P(z, zb, u)*(E-1)*(diff(diff(P(z, zb, u), u), z))-2*r*P(z, zb, u)*(E-1)^2*(diff(H(X), r))+4*P(z, zb, u)^2*(E+(1/2)*(diff(P(z, zb, u), z))-1)*(diff(H(X), z))+2*((P(z, zb, u)*(E-1)*(diff(P(z, zb, u), zb))-(diff(P(z, zb, u), u))*r)*(diff(P(z, zb, u), z))+H(X)*P(z, zb, u)*(E-1))*(E-1))/(r^2*P(z, zb, u))

(25)

c. Solve `&Psi;__4` = 0 discarding the case E = 0 which implies on no transformation

simplify(solve({rhs(psi__4 = (r^2*P(z, zb, u)*(E-1)^2*(diff(diff(H(X), r), r))-2*r*P(z, zb, u)^2*(E-1)*(diff(diff(H(X), r), z))+P(z, zb, u)^3*(diff(diff(H(X), z), z))-2*P(z, zb, u)^2*(E-1)^2*(diff(diff(P(z, zb, u), z), zb))+2*r*P(z, zb, u)*(E-1)*(diff(diff(P(z, zb, u), u), z))-2*r*P(z, zb, u)*(E-1)^2*(diff(H(X), r))+4*P(z, zb, u)^2*(E+(1/2)*(diff(P(z, zb, u), z))-1)*(diff(H(X), z))+2*((P(z, zb, u)*(E-1)*(diff(P(z, zb, u), zb))-(diff(P(z, zb, u), u))*r)*(diff(P(z, zb, u), z))+H(X)*P(z, zb, u)*(E-1))*(E-1))/(r^2*P(z, zb, u))) = 0, E <> 0}, {E}, explicit)[1])

{E = ((diff(diff(H(X), r), r))*r^2*P(z, zb, u)+(diff(diff(H(X), r), z))*P(z, zb, u)^2*r-2*(diff(H(X), r))*P(z, zb, u)*r-(diff(diff(P(z, zb, u), u), z))*r*P(z, zb, u)+(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))*r-2*P(z, zb, u)^2*(diff(H(X), z))-2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)^2+2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))*P(z, zb, u)+2*H(X)*P(z, zb, u)+(-P(z, zb, u)^4*((diff(diff(H(X), r), r))*r^2+2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))-2*(diff(H(X), r))*r-2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)+2*H(X))*(diff(diff(H(X), z), z))+P(z, zb, u)^4*(diff(diff(H(X), r), z))^2*r^2+(-2*r^2*(diff(diff(P(z, zb, u), u), z))*P(z, zb, u)^3+2*r^2*P(z, zb, u)^2*(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))-4*r*(diff(H(X), z))*P(z, zb, u)^4)*(diff(diff(H(X), r), z))-2*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^3*(diff(diff(H(X), r), r))*r^2+P(z, zb, u)^2*(diff(diff(P(z, zb, u), u), z))^2*r^2+(-2*r^2*P(z, zb, u)*(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))+4*r*(diff(H(X), z))*P(z, zb, u)^3)*(diff(diff(P(z, zb, u), u), z))+4*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^4*(diff(diff(P(z, zb, u), z), zb))+4*(diff(H(X), z))^2*P(z, zb, u)^4+4*P(z, zb, u)^2*(diff(P(z, zb, u), z))*((diff(H(X), r))*P(z, zb, u)*r-(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))*P(z, zb, u)-(diff(P(z, zb, u), u))*r-H(X)*P(z, zb, u))*(diff(H(X), z))+(diff(P(z, zb, u), u))^2*(diff(P(z, zb, u), z))^2*r^2)^(1/2))/(P(z, zb, u)*((diff(diff(H(X), r), r))*r^2+2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))-2*(diff(H(X), r))*r-2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)+2*H(X)))}

(26)

d. Apply this result to the tetrad (23). In doing so, do not display the result, just measure its length (corresponds to two+ pages)

T__3 := simplify(eval(T__2, {E = ((diff(diff(H(X), r), r))*r^2*P(z, zb, u)+(diff(diff(H(X), r), z))*P(z, zb, u)^2*r-2*(diff(H(X), r))*P(z, zb, u)*r-(diff(diff(P(z, zb, u), u), z))*r*P(z, zb, u)+(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))*r-2*P(z, zb, u)^2*(diff(H(X), z))-2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)^2+2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))*P(z, zb, u)+2*H(X)*P(z, zb, u)+(-P(z, zb, u)^4*((diff(diff(H(X), r), r))*r^2+2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))-2*(diff(H(X), r))*r-2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)+2*H(X))*(diff(diff(H(X), z), z))+P(z, zb, u)^4*(diff(diff(H(X), r), z))^2*r^2+(-2*r^2*(diff(diff(P(z, zb, u), u), z))*P(z, zb, u)^3+2*r^2*P(z, zb, u)^2*(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))-4*r*(diff(H(X), z))*P(z, zb, u)^4)*(diff(diff(H(X), r), z))-2*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^3*(diff(diff(H(X), r), r))*r^2+P(z, zb, u)^2*(diff(diff(P(z, zb, u), u), z))^2*r^2+(-2*r^2*P(z, zb, u)*(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))+4*r*(diff(H(X), z))*P(z, zb, u)^3)*(diff(diff(P(z, zb, u), u), z))+4*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^4*(diff(diff(P(z, zb, u), z), zb))+4*(diff(H(X), z))^2*P(z, zb, u)^4+4*P(z, zb, u)^2*(diff(P(z, zb, u), z))*((diff(H(X), r))*P(z, zb, u)*r-(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))*P(z, zb, u)-(diff(P(z, zb, u), u))*r-H(X)*P(z, zb, u))*(diff(H(X), z))+(diff(P(z, zb, u), u))^2*(diff(P(z, zb, u), z))^2*r^2)^(1/2))/(P(z, zb, u)*((diff(diff(H(X), r), r))*r^2+2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))-2*(diff(H(X), r))*r-2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)+2*H(X)))}[1]))

length(T__3)

12589

(27)

Check the scalars, we expect `&Psi;__0` = `&Psi;__1` and `&Psi;__1` = `&Psi;__4` and `&Psi;__4` = 0

WeylScalars(T__3); %[1 .. 2], %[-1]

psi__0 = 0, psi__1 = 0, psi__4 = 0

(28)

Step 3

Use a transformation of Class[3] making Psi[3] = 1. Such a transformation changes Psi[3]^` '` = A*exp(-I*Omega)*Psi[3], where we need to take A*exp(-I*Omega) = 1/`&Psi;__3`, and without loss of generality we can take Omega = 0.

Check first the value of `&Psi;__3` in the last tetrad computed

WeylScalars(T__3)[4]

psi__3 = (1/2)*(-2*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^3*(diff(diff(H(X), r), r))*r^2-P(z, zb, u)^4*(diff(diff(H(X), z), z))*(diff(diff(H(X), r), r))*r^2+P(z, zb, u)^4*(diff(diff(H(X), r), z))^2*r^2+4*(diff(P(z, zb, u), z))*(diff(H(X), r))*(diff(H(X), z))*P(z, zb, u)^3*r+2*(diff(H(X), r))*P(z, zb, u)^4*(diff(diff(H(X), z), z))*r-4*(diff(P(z, zb, u), zb))*(diff(P(z, zb, u), z))^2*(diff(H(X), z))*P(z, zb, u)^3+4*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^4*(diff(diff(P(z, zb, u), z), zb))-4*(diff(H(X), z))*P(z, zb, u)^4*(diff(diff(H(X), r), z))*r+2*(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))*P(z, zb, u)^2*(diff(diff(H(X), r), z))*r^2-2*(diff(P(z, zb, u), zb))*(diff(P(z, zb, u), z))*P(z, zb, u)^4*(diff(diff(H(X), z), z))+2*P(z, zb, u)^5*(diff(diff(H(X), z), z))*(diff(diff(P(z, zb, u), z), zb))-2*P(z, zb, u)^3*(diff(diff(P(z, zb, u), u), z))*(diff(diff(H(X), r), z))*r^2+4*(diff(H(X), z))^2*P(z, zb, u)^4-4*(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^2*r-4*H(X)*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^3+4*(diff(H(X), z))*P(z, zb, u)^3*(diff(diff(P(z, zb, u), u), z))*r+(diff(P(z, zb, u), u))^2*(diff(P(z, zb, u), z))^2*r^2-2*(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))*P(z, zb, u)*(diff(diff(P(z, zb, u), u), z))*r^2-2*H(X)*P(z, zb, u)^4*(diff(diff(H(X), z), z))+P(z, zb, u)^2*(diff(diff(P(z, zb, u), u), z))^2*r^2)^(1/2)/(r^2*P(z, zb, u))

(29)

So, the transformed tetrad T__4 to which corresponds Weyl scalars in canonical form, with `&Psi;__0` = `&Psi;__1` and `&Psi;__1` = `&Psi;__4` and `&Psi;__4` = 0 and `&Psi;__3` = 1, is

T__4 := simplify(eval(TransformTetrad(T__3, boostsn_l_plane), A = 1/rhs(psi__3 = (1/2)*(-2*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^3*(diff(diff(H(X), r), r))*r^2-P(z, zb, u)^4*(diff(diff(H(X), z), z))*(diff(diff(H(X), r), r))*r^2+P(z, zb, u)^4*(diff(diff(H(X), r), z))^2*r^2+4*(diff(P(z, zb, u), z))*(diff(H(X), r))*(diff(H(X), z))*P(z, zb, u)^3*r+2*(diff(H(X), r))*P(z, zb, u)^4*(diff(diff(H(X), z), z))*r-4*(diff(P(z, zb, u), zb))*(diff(P(z, zb, u), z))^2*(diff(H(X), z))*P(z, zb, u)^3+4*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^4*(diff(diff(P(z, zb, u), z), zb))-4*(diff(H(X), z))*P(z, zb, u)^4*(diff(diff(H(X), r), z))*r+2*(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))*P(z, zb, u)^2*(diff(diff(H(X), r), z))*r^2-2*(diff(P(z, zb, u), zb))*(diff(P(z, zb, u), z))*P(z, zb, u)^4*(diff(diff(H(X), z), z))+2*P(z, zb, u)^5*(diff(diff(H(X), z), z))*(diff(diff(P(z, zb, u), z), zb))-2*P(z, zb, u)^3*(diff(diff(P(z, zb, u), u), z))*(diff(diff(H(X), r), z))*r^2+4*(diff(H(X), z))^2*P(z, zb, u)^4-4*(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^2*r-4*H(X)*(diff(P(z, zb, u), z))*(diff(H(X), z))*P(z, zb, u)^3+4*(diff(H(X), z))*P(z, zb, u)^3*(diff(diff(P(z, zb, u), u), z))*r+(diff(P(z, zb, u), u))^2*(diff(P(z, zb, u), z))^2*r^2-2*(diff(P(z, zb, u), u))*(diff(P(z, zb, u), z))*P(z, zb, u)*(diff(diff(P(z, zb, u), u), z))*r^2-2*H(X)*P(z, zb, u)^4*(diff(diff(H(X), z), z))+P(z, zb, u)^2*(diff(diff(P(z, zb, u), u), z))^2*r^2)^(1/2)/(r^2*P(z, zb, u)))))

IsTetrad(T__4)

`Type of tetrad: `*null

 

true

(30)

WeylScalars(T__4)

psi__0 = 0, psi__1 = 0, psi__2 = -(1/6)*(-(diff(diff(H(X), r), r))*r^2+2*(diff(H(X), r))*r+2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)-2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))-2*H(X))/r^2, psi__3 = 1, psi__4 = 0

(31)

These are the same scalars computed in one go in (13)

psi__0 = 0, psi__1 = 0, psi__2 = -(1/6)*(-(diff(diff(H(X), r), r))*r^2+2*(diff(H(X), r))*r-2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))+2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)-2*H(X))/r^2, psi__3 = 1, psi__4 = 0

psi__0 = 0, psi__1 = 0, psi__2 = -(1/6)*(-(diff(diff(H(X), r), r))*r^2+2*(diff(H(X), r))*r-2*(diff(P(z, zb, u), z))*(diff(P(z, zb, u), zb))+2*(diff(diff(P(z, zb, u), z), zb))*P(z, zb, u)-2*H(X))/r^2, psi__3 = 1, psi__4 = 0

(32)

``


 

Download The_metric_[27_37_1]_in_canonical_form.mw

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

Hi,
Some people using the Windows platform have had problems installing MapleCloud packages, including the Maplesoft Physics Updates. This problem does not happen in Macintosh or Linux/Unix, also does not happen with all Windows computers but with some of them, and is not a problem of the MapleCloud packages themselves, but a problem of the installer of packages.

I understand that a solution to this problem will be presented within an upcoming Maple dot release.

Meantime, there is a solution by installing a helper library; after that, MapleCloud packages install without problems in all Windows machines. So whoever is having trouble installing MapleCloud packages in Windows and prefers not to wait until that dot release, instead wants to install this helper library, please email me at physics@maplesoft.com

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

Caution, certain kinds of earlier input can affect the results from using the 2D Input syntax for operator assignment.

kernelopts(version)

`Maple 2020.1, X86 64 LINUX, Jun 8 2020, Build ID 1474533`

restart

f := proc (x) options operator, arrow; sqrt(x) end proc


The following now produces a remember-table assignment,
instead of assigning a procedure to name f, even though by default
     Typesetting:-Settings(functionassign)
is set to true.

"f(x):=x^(2)*sin(x)"

x^2*sin(x)

f(t)

t^(1/2)

f(1.4), 1.4^2*sin(1.4)

1.183215957, 1.931481471

restart

NULL


With the previous line of code commented-out the following
line assigns a procedure to name f, as expected.

If you uncomment the previous line, and re-execute the whole
worksheet using !!! from the menubar, then the following will
do a remember-table assignment instead.

"f(x):=x^(2)*sin(x)"

proc (x) options operator, arrow, function_assign; x^2*sin(x) end proc

f(t)

t^2*sin(t)

f(1.4), 1.4^2*sin(1.4)

1.931481471, 1.931481471

``

Download operator_assignment_2dmath.mw

We have just released an update to Maple, Maple 2020.1.1. This update includes the following:

  • Correction to a problem that occurred when printing or exporting documents to PDF. If the document included a 3-D plot, nearby text was sometimes missing from the printed/exported document.
  • Correction to an issue that prevented users from installing between-release updates to the Physics package

This update is available through Tools>Check for Updates in Maple, and is also available from our website on the Maple 2020.1.1 download page. If you are a MapleSim user, you can obtain this update from the corresponding MapleSim menu or MapleSim 2020.1.1  download page.

In particular, please note that this update fixes the problems reported on MaplePrimes in Maple 2020.1 issue with print to PDF  and installing the Maplesoft Physics updates. As always, we appreciate the feedback.

One way to find the equation of an ellipse circumscribed around a triangle. In this case, we solve a linear system of equations, which is obtained after fixing the values of two variables ( t1 and t2). These are five equations: three equations of the second-order curve at three vertices of the triangle and two equations of a linear combination of the coordinates of the gradient of the curve equation.
The solving of system takes place in the ELS procedure. When solving, hyperboles appear, so the program has a filter. The filter passes the equations of ellipses based on by checking the values of the invariants of the second-order curves.
FOR_ELL_ТR_OUT_PROCE_F.mw  ( Fixed comments in the text  01, 08, 2020)

@ianmccr posted here about making help for a package using makehelp. Here I show how to do this with the HelpTools package.

The attached worksheet shows how to create the help database for the Orbitals package available at the Applications Center or in the Maple Cloud. The help pages were created as worksheets - start using an existing help page as a model - use View/Open Page As Worksheet and then save from there. The topics and other information are entered by adding Attributes under File/Document Properties - for example for the realY help page these are:

Active=false means a regular help page; Active=true means an example worksheet.

There may be several aliases, for example the cartesion help page also describes the fullcartesian command and so Alias is: Orbitals[fullcartesian],cartesian,fullcartesian and Keyword is: Orbitals,cartesian,fullcartesian

Once a worksheet is created for each help page they are assembled into the help database with the attached file. More information is in the attached file

Orbitals_Make_help_database.mw

MacDude posted a worksheet for creating help files using the makehelp command that I found very useful.  However, his worksheet created a table of contents that organized the command help pages under a single folder.  I wanted to create a help file table of contents with the commands organized into sub-folders under the main application folder. ie. Package Name,Folder Name, command. The help page for makehelp is not very informative; in particular the example that shows (purportedly) how to override the existing help pages with your own help file is very misleading.  Also, the description of the parameters to the browser option of the makehelp command is too vague. I needed an error message to tell me that the browser option expects parameters in the form List(Name,String).  In the end, I was able to get a folder/sub-folder structure using a structure [`Folder Name`,`Subfolder Name`,"Command"].  Sub-folders are sorted alphabetically. If anyone has a need, the attached worksheet shows how I created the table of contents structure. 

helpcode.mw

I like tweaking plots to get the look and feel I want, and luckily Maple has many plotting options that I often play with. Here, I visualize the same data several times, but each time with different styling.

First, some data.

restart:
data_1 := [[0,0],[1,2],[2,1.3],[3,6]]:
data_2 := [[0.5,3],[1,1],[2,5],[3,2]]:
data_3 := [[-0.5,3],[1.3,1],[2.5,5],[4.5,2]]:

This is the default look.

plot([data_1, data_2, data_3])

I think the darker background on this plot makes it easier to look at.

gray_grid :=
 background      = "LightGrey"
,color           = [ ColorTools:-Color("RGB",[150/255, 40 /255, 27 /255])
                    ,ColorTools:-Color("RGB",[0  /255, 0  /255, 0  /255])
                    ,ColorTools:-Color("RGB",[68 /255, 108/255, 179/255]) ]
,axes            = frame
,axis[2]         = [color = black, gridlines = [10, thickness = 1, color = ColorTools:-Color("RGB", [1, 1, 1])]]
,axis[1]         = [color = black, gridlines = [10, thickness = 1, color = ColorTools:-Color("RGB", [1, 1, 1])]]
,axesfont        = [Arial]
,labelfont       = [Arial]
,size            = [400*1.78, 400]
,labeldirections = [horizontal, vertical]
,filled          = false
,transparency    = 0
,thickness       = 5
,style           = line:

plot([data_1, data_2, data_3], gray_grid);

I call the next style Excel, for obvious reasons.

excel :=
 background      = white
,color           = [ ColorTools:-Color("RGB",[79/255,  129/255, 189/255])
                    ,ColorTools:-Color("RGB",[192/255, 80/255,   77/255])
                    ,ColorTools:-Color("RGB",[155/255, 187/255,  89/255])]
,axes            = frame
,axis[2]         = [gridlines = [10, thickness = 0, color = ColorTools:-Color("RGB",[134/255,134/255,134/255])]]
,font            = [Calibri]
,labelfont       = [Calibri]
,size            = [400*1.78, 400]
,labeldirections = [horizontal, vertical]
,transparency    = 0
,thickness       = 3
,style           = point
,symbol          = [soliddiamond, solidbox, solidcircle]
,symbolsize      = 15:

plot([data_1, data_2, data_3], excel)

This style makes the plot look a bit like the oscilloscope I have in my garage.

dark_gridlines :=
 background      = ColorTools:-Color("RGB",[0,0,0])
,color           = white
,axes            = frame
,linestyle       = [solid, dash, dashdot]
,axis            = [gridlines = [10, linestyle = dot, color = ColorTools:-Color("RGB",[0.5, 0.5, 0.5])]]
,font            = [Arial]
,size            = [400*1.78, 400]:

plot([data_1, data_2, data_3], dark_gridlines);

The colors in the next style remind me of an Autumn morning.

autumnal :=
 background      =  ColorTools:-Color("RGB",[236/255, 240/255, 241/255])
,color           = [  ColorTools:-Color("RGB",[144/255, 54/255, 24/255])
                     ,ColorTools:-Color("RGB",[105/255, 108/255, 51/255])
                     ,ColorTools:-Color("RGB",[131/255, 112/255, 82/255]) ]
,axes            = frame
,font            = [Arial]
,size            = [400*1.78, 400]
,filled          = true
,axis[2]         = [gridlines = [10, thickness = 1, color = white]]
,axis[1]         = [gridlines = [10, thickness = 1, color = white]]
,symbol          = solidcircle
,style           = point
,transparency    = [0.6, 0.4, 0.2]:

plot([data_1, data_2, data_3], autumnal);

In honor of a friend and ex-colleague, I call this style "The Swedish".

swedish :=
 background      = ColorTools:-Color("RGB", [0/255, 107/255, 168/255])
,color           = [ ColorTools:-Color("RGB",[169/255, 158/255, 112/255])
                    ,ColorTools:-Color("RGB",[126/255,  24/255,   9/255])
                    ,ColorTools:-Color("RGB",[254/255, 205/255,   0/255])]
,axes            = frame
,axis            = [gridlines = [10, color = ColorTools:-Color("RGB",[134/255,134/255,134/255])]]
,font            = [Arial]
,size            = [400*1.78, 400]
,labeldirections = [horizontal, vertical]
,filled          = false
,thickness       = 10:

plot([data_1, data_2, data_3], swedish);

This looks like a plot from a journal article.

experimental_data_mono :=

background       = white
,color           = black
,axes            = box
,axis            = [gridlines = [linestyle = dot, color = ColorTools:-Color("RGB",[0.5, 0.5, 0.5])]]
,font            = [Arial, 11]
,legendstyle     = [font = [Arial, 11]]
,size            = [400, 400]
,labeldirections = [horizontal, vertical]
,style           = point
,symbol          = [solidcircle, solidbox, soliddiamond]
,symbolsize      = [15,15,20]:

plot([data_1, data_2, data_3], experimental_data_mono, legend = ["Annihilation", "Authority", "Acceptance"]);

If you're willing to tinker a little bit, you can add some real character and personality to your visualizations. Try it!

I'd also be very interested to learn what you find attractive in a plot - please do let me know.

We have just released an update to Maple, Maple 2020.1.

Maple 2020.1 includes corrections and improvement to the mathematics engine, export to PDF, MATLAB connectivity, support for Ubuntu 20.04, and more.  We recommend that all Maple 2020 users install these updates.

This update is available through Tools>Check for Updates in Maple, and is also available from our website on the Maple 2020.1 download page, where you can also find more details.

In particular, please note that this update includes a fix to the SMTLIB problem reported on MaplePrimes. Thanks for the feedback!

 

We’re excited to announce a new version of MapleSim! The MapleSim 2020 family of products lets you build and test models faster than ever, including faster simulations, powerful new tools for machine builders, and expanded modeling capabilities. Improvements include:

  • Faster results, with more efficient models, faster simulations, and more powerful design tools.
  • Powerful new features for machine builders, with new components, improved visualizations, and automation-focused connectivity tools that make it faster than ever to build and test digital twins.
  • Improved modeling capabilities, with an extensive collection of updates to components, libraries, and analysis tools.
  • More realistic machine visualizations with an expanded Kinematic Cam Generation App.
  • New product: MapleSim Insight, giving machine builders powerful, simulation-based debugging and 3-D visualization capabilities that connect directly to common automation platforms.
  • New add-on library:  MapleSim Ropes and Pulleys Library for the easy creation of winch and pulley systems as part of your machine development. 

See What’s New in MapleSim 2020 for more information about these and other improvements!
 

This is my attempt to produce a subplot within a larger plot for magnifying data in a small region, and putting that subplot into the white space of the figure.
Based on the questions: How to insert a plot into another plot? and Inset figure in Maple, I wrote a couple of procedures that create sub-plots and allow the user to place the subplot window as he/she chooses. This avoids the graininess issues mentioned by acer in the second link (and experienced by me).

So far, I only have this completed for point plots, but using acer's method of piecewise functions posted in the plotin2b.mw of the second article, with the subplot function being defined only if it satisfies your conditions, would allow the subplot generating procedure to be generalized easily enough. But the data I'm working with all point plots, so that's the example here.

The basic idea  is to use one procedure to create boxes, make tickmarks on the expanded region, and make tickmark labels, combine all of those into one graph. Then create scaled and shifted versions of the data series, then make graphs of those. Lastly, combine them all into one picture.

Hope this helps someone who has to do the same.

Mapleprimes isn't inserting the contents, but here is the download of the file: SubPlotBoxesandVectorDataSeries.mw

 

The equations of motion in curvilinear coordinates, tensor notation and Coriolis force

``

 

The formulation of the equations of motion of a particle is simple in Cartesian coordinates using vector notation. However, depending on the problem, for example when describing the motion of a particle as seen from a non-inertial system of references (e.g. a rotating planet, like earth), there is advantage in using curvilinear coordinates and also tensor notation. When the particle's movement is observed from such a rotating referential, we also see "acceleration" that is not due to any force but to the fact that the referential itself is accelerated. The material below discusses and formulates these topics, and derives the expression for the Coriolis and centripetal force in cylindrical coordinates as seen from a rotating system of references.

 

The computation below is reproducible in Maple 2020 using the Maplesoft Physics Updates v.681 or newer.

 

Vector notation

 

Generally speaking the equations of motion of a particle are easy to formulate: the position vector is a function of time, the velocity is its first derivative and the acceleration is its second derivative. For instance, in Cartesian coordinates

with(Physics); with(Vectors)

r_(t) = x(t)*_i+y(t)*_j+z(t)*_k

r_(t) = x(t)*_i+y(t)*_j+z(t)*_k

(1)

diff(r_(t) = x(t)*_i+y(t)*_j+z(t)*_k, t)

diff(r_(t), t) = (diff(x(t), t))*_i+(diff(y(t), t))*_j+(diff(z(t), t))*_k

(2)

diff(diff(r_(t), t) = (diff(x(t), t))*_i+(diff(y(t), t))*_j+(diff(z(t), t))*_k, t)

diff(diff(r_(t), t), t) = (diff(diff(x(t), t), t))*_i+(diff(diff(y(t), t), t))*_j+(diff(diff(z(t), t), t))*_k

(3)

Newton's 2nd law, that in an inertial system of references when there is force there is acceleration and viceversa, is then given by

F_(t) = m*lhs(diff(diff(r_(t), t), t) = (diff(diff(x(t), t), t))*_i+(diff(diff(y(t), t), t))*_j+(diff(diff(z(t), t), t))*_k)

F_(t) = m*(diff(diff(r_(t), t), t))

(4)

where `#mover(mi("F"),mo("&rarr;"))`(t) = F__x(t)*`#mover(mi("i"),mo("&and;"))`+F__y(t)*`#mover(mi("j"),mo("&and;"))`+F__z(t)*`#mover(mi("k"),mo("&and;"))` represents the total force acting on the particle. This vectorial equation represents three second order differential equations which, for given initial conditions, can be integrated to arrive at a closed form expression for `#mover(mi("r"),mo("&rarr;"))`(t) as a function of t.

 

Tensor notation

 

In Cartesian coordinates, the tensorial form of the equations (4) is also straightforward. In a flat spacetime - Galilean system of references - the three space coordinates x, y, z form a 3D tensor, and so does its first derivate and the second one. Set the spacetime to be 3-dimensional and Euclidean and use lowercaselatin indices for the corresponding tensors

Setup(coordinates = cartesian, metric = Euclidean, dimension = 3, spacetimeindices = lowercaselatin)

`The dimension and signature of the tensor space are set to `[3, `+ + +`]

 

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

 

_______________________________________________________

 

`The Euclidean metric in coordinates `*[x, y, z]

 

_______________________________________________________

 

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

 

_______________________________________________________

(5)

The position, velocity and acceleration vectors are expressed in tensor notation as done in (1), (2) and (3)

X[j](t)

(X)[j](t)

(6)

diff((X)[j](t), t)

Physics:-Vectors:-diff((Physics:-SpaceTimeVector[j](X))(t), t)

(7)

diff(Physics[Vectors]:-diff((Physics[SpaceTimeVector][j](X))(t), t), t)

Physics:-Vectors:-diff(Physics:-Vectors:-diff((Physics:-SpaceTimeVector[j](X))(t), t), t)

(8)

Setting a tensor F__j(t) to represent the three Cartesian components of the force

Define(F[j] = [F__x(t), F__y(t), F__z(t)])

`Defined objects with tensor properties`

 

{Physics:-Dgamma[a], F[j], Physics:-Psigma[a], Physics:-d_[a], Physics:-g_[a, b], Physics:-LeviCivita[a, b, c], Physics:-SpaceTimeVector[a](X)}

(9)

Newton's 2nd law (4), now expressed in tensorial notation, is given by

F[j] = m*Physics[Vectors]:-diff(Physics[Vectors]:-diff((Physics[SpaceTimeVector][j](X))(t), t), t)

F[j] = m*(diff(diff((Physics:-SpaceTimeVector[j](X))(t), t), t))

(10)

The three differential equations behind this tensorial form of (4) are as expected

TensorArray(F[j] = m*(diff(diff((Physics[SpaceTimeVector][j](X))(t), t), t)), output = setofequations)

{F__x(t) = m*(diff(diff(x(t), t), t)), F__y(t) = m*(diff(diff(y(t), t), t)), F__z(t) = m*(diff(diff(z(t), t), t))}

(11)

Things are straightforward in Cartesian coordinates because the components of the line element `#mover(mi("dr"),mo("&rarr;"))` = dx*`#mover(mi("i"),mo("&and;"))`+dy*`#mover(mi("j"),mo("&and;"))`+dz*`#mover(mi("k"),mo("&and;"))` are exactly the components of the tensor d(X[j])

TensorArray(d_(X[j]))

Array(%id = 18446744078354237310)

(12)

and so, the form factors (see related Mapleprimes post) are all equal to 1.

 

In the case of no external forces, `#mover(mi("F"),mo("&rarr;"))`(t) = 0 and 0 = F[j] and the equations of motion, whose solution are the trajectory, can be formulated as the path of minimal length between two points, a geodesic. In the case under consideration, because the spacetime is flat (Galilean) those two points lie on a plane, we are talking about Euclidean geometry, that information is encoded in the metric (the 3x3 identity matrix (5)), and the geodesic is a straight line. The differential equations of this geodesic are thus the equations of motion (11) with  `#mover(mi("F"),mo("&rarr;"))`(t) = 0, and can be computed using Geodesics

 

Geodesics(t)

[diff(diff(z(t), t), t) = 0, diff(diff(y(t), t), t) = 0, diff(diff(x(t), t), t) = 0]

(13)

 

Curvilinear coordinates

 

Vector notation

 

The form of these equations in the case of curvilinear coordinates, for example in cylindrical or spherical variables, is obtained performing a change of coordinates.

tr := `~`[`=`]([X], ChangeCoordinates([X], cylindrical))

[x = rho*cos(phi), y = rho*sin(phi), z = z]

(14)

This change keeps the z axis unchanged, so the corresponding unit vector `#mover(mi("k"),mo("&and;"))` remains unchanged.

Changing the basis and coordinates used to represent the position vector `#mover(mi("r"),mo("&rarr;"))`(t) = x(t)*`#mover(mi("i"),mo("&and;"))`+y(t)*`#mover(mi("j"),mo("&and;"))`+z(t)*`#mover(mi("k"),mo("&and;"))`, it becomes

r_(t) = ChangeBasis(rhs(r_(t) = x(t)*_i+y(t)*_j+z(t)*_k), cylindrical, alsocomponents)

r_(t) = z(t)*_k+rho(t)*_rho(t)

(15)

where since in (1) the coordinates (x, y, z) depend on t, in (15), not just rho(t) and z(t) but also the unit vector `#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`(t)depends on t. The velocity is computed as usual, differentiating

diff(r_(t) = z(t)*_k+rho(t)*_rho(t), t)

diff(r_(t), t) = (diff(z(t), t))*_k+(diff(rho(t), t))*_rho(t)+rho(t)*(diff(phi(t), t))*_phi(t)

(16)

The second term is due to the dependency of `#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))` on the coordinate phi together with the chain rule diff(`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`(t), t) = (diff(`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`, phi))*(diff(phi(t), t)) and (diff(`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`, phi))*(diff(phi(t), t)) = `#mover(mi("&phi;",fontstyle = "normal"),mo("&and;"))`(t)*(diff(phi(t), t)). The dependency of curvilinear unit vectors on the coordinates is automatically taken into account when differentiating due to the Setup setting geometricdifferentiation = true.

 

For the acceleration,

diff(diff(r_(t), t) = (diff(z(t), t))*_k+(diff(rho(t), t))*_rho(t)+rho(t)*(diff(phi(t), t))*_phi(t), t)

diff(diff(r_(t), t), t) = _rho(t)*(diff(diff(rho(t), t), t)-rho(t)*(diff(phi(t), t))^2)+_phi(t)*(2*(diff(rho(t), t))*(diff(phi(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k

(17)

where the term involving (diff(phi(t), t))^2 comes from differentiating `#mover(mi("&phi;",fontstyle = "normal"),mo("&and;"))`(t) in (16) taking into account the dependency of `#mover(mi("&phi;",fontstyle = "normal"),mo("&and;"))` on the coordinate "phi." This result can also be obtained by directly changing variables in the acceleration diff(`#mover(mi("r"),mo("&rarr;"))`(t), t, t), in equation (3)

lhs(diff(diff(r_(t), t), t) = (diff(diff(x(t), t), t))*_i+(diff(diff(y(t), t), t))*_j+(diff(diff(z(t), t), t))*_k) = ChangeBasis(rhs(diff(diff(r_(t), t), t) = (diff(diff(x(t), t), t))*_i+(diff(diff(y(t), t), t))*_j+(diff(diff(z(t), t), t))*_k), cylindrical, alsocomponents)

diff(diff(r_(t), t), t) = _rho(t)*(diff(diff(rho(t), t), t)-rho(t)*(diff(phi(t), t))^2)+_phi(t)*(2*(diff(rho(t), t))*(diff(phi(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k

(18)

 

Newton's 2nd law becomes

F_(t) = m*rhs(diff(diff(r_(t), t), t) = _rho(t)*(diff(diff(rho(t), t), t)-rho(t)*(diff(phi(t), t))^2)+_phi(t)*(2*(diff(rho(t), t))*(diff(phi(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k)

F_(t) = m*(_rho(t)*(diff(diff(rho(t), t), t)-rho(t)*(diff(phi(t), t))^2)+_phi(t)*(2*(diff(rho(t), t))*(diff(phi(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k)

(19)

In the absence of external forces, equating to 0 the vector components (coefficients of the unit vectors) of the acceleration diff(`#mover(mi("r"),mo("&rarr;"))`(t), t, t)we get the system of differential equations in cylindrical coordinates whose solution is the trajectory of the particle expressed in the ("rho(t),phi(t),z(t))"

`~`[`=`]({coeffs(rhs(diff(diff(r_(t), t), t) = _rho(t)*(diff(diff(rho(t), t), t)-rho(t)*(diff(phi(t), t))^2)+_phi(t)*(2*(diff(rho(t), t))*(diff(phi(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k), [`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`(t), `#mover(mi("&phi;",fontstyle = "normal"),mo("&and;"))`(t), `#mover(mi("k"),mo("&and;"))`])}, 0)

{2*(diff(rho(t), t))*(diff(phi(t), t))+rho(t)*(diff(diff(phi(t), t), t)) = 0, diff(diff(rho(t), t), t)-rho(t)*(diff(phi(t), t))^2 = 0, diff(diff(z(t), t), t) = 0}

(20)

solve({2*(diff(rho(t), t))*(diff(phi(t), t))+rho(t)*(diff(diff(phi(t), t), t)) = 0, diff(diff(rho(t), t), t)-rho(t)*(diff(phi(t), t))^2 = 0, diff(diff(z(t), t), t) = 0}, {diff(phi(t), t, t), diff(rho(t), t, t), diff(z(t), t, t)})

{diff(diff(phi(t), t), t) = -2*(diff(rho(t), t))*(diff(phi(t), t))/rho(t), diff(diff(rho(t), t), t) = rho(t)*(diff(phi(t), t))^2, diff(diff(z(t), t), t) = 0}

(21)

In this formulation (21) with `#mover(mi("F"),mo("&rarr;"))`(t) = 0, although diff(z(t), t, t) = 0, no acceleration in the `#mover(mi("k"),mo("&and;"))` direction, is naturally expected, the same cannot be said about the other two equations for diff(phi(t), t, t) and diff(rho(t), t, t). Those two equations are discussed below under Coriolis and Centripetal forces. The key observation at this point, however, is that the right-hand sides of both unexpected equations involve diff(phi(t), t), rotation around the z axis.

 

Tensor notation

 

The same equations (19) and (21) result when using tensor notation. For that purpose, one can transform the position, velocity and acceleration tensors (6), (7), (8), but since they are expressed as functions of a parameter (the time), it is simpler to transform only the underlying metric using TransformCoordinates. That has the advantage that all the geometrical subtleties of curvilinear coordinates, like scale factors and dependency of unit vectors on curvilinear coordinates, get automatically, very succinctly, encoded in the metric:

TransformCoordinates(tr, g_[j, k], [rho, phi, z], setmetric)

_______________________________________________________

 

`Coordinates: `[rho, phi, z]*`. Signature: `(`+ + +`)

 

_______________________________________________________

 

Physics:-g_[a, b] = Matrix(%id = 18446744078263848958)

 

_______________________________________________________

(22)

The computation of geodesics assumes that the coordinates (rho, phi, z) depend on a parameter. That parameter is passed as the first argument to Geodesics

Geodesics(t)

[diff(diff(rho(t), t), t) = rho(t)*(diff(phi(t), t))^2, diff(diff(phi(t), t), t) = -2*(diff(rho(t), t))*(diff(phi(t), t))/rho(t), diff(diff(z(t), t), t) = 0]

(23)

These equations of motion (23) are the same as the equations (21) computed using standard vector notation, differentiating and taking into account the dependency of curvilinear unit vectors on the curvilinear coordinates in (16) and (17).  One of the interesting features of computing with tensors is, as said, that all those geometrical algebraic subtleties of curvilinear coordinates are automatically encoded in the metric (22).

 

To understand how are the geodesic equations computed in one go in (23), one can perform the calculation in steps:

1. 

Make rho be a function of t directly in the metric

2. 

Compute - not the final form of the equations (23) - but the intermediate form expressing the geodesic equation using tensor notation, in terms of Christoffel symbols

3. 

Compute the components of that tensorial equation for the geodesic (using TensorArray)

 

For step 1, we have

subs(rho = rho(t), g_[])

Physics:-g_[a, b] = Matrix(%id = 18446744078354237910)

(24)

Set this metric where `&equiv;`(rho, rho(t))

"Setup(?):"

_______________________________________________________

 

`Coordinates: `[rho, phi, z]*`. Signature: `(`+ + +`)

 

_______________________________________________________

 

Physics:-g_[a, b] = Matrix(%id = 18446744078342604430)

 

_______________________________________________________

(25)

Step 2, the geodesic equations in tensor notation with the coordinates depending on the time t are computed passing the optional argument tensornotation

Geodesics(t, tensornotation)

diff(diff((Physics:-SpaceTimeVector[`~a`](X))(t), t), t)+Physics:-Christoffel[`~a`, b, c]*(diff((Physics:-SpaceTimeVector[`~b`](X))(t), t))*(diff((Physics:-SpaceTimeVector[`~c`](X))(t), t)) = 0

(26)

Step 3: compute the components of this tensorial equation

TensorArray(diff(diff((Physics[SpaceTimeVector][`~a`](X))(t), t), t)+Physics[Christoffel][`~a`, b, c]*(diff((Physics[SpaceTimeVector][`~b`](X))(t), t))*(diff((Physics[SpaceTimeVector][`~c`](X))(t), t)) = 0, output = listofequations)

[diff(diff(rho(t), t), t)-rho(t)*(diff(phi(t), t))^2 = 0, diff(diff(phi(t), t), t)+2*(diff(rho(t), t))*(diff(phi(t), t))/rho(t) = 0, diff(diff(z(t), t), t) = 0]

(27)

These are the same equations (23).

 

Having the tensorial equation (26) is also useful to formulate the equations of motion in tensorial form in the presence of force. For that purpose, redefine the contravariant tensor F^j to represent the force in the cylindrical basis

Define(F[`~j`] = [`F__&rho;`(t), `F__&phi;`(t), F__z(t)])

`Defined objects with tensor properties`

 

{Physics:-D_[a], Physics:-Dgamma[a], F[j], Physics:-Psigma[a], Physics:-Ricci[a, b], Physics:-Riemann[a, b, c, d], Physics:-Weyl[a, b, c, d], Physics:-d_[a], Physics:-g_[a, b], Physics:-Christoffel[a, b, c], Physics:-Einstein[a, b], Physics:-LeviCivita[a, b, c], Physics:-SpaceTimeVector[a](X)}

(28)

 

Newton's 2nd law (19)

F_(t) = m*(_rho(t)*(diff(diff(rho(t), t), t)-rho(t)*(diff(phi(t), t))^2)+_phi(t)*(2*(diff(rho(t), t))*(diff(phi(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k)

F_(t) = m*(_rho(t)*(diff(diff(rho(t), t), t)-rho(t)*(diff(phi(t), t))^2)+_phi(t)*(2*(diff(rho(t), t))*(diff(phi(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k)

(29)

now using tensorial notation, becomes

F[`~a`] = m*lhs(diff(diff((Physics[SpaceTimeVector][`~a`](X))(t), t), t)+Physics[Christoffel][`~a`, b, c]*(diff((Physics[SpaceTimeVector][`~b`](X))(t), t))*(diff((Physics[SpaceTimeVector][`~c`](X))(t), t)) = 0)

F[`~a`] = m*(diff(diff((Physics:-SpaceTimeVector[`~a`](X))(t), t), t)+Physics:-Christoffel[`~a`, b, c]*(diff((Physics:-SpaceTimeVector[`~b`](X))(t), t))*(diff((Physics:-SpaceTimeVector[`~c`](X))(t), t)))

(30)

TensorArray(F[`~a`] = m*(diff(diff((Physics[SpaceTimeVector][`~a`](X))(t), t), t)+Physics[Christoffel][`~a`, b, c]*(diff((Physics[SpaceTimeVector][`~b`](X))(t), t))*(diff((Physics[SpaceTimeVector][`~c`](X))(t), t))))

Array(%id = 18446744078329063774)

(31)

where we recall (see related Mapleprimes post) that to obtain the vector components entering `#mover(mi("F"),mo("&rarr;"))`(t) from these tensor components F[`~a`]we need to multiply the latter by the scale factors (1, rho(t), 1), the component of `#mover(mi("F"),mo("&rarr;"))`(t) in the direction of `#mover(mi("&phi;",fontstyle = "normal"),mo("&and;"))` is given by rho(t)*m*(diff(phi(t), t, t)+2*(diff(rho(t), t))*(diff(phi(t), t))/rho(t)).

 

Coriolis force and centripetal force

 

After changing variables the position vector of the particle got expressed in (15) as

 

`#mover(mi("r"),mo("&rarr;"))`(t) = z(t)*`#mover(mi("k"),mo("&and;"))`+`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`(t)*rho(t)

 

A distinction needs to be made here, according to whether the unit vector `#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))` depends or not on the time t, the former being the general case. When `#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))` is a constant, the value of the coordinate phi - the angle between `#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))` and the x axis - does not change, there is no rotation around the z axis. On the other hand, when `&equiv;`(`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`, `#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`(t)), the orientation of `#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))` and so the coordinate phi changes with time, so either the force `#mover(mi("F"),mo("&rarr;"))`(t)acting on the particle has a component in the `#mover(mi("&phi;",fontstyle = "normal"),mo("&and;"))` direction that produces rotation around the z axis, or the system of references - itself - is rotating around the z axis.

 

Likewise, the expression (15)  can represent the position vector measured in the original Galilean (inertial) system of references, where a force `#mover(mi("F"),mo("&rarr;"))`(t)is producing rotation around the z axis, or it can represent the position of the particle measured in a rotating, non-inertial system references. Hence the transformation (14) can also be interpreted in two different ways, as representing a choice of different functions (generalized coordinates) to represent the position of the particle in the original inertial system of references, or it can represent a transformation from an inertial to another rotating, non-inertial, system of references.

 

This equivalence between the trajectory of a particle subject to an external force, as observed in an inertial system of references, and the same trajectory observed from a non-inertial accelerated system of references where there is no external force, actually at the root of the formulation of general relativity, is also well known in classical mechanics. The (apparent) forces observed in the rotating non-inertial system of references, due only to its acceleration, are called Coriolis and centripetal forces.

 

To see that the equations

 

diff(rho(t), t, t) = (diff(phi(t), t))^2*rho(t), diff(phi(t), t, t) = -2*(diff(phi(t), t))*(diff(rho(t), t))/rho(t)

 

that appeared in (27) when in the inertial system of references `#mover(mi("F"),mo("&rarr;"))`(t) = m*(diff(`#mover(mi("r"),mo("&rarr;"))`(t), t, t)) and m*(diff(`#mover(mi("r"),mo("&rarr;"))`(t), t, t)) = 0, are related to the Coriolis and centripetal forces in the non-inertial referencial, following [1] introduce a vector `#mover(mi("&omega;",fontstyle = "normal"),mo("&rarr;"))`representing the rotation of that referencial around the z axis (when, in the inertial system of references, the non-inertial system rotates clockwise, in the non-inertial system phi increases in value in the anti-clockwise direction)

`#mover(mi("&omega;",fontstyle = "normal"),mo("&rarr;"))` = -(diff(phi(t), t))*`#mover(mi("k"),mo("&and;"))`

omega_ = -(diff(phi(t), t))*_k

(32)

According to [1], (39.7), the acceleration diff(`#mover(mi("r"),mo("&rarr;"))`(t), t, t)in the inertial system is expressed in terms of the quantities in the non-inertial rotating system by the sum of the following three vectorial terms.

First, the components of the acceleration `#mover(mi("a"),mo("&rarr;"))`(t)measured in the non-inertial system are given by the second derivatives of the coordinates (rho(t), phi(t), z(t)) multiplied by the scale factors, which in this case are given by (1, rho(t), 1) (see this post in Mapleprimes)

`#mover(mi("a"),mo("&rarr;"))`(t) = (diff(rho(t), t, t))*`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`(t)+rho(t)*(diff(phi(t), t, t))*`#mover(mi("&phi;",fontstyle = "normal"),mo("&and;"))`(t)+(diff(z(t), t, t))*`#mover(mi("k"),mo("&and;"))`

a_(t) = (diff(diff(rho(t), t), t))*_rho(t)+rho(t)*(diff(diff(phi(t), t), t))*_phi(t)+(diff(diff(z(t), t), t))*_k

(33)

Second, the Coriolis force divided by the mass, by definition given by

2*`&x`(diff(r_(t), t) = (diff(z(t), t))*_k+(diff(rho(t), t))*_rho(t)+rho(t)*(diff(phi(t), t))*_phi(t), omega_ = -(diff(phi(t), t))*_k)

2*Physics:-Vectors:-`&x`(diff(r_(t), t), omega_) = -2*rho(t)*(diff(phi(t), t))^2*_rho(t)+2*(diff(rho(t), t))*(diff(phi(t), t))*_phi(t)

(34)

Third the centripetal force divided by the mass, defined by

`&x`(omega_ = -(diff(phi(t), t))*_k, `&x`(r_(t) = z(t)*_k+rho(t)*_rho(t), omega_ = -(diff(phi(t), t))*_k))

Physics:-Vectors:-`&x`(omega_, Physics:-Vectors:-`&x`(r_(t), omega_)) = rho(t)*(diff(phi(t), t))^2*_rho(t)

(35)

Adding these three terms,

(a_(t) = (diff(diff(rho(t), t), t))*_rho(t)+rho(t)*(diff(diff(phi(t), t), t))*_phi(t)+(diff(diff(z(t), t), t))*_k)+(2*Physics[Vectors][`&x`](diff(r_(t), t), omega_) = -2*rho(t)*(diff(phi(t), t))^2*_rho(t)+2*(diff(rho(t), t))*(diff(phi(t), t))*_phi(t))+(Physics[Vectors][`&x`](omega_, Physics[Vectors][`&x`](r_(t), omega_)) = rho(t)*(diff(phi(t), t))^2*_rho(t))

a_(t)+2*Physics:-Vectors:-`&x`(diff(r_(t), t), omega_)+Physics:-Vectors:-`&x`(omega_, Physics:-Vectors:-`&x`(r_(t), omega_)) = _rho(t)*(diff(diff(rho(t), t), t)-rho(t)*(diff(phi(t), t))^2)+_phi(t)*(2*(diff(rho(t), t))*(diff(phi(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k

(36)

So that

diff(`#mover(mi("r"),mo("&rarr;"))`(t), t, t) = lhs(a_(t)+2*Physics[Vectors][`&x`](diff(r_(t), t), omega_)+Physics[Vectors][`&x`](omega_, Physics[Vectors][`&x`](r_(t), omega_)) = _rho(t)*(diff(diff(rho(t), t), t)-(diff(phi(t), t))^2*rho(t))+_phi(t)*(2*(diff(phi(t), t))*(diff(rho(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k)

diff(diff(r_(t), t), t) = a_(t)+2*Physics:-Vectors:-`&x`(diff(r_(t), t), omega_)+Physics:-Vectors:-`&x`(omega_, Physics:-Vectors:-`&x`(r_(t), omega_))

(37)

and where the right-hand side of (36) is, actually, the result computed lines above in (18)

diff(diff(r_(t), t), t) = _rho(t)*(diff(diff(rho(t), t), t)-(diff(phi(t), t))^2*rho(t))+_phi(t)*(2*(diff(phi(t), t))*(diff(rho(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k

diff(diff(r_(t), t), t) = _rho(t)*(diff(diff(rho(t), t), t)-rho(t)*(diff(phi(t), t))^2)+_phi(t)*(2*(diff(rho(t), t))*(diff(phi(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k

(38)

rhs(a_(t)+2*Physics[Vectors][`&x`](diff(r_(t), t), omega_)+Physics[Vectors][`&x`](omega_, Physics[Vectors][`&x`](r_(t), omega_)) = _rho(t)*(diff(diff(rho(t), t), t)-(diff(phi(t), t))^2*rho(t))+_phi(t)*(2*(diff(phi(t), t))*(diff(rho(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k)-rhs(diff(diff(r_(t), t), t) = _rho(t)*(diff(diff(rho(t), t), t)-(diff(phi(t), t))^2*rho(t))+_phi(t)*(2*(diff(phi(t), t))*(diff(rho(t), t))+rho(t)*(diff(diff(phi(t), t), t)))+(diff(diff(z(t), t), t))*_k)

0

(39)

From (37), in the absence of external forces diff(`#mover(mi("r"),mo("&rarr;"))`(t), t, t) = 0 and so the acceleration `#mover(mi("a"),mo("&rarr;"))`(t) measured in the rotating system is given by the sum of the Coriolis and centripetal accelerations

isolate(rhs(diff(diff(r_(t), t), t) = a_(t)+2*Physics[Vectors][`&x`](diff(r_(t), t), omega_)+Physics[Vectors][`&x`](omega_, Physics[Vectors][`&x`](r_(t), omega_))), `#mover(mi("a"),mo("&rarr;"))`(t))

a_(t) = -2*Physics:-Vectors:-`&x`(diff(r_(t), t), omega_)-Physics:-Vectors:-`&x`(omega_, Physics:-Vectors:-`&x`(r_(t), omega_))

(40)

In other words: in the absence of external forces, the acceleration of a particle observed in a rotating (non-inertial) system of references is not zero.

 

Expressing this equation (40) in terms of (rho(t), phi(t), z(t)) we get

subs(a_(t) = (diff(diff(rho(t), t), t))*_rho(t)+rho(t)*(diff(diff(phi(t), t), t))*_phi(t)+(diff(diff(z(t), t), t))*_k, -(2*Physics[Vectors][`&x`](diff(r_(t), t), omega_) = -2*rho(t)*(diff(phi(t), t))^2*_rho(t)+2*(diff(rho(t), t))*(diff(phi(t), t))*_phi(t)), Physics[Vectors][`&x`](omega_, Physics[Vectors][`&x`](r_(t), omega_)) = rho(t)*(diff(phi(t), t))^2*_rho(t), a_(t) = -2*Physics[Vectors][`&x`](diff(r_(t), t), omega_)-Physics[Vectors][`&x`](omega_, Physics[Vectors][`&x`](r_(t), omega_)))

(diff(diff(rho(t), t), t))*_rho(t)+rho(t)*(diff(diff(phi(t), t), t))*_phi(t)+(diff(diff(z(t), t), t))*_k = rho(t)*(diff(phi(t), t))^2*_rho(t)-2*(diff(rho(t), t))*(diff(phi(t), t))*_phi(t)

(41)

resulting in the three equations

((diff(diff(rho(t), t), t))*_rho(t)+rho(t)*(diff(diff(phi(t), t), t))*_phi(t)+(diff(diff(z(t), t), t))*_k = rho(t)*(diff(phi(t), t))^2*_rho(t)-2*(diff(rho(t), t))*(diff(phi(t), t))*_phi(t)).`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`(t)

diff(diff(rho(t), t), t) = rho(t)*(diff(phi(t), t))^2

(42)

((diff(diff(rho(t), t), t))*_rho(t)+rho(t)*(diff(diff(phi(t), t), t))*_phi(t)+(diff(diff(z(t), t), t))*_k = rho(t)*(diff(phi(t), t))^2*_rho(t)-2*(diff(rho(t), t))*(diff(phi(t), t))*_phi(t)).`#mover(mi("&phi;",fontstyle = "normal"),mo("&and;"))`(t)

rho(t)*(diff(diff(phi(t), t), t)) = -2*(diff(rho(t), t))*(diff(phi(t), t))

(43)

((diff(diff(rho(t), t), t))*_rho(t)+rho(t)*(diff(diff(phi(t), t), t))*_phi(t)+(diff(diff(z(t), t), t))*_k = rho(t)*(diff(phi(t), t))^2*_rho(t)-2*(diff(rho(t), t))*(diff(phi(t), t))*_phi(t)).`#mover(mi("k"),mo("&and;"))`

diff(diff(z(t), t), t) = 0

(44)

which are the equations returned by Geodesics in (23)

[diff(diff(rho(t), t), t) = rho(t)*(diff(phi(t), t))^2, diff(diff(phi(t), t), t) = -2*(diff(rho(t), t))*(diff(phi(t), t))/rho(t), diff(diff(z(t), t), t) = 0]

[diff(diff(rho(t), t), t) = rho(t)*(diff(phi(t), t))^2, diff(diff(phi(t), t), t) = -2*(diff(rho(t), t))*(diff(phi(t), t))/rho(t), diff(diff(z(t), t), t) = 0]

(45)

``

References

[1] L.D. Landau, E.M. Lifchitz, Mechanics, Course of Theoretical Physics, Volume 1, third edition, Elsevier.


 

Download The_equations_of_motion_in_curvilinear_coordinates.mw

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

Since we are getting many questions on how to create Math apps to add to the Maple Cloud. I wanted to go over the different GUI aspects of how you go about creating a Math App in Maple. The following Document also includes some code examples that are used in the the Math App but doesn't go into them in detail. For more details on the type of coding you do in a Math App see the DocumentTools package help page.

Some of the graphical features of the Math app don't display on Maple Primes so I'd recommend downloading this worksheet from here: HowToMathApp.mw to follow along.


 

NULL

How to make a Math App (An example of using the Document Tools).

 

This Document will provide a beginners guide on one way to make a Math app in Maple.

It will contain some coding examples as well as where to find different options in the user interface.

Step 1 Insert a Table

 

 

• 

When making a Math App in Maple I often start with a table. You can enter a table by going to Insert > Table...

  

 

• 

I often make the table 1 x 2 to start with as this gives an area for input and an area for the output (such as plots).

NULL

 

Add a plot component to one of the cells of the table

 

 

• 

From the Components  Palette you can add a Plot Component . Add it to the table by clicking and dragging it over.

 

 

NULL

NULL

Add another table inside the other cell

 

 

• 

In the other cell of the table I'll add another table to organize my use of buttons, sliders, and other components.
NULL

NULL

Add some components to the new table

 

 

• 

From the Components Palette I'll add a slider, or dial, or something else for interaction.

 

• 

You may also want a Math region for an area to enter functions and a button to tell Maple to do something with it.

 

NULL

NULL

Arrange the Components to look nice

 

 

• 

You can change how the components are placed either by resizing the tables or changing the text orientation of the contents of the cells.

 

NULL

Write some code for the interaction of the buttons.

 

 

• 

Using the DocumentTools  package there are lots of ways you can use the components. I often will start writing my code using a code edit region  as it provides better visualization for syntax. On MaplePrimes these display as collapsed so I will also include code blocks for the code.

 

NULL

NULL

Let's write something that takes the value of the slider and applies it to the dial

 

 

• 

Note that the names of the components will change in each section as they are copies of the previous section.

 

with(DocumentTools):

14

with(DocumentTools):
sv:=GetProperty('Slider2',value);
SetProperty('Dial2',value,sv);
• 

This code will only execute when run using the  button. Change the value of the slider below then run the code above to see what happens.

 

NULL

NULL

Move the code 'inside' the slider

 

 

• 

Instead of putting the code inside the code edit region where it needs to be executed, we'll next add the code to the value changed code of the slider.

 

• 

Right click the Slider then select "Edit Value Changed Code".

 

 

• 

This will open the code editor for the Slider

 

 

• 

Enter your code (ensuring you're using the correct name for the slider and dial).

 

• 

Notice that you don't need to use the with(DocumentTools): command as "use DocumentTools in ... end use;" is already filled in for you.

 

• 

Save the code in the Slider and hit the  button inside it once.

• 

Now move the slider.

 

• 

On future uses of the App you won't need to hit  as the code will be run on startup.

``

NULL

NULL

Add some more details to your App

 

 

• 

Let's make this app do something a bit more interesting than change the contents of a dial when a slider moves.

 

• 

The plan in the next few steps is to make this app allow a user to explore parameters changing in a sinusoidal expression.

 

• 

I'm going to add a second Math Component, put the expression A*sin(t*theta+phi)into both then uncheck the box in the context panel that says "Editable".

 

• 

To make the Math containers fit nicely I'll check the Auto-fit container box and set the Minimum Width Pixels to 200.

 

``

Add code to change the value of phi in the second Math Container when the Slider changes

 

 

Note: Maple uses Radians for trigonometric functions so we should convert the value of phi to Radians.

use DocumentTools in

 

use DocumentTools in 
phi_s:=GetProperty(Slider5,value);
expr:= GetProperty(MathContainer6,expression);
new_expr:=algsubs(phi=phi_s*Pi/180,expr);

SetProperty(MathContainer7,expression,new_expr);
end use:

``

``

Make the Dial go from 0 to 360°

 

 

• 

Click the Dial and look at the options in the context panel on the right.

 

• 

Update the values in the Dial so that the highest position is 360 and the spacing makes sense for the app.

  NULL

``

Have the Dial update the theta value of the expression

 

 

• 

Add the following code to the Dial

 

use DocumentTools in
use DocumentTools in 
theta_d:=GetProperty(Dial7,value);
phi_s:=GetProperty(Slider7,value); #This is added so that phi also has the value updated

expr:= GetProperty(MathContainer10,expression);
new_expr0:=algsubs(theta=theta_d*Pi/180,expr);
new_expr:=algsubs(phi=phi_s*Pi/180,new_expr0);  #This is added so that phi also has the value updated

SetProperty(MathContainer11,expression,new_expr);
end use:

 

• 

Update the value in the slider to include the value from the dial

 

use DocumentTools in

 

use DocumentTools in 

theta_d:=GetProperty(Dial7,value); #This is added so that theta also has the value updated
phi_s:=GetProperty(Slider7,value); 

expr:= GetProperty(MathContainer10,expression);
new_expr0:=algsubs(theta=theta_d*Pi/180,expr); #This is added so that theta also has the value updated
new_expr:=algsubs(phi=phi_s*Pi/180,new_expr0);  

SetProperty(MathContainer11,expression,new_expr);

end use:

 

``

``

Notice that the code in the Dial and Slider are the same

 

 

• 

Since the code in the Dial and Slider are the same it makes sense to put the code into a procedure that can be called from multiple places.

 

Note: The changes in the code such as local and the single quotes are not needed but make the code easier to read and less likely to run into errors if edited in the future (for example if you create a variable called dial8 it won't interfere now that the names are in quotes).

 

 

UpdateMath:=proc() 

UpdateMath:=proc()
local theta_d, phi_s, expr, new_expr, new_expr0;
use DocumentTools in 
theta_d:=GetProperty('Dial8','value'); #Get value of theta from Dial
phi_s:=GetProperty('Slider8','value'); #Get value of phi from slider

expr:= GetProperty('MathContainer12','expression');
new_expr0:=algsubs('theta'=theta_d*Pi/180,expr);  # Put value of theta in expression
new_expr:=algsubs('phi'=phi_s*Pi/180,new_expr0);  # Put value of phi in expression
SetProperty('MathContainer13','expression',new_expr); # Update expression
end use:
end proc:

 

• 

Now change the code in the components to call the function using UpdateMath().

 

• 

Since the code above is only defined there it will need to be run once (but only once) before moving the components. Instead of leaving it here you can add it to the Startup code by clicking  or going to Edit > Startup code.  This code will run every time you open the Math App ensuring that it works right away.

 

• 

The startup code isn't defined in this document to allow progression of these steps.

 

``

Make the button initialize the app

 

 

• 

Since the startup code isn't defined in this document we are going to move this function into the button.

 

UpdateMath:=proc()

 

UpdateMath:=proc()
local theta_d, phi_s, expr, new_expr, new_expr0;
use DocumentTools in 
theta_d:=GetProperty('Dial9','value'); #Get value of theta from Dial
phi_s:=GetProperty('Slider9','value'); #Get value of phi from slider

expr:= GetProperty('MathContainer14','expression');
new_expr0:=algsubs('theta'=theta_d*Pi/180,expr);  # Put value of theta in expression
new_expr:=algsubs('phi'=phi_s*Pi/180,new_expr0);  # Put value of phi in expression
SetProperty('MathContainer15','expression',new_expr); # Update expression
end use:
end proc:
• 

First click the button to rename it, you'll see the  option in the context panel on the right. Then add the code above to the button in the same way as the Slider an Dial (Right click and select Edit Click Code).

 

``

``

Now it is easy to add new components

 

 

• 

Now if we want to add new components we just have to change the one procedure.  Let's add a Volume Gauge to change the value of A.

 

• 

Click in the cell containing the Dial, the context panel will show the option to Insert a row below the Dial.

• 

Now drag a Volume Gauge into the new cell.

 

• 

Click in the cell and choose the alignment (from the context panel) that looks best to you. In this case I chose center:

 

``

 

NULL

``

Update the procedure code for the Gauge

 

 

• 

Add two lines for the volume gauge to get the value and sub it into the expression

UpdateMath:=proc()

UpdateMath:=proc()
local theta_d, phi_s, expr, new_expr, new_expr0;
use DocumentTools in 
theta_d:=GetProperty('Dial11','value'); #Get value of theta from the Dial
phi_s:=GetProperty('Slider11','value'); #Get value of phi from the Slider
A_g:=GetProperty('VolumeGauge1','value'); #Get value of A from the Guage

expr:= GetProperty('MathContainer18','expression');
new_expr0:=algsubs('theta'=theta_d*Pi/180,expr);  # Put value of theta in expression
new_expr1:=algsubs('phi'=phi_s*Pi/180,new_expr0);  # Put value of phi in expression
new_expr:=algsubs('A'=A_g,new_expr1);  # Put value of A in expression

SetProperty('MathContainer19','expression',new_expr); # Update expression
end use:
end proc:
• 

Now add

UpdateMath();

  to the Gauge.

  ``

``

Plot the changing expression

 

 

• 

Make a procedure to get the value in the second Math Container and plot it

 

PlotMath:=proc()

PlotMath:=proc()
	local expr, p;
	use DocumentTools in 

	expr:=GetProperty('MathContainer21','expression'); 

	p:=plot(expr,'t'=-Pi/2..Pi/2,'view'=[-Pi/2..Pi/2,-100..100]):

	SetProperty('Plot14','value',p)
	end use:
end proc:
• 

Put this procedure in the Initialize button and the call to it in the components.

 

NULL

``

Tidy up the app

 

 

• 

Now that we have an interactive app let's tidy it up a bit.

 

• 

The first thing I'd recommend in your own app is moving the code from the initialize button to startup code. In this document we choose to use the button instead to preserve earlier versions.

 

• 

You can also remove the borders around the components by clicking in the table and selecting "Interior Borders" > "None" and "Exterior Borders" > "None" from the context panel.

NULL

``

``

Now you have a Math App

 

 

• 

You can upload your Math App to the Maple Cloud to share with others by going to "File" > "Save to Cloud".

 

• 

I'd recommend also including a description of what your app does. You can do this nicely using another table and Text mode.

 

 

 

``

``

NULL

HowToMathApp.mw

First 7 8 9 10 11 12 13 Last Page 9 of 64