ecterrab

13673 Reputation

24 Badges

18 years, 348 days

MaplePrimes Activity


These are answers submitted by ecterrab

Note that conjugate(a + b + c) does not automatically distribute over the sum. If that is what you want, in the Maple context, you need to use the expand command. It's been noted (see some of the replies) that being N* a vector, expand was required twice; you asked why: it was an oversight, and applying it only once should have sufficed. That is fixed within the Maplesoft Physics Updates v.1510 or newer. So now map(expand, N*) performs the expansion to the end. As usual, to install the Updates, open a worksheet and input Physics:-Version(latest);

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

One way to do that: substitute l_1 = l_1(k[1], k[2], k[3], a[1], a[2]),  l_2= l_2(.. same dependency as l_1 ...), etc., so indicate complete dependency on all the parameters. Then add the following differential equations: diff(l_1(k[1], k[2], k[3], a[1], a[2]), k[2]) = 0, diff(l_1(k[1], k[2], k[3], a[1], a[2]), k[2]) = 0, etc., the same for l__2(...), etc. where each "derivative = 0" indicates the "not dependency of each l_j on the parameters you say they don't depend". 

Now, you have augmented the system, formulating the problem correctly; now, call PDEtools:-Solve on that augmented system.

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

Hi,
This is now implemented and distributed within the Maplesoft Physics Updates v.1477 or newer. As usual, to install it, open the GUI and imput Physics:_Version(latest). The implementation is as follows:

  • The function being differentiated can have any number of variables.
  • The prime and dot display of derivatives is ON provided the derivative, which can be of any order (1st, 2nd, etc.), is not a mixed derivative. For mixed derivatives, e.g. diff(f(x, t), x, t), the display is as before this update.

The following is your worksheet plus comments, showing the new functionality at work.
 

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1478 and is the same as the version installed in this computer, created 2023, July 15, 11:58 hours Pacific Time.`

(1)

General metric

Lecture 5 in Math Prediction

NULL

NULL

restart

with(Physics); Setup(mathematicalnotation = true); Setup(signature = `+---`)

[signature = `+ - - -`]

(2)

ds2 := exp(v(r, t))*c^2*dt^2-exp(lambda(r, t))*dr^2-r^2*(da^2+sin(a)^2*dp^2)

exp(v(r, t))*c^2*dt^2-exp(lambda(r, t))*dr^2-r^2*(da^2+sin(a)^2*dp^2)

(3)

Setup(coordinatesystems = (Z = [t, r, a, p]), metric = ds2)

[coordinatesystems = {Z}, metric = {(1, 1) = exp(v(r, t))*c^2, (2, 2) = -exp(lambda(r, t)), (3, 3) = -r^2, (4, 4) = -r^2*sin(a)^2}, spaceindices = lowercaselatin_is]

(4)

Set a compact display of the functions entering the metric

CompactDisplay([coordinatesystems = {Z}, metric = {(1, 1) = exp(v(r, t))*c^2, (2, 2) = -exp(lambda(r, t)), (3, 3) = -r^2, (4, 4) = -r^2*sin(a)^2}, spaceindices = lowercaselatin_is])

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

(5)

When you load Physics, the prime is used for working with primed variables, so to use the prime to represent differentiation: turn ON the display of derivatives with respect to r using a prime

Typesetting:-Settings(useprime = true, typesetprime = true, prime = r)

 

This shows the functionality of v(r, t) and lambda(r, t)suppressed, due to the call to CompactDisplay above

g_[]

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

(6)

This shows first order derivatives with respect to r displayed with a prime, and derivatives with respect to t displayed with a dot

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

Physics:-Christoffel[`~alpha`, mu, nu] = {(1, 1, 1) = (1/2)*(diff(v(r, t), t)), (1, 1, 2) = (1/2)*(diff(v(r, t), r)), (1, 2, 1) = (1/2)*(diff(v(r, t), r)), (1, 2, 2) = (1/2)*exp(-v(r, t)+lambda(r, t))*(diff(lambda(r, t), t))/c^2, (2, 1, 1) = (1/2)*c^2*exp(v(r, t)-lambda(r, t))*(diff(v(r, t), r)), (2, 1, 2) = (1/2)*(diff(lambda(r, t), t)), (2, 2, 1) = (1/2)*(diff(lambda(r, t), t)), (2, 2, 2) = (1/2)*(diff(lambda(r, t), r)), (2, 3, 3) = -exp(-lambda(r, t))*r, (2, 4, 4) = -exp(-lambda(r, t))*r*sin(a)^2, (3, 2, 3) = 1/r, (3, 3, 2) = 1/r, (3, 4, 4) = -sin(a)*cos(a), (4, 2, 4) = 1/r, (4, 3, 4) = cot(a), (4, 4, 2) = 1/r, (4, 4, 3) = cot(a)}

(7)

Also for second order derivatives

Ricci[nonzero]

Physics:-Ricci[mu, nu] = {(1, 1) = (1/4)*(2*c^2*((diff(diff(v(r, t), r), r))*r+(1/2)*(diff(v(r, t), r))*((diff(v(r, t), r))*r-(diff(lambda(r, t), r))*r+4))*exp(v(r, t)-lambda(r, t))-2*(diff(diff(lambda(r, t), t), t)-(1/2)*(diff(lambda(r, t), t))*(diff(v(r, t), t)-(diff(lambda(r, t), t))))*r)/r, (1, 2) = (diff(lambda(r, t), t))/r, (2, 1) = (diff(lambda(r, t), t))/r, (2, 2) = (1/4)*(2*(diff(diff(lambda(r, t), t), t)-(1/2)*(diff(lambda(r, t), t))*(diff(v(r, t), t)-(diff(lambda(r, t), t))))*r*exp(-v(r, t)+lambda(r, t))-2*c^2*((1/2)*r*(diff(v(r, t), r))^2-(1/2)*r*(diff(v(r, t), r))*(diff(lambda(r, t), r))+(diff(diff(v(r, t), r), r))*r-2*(diff(lambda(r, t), r))))/(c^2*r), (3, 3) = 1+(1/2)*(-(diff(v(r, t), r))*r+(diff(lambda(r, t), r))*r-2)*exp(-lambda(r, t)), (4, 4) = -(1/2)*sin(a)^2*(-2+((diff(v(r, t), r))*r-(diff(lambda(r, t), r))*r+2)*exp(-lambda(r, t)))}

(8)

Ricci[scalar]

-(1/2)*(exp(-v(r, t)-lambda(r, t))*exp(v(r, t))*(diff(lambda(r, t), r))*(diff(v(r, t), r))*c^2*r^2-exp(-v(r, t)-lambda(r, t))*exp(v(r, t))*(diff(v(r, t), r))^2*c^2*r^2-2*exp(-v(r, t)-lambda(r, t))*exp(v(r, t))*(diff(diff(v(r, t), r), r))*c^2*r^2+2*exp(-v(r, t)-lambda(r, t))*exp(v(r, t))*(diff(lambda(r, t), r))*c^2*r-2*exp(-v(r, t)-lambda(r, t))*exp(v(r, t))*(diff(v(r, t), r))*c^2*r-exp(-v(r, t)-lambda(r, t))*exp(lambda(r, t))*(diff(v(r, t), t))*(diff(lambda(r, t), t))*r^2+exp(-v(r, t)-lambda(r, t))*exp(lambda(r, t))*(diff(lambda(r, t), t))^2*r^2+2*exp(-v(r, t)-lambda(r, t))*exp(lambda(r, t))*(diff(diff(lambda(r, t), t), t))*r^2+2*(diff(lambda(r, t), r))*exp(-lambda(r, t))*c^2*r-2*exp(-lambda(r, t))*(diff(v(r, t), r))*c^2*r-4*exp(-lambda(r, t))*c^2+4*c^2)/(c^2*r^2)

(9)

NULL

 

Download General_metric_(reviewed).mw

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

Hi

I imagine you know well about 4-velocity and comoving (or not) observers; by the way, have you seen the pages of the Physics:-ThreePlusOne package? (The line elements for Eulerian and Comoving observers are related by the metric.) Anyway, mainly because of the textbook references for formulating the problem, a good and easy presentation with good references at the end is the one in Wikipedia about Comoving and proper distances. Another good reference is the Physics Forums Insights about comoving coordinates and observers. ChatGPT also knows about these topics and corresponding formulas. You could use those references for formulating the problem in a worksheet/document, and point out what is precisely the formulation obstacle you see - something more specific that you wouldn't know how to do - and from there, we can recap the conversation here, after I see your worksheet and could understand where is that you need some clarification or help.

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

Hi
Not exactly, but what I use for this purpose: select the portion (for instance: Shift + Click the beginning; same for the end) Then, from the menu: Evaluate -> Selection, or use the corresponding shortcut (on a Mac is Command =)

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

No, not in the current Maple. Of course, it could be re-coded such that it works differently, e.g. as you say, without displaying the options, but I don't see the rationale. Say in the example you gave: try without AllSolutions, and you see a different output, so displaying the option is relevant to understand what you see on the right-hand side. Also, it is not possible to predict, a priori, whether the options you pass produce a result different than without options.

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

Where you write option trace, write instead: option trace = 0. If tracing an existing program, e.g. simplify, go with trace(simplify, statements = false). You may also be interested in the option depth = n. See ?trace.

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

Generally speaking: yes. Although a DiracConjugate command, relevant in connection with what you show in the worksheet you posted, is not there in Physics:-StandardModel at this moment (conjugate is used instead, but that misses the tensor representation of a spinor Psi  times Dgamma[0], and so there is no precise representation for the scalar DiracConjugate(Psi) * Psi. Incidentally, I am currently working on further developments for spinors. I will write again by the end of this week, showing the new functionality and answering your question accordingly.

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

Update: Good catch; a fix for this problem is distributed to everyone in the Maplesoft Physics Updates v.1461 or newer. As usual, to install, open a worksheet/document and input Physics:-Version(latest) to install.

Previous answer: This looks like bogus behaviour, and I share your expectation @nm. I will give it a look later today and write here again.

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

Hi @Jean-Michel
As far as I know, on all platforms, including Windows (several Maple users), the following works fine:

  1. Open Maple's GUI
  2. Verify the value of libname: be sure you do not have some library interfering in a directory listed when you input libname
  3. Input: Physics:-Version(latest);

If that doesn't work for you, item 2. is where I guess your problem could be. People from support@maplesoft.com should also be able to give you a hand if the standard procedure itemized above doesn't work for you for some more elusive reason.

Besides the above, I see in your post "failed to resolve filename C:\Maths\Maple2023\toolbox\2023". The directory where the MapleCloud packages get installed is the one you see entering cat(kernelopts(homedir), "Maple/Toolbox/2023"). So I'd suggest you verify that that directory exists. My understanding is that it suffices for cat(kernelopts(homedir), "Maple") to exist.

Finally, if for some reason that escapes me, the above doesn't help you, I would suggest you manually create the directory cat(kernelopts(homedir), "Maple/Toolbox/2023"), then let me know, and I'll send you a zip with the files you'd need to install in that directory, basically following this structure: 

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

Hi

I only noticed this question today. Your worksheet misses the "expected output". Could you please write it explicitly? (I mean: not just a comment as "a gradient term"). If you give a reference to your expected output, that also helps.

Meantime, the functional derivative of an unknown function Phi(X) with regards to the metric g_[alpha, beta] can only give 0 since there is no indication that Phi(X) depends on the metric.

But let's move forward starting from what you were expecting.

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

Physics:-Substitute is a new command in Maple 2023; you can use it directly for tricky substitutions like this one and get what you called eq_K1_m4_desired in one go. This is what you get:

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

When you load Vectors, three systems of coordinates are understood: [x, y, z], [rho, phi, z], [r, theta, phi].

with(Physics); with(Vectors)

 

The system knows about the relationship between these three systems,

[rho, phi, z]; `~`[`=`](%, ChangeCoordinates(%, cartesian))

[rho = (x^2+y^2)^(1/2), phi = arctan(y, x), z = z]

(1)

Accordingly, the system also knows how to differentiate them

(%diff = diff)(rho, x)

%diff(rho, x) = x/(x^2+y^2)^(1/2)

(2)

(In Setup, it is called geometricdifferentiation, you can turn this knowledge OFF setting it to false to receive %diff(rho, x) = 0.)

If rho has some functionality, say rho(tau), that functionality propagates the same way we do with paper and pencil, so

(%diff = diff)(rho(tau), x)

%diff(rho(tau), x) = x(tau)/(x(tau)^2+y(tau)^2)^(1/2)

(3)

In your definition - already of F[mu, nu], you use rho(tau) so when differentiating with respect to x you will get as in (3),

Setup(coordinates = [X = (tau, x, y, z)])

[coordinatesystems = {X}]

(4)

Define(F[`~mu`, nu] = Matrix(4, 4, {(1, 1) = -rho(tau)-epsilon*R(X), (1, 2) = -(1+w)*rho(tau)*epsilon*d_[2](V(X)), (1, 3) = -(1+w)*rho(tau)*epsilon*d_[3](V(X)), (1, 4) = -(1+w)*rho(tau)*epsilon*d_[4](V(X)), (2, 2) = p(tau)+epsilon*P(X)+epsilon*(diff(PI(X), x, x)-(1/3)*Laplacian(PI(X))), (2, 3) = epsilon*(diff(PI(X), x, y)), (2, 4) = epsilon*(diff(PI(X), x, z)), (3, 3) = p(tau)+epsilon*P(X)+epsilon*(diff(PI(X), y, y)-(1/3)*Laplacian(PI(X))), (3, 4) = epsilon*(diff(PI(X), y, z)), (4, 4) = p(tau)+epsilon*P(X)+epsilon*(diff(PI(X), z, z)-(1/3)*Laplacian(PI(X)))}))

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

(5)

F[1, 1]

rho(tau)+epsilon*R(X)

(6)

diff(rho(tau)+epsilon*R(X), x)

x(tau)/(x(tau)^2+y(tau)^2)^(1/2)+epsilon*(D[2](R))(tau, x(tau), y(tau), z)

(7)

In summary, you are using rho with two different meanings: the cylindrical coordinate, related to the Cartesian coordinate x via [rho = sqrt(x^2+y^2), phi = arctan(y, x), z = z] but also as an unknown function in F[mu, nu]. You resolve the issue disambiguating: for the unknown function entering the definition of F[mu, nu], use a letter that is not already one of the global geometric coordinate (so none of [x, y, z], [rho, phi, z], [r, theta, phi]). For example

_local(rho)

rho

(8)

Define(F[`~mu`, nu] = Matrix(4, 4, {(1, 1) = -rho(tau)-epsilon*R(X), (1, 2) = -(1+w)*rho(tau)*epsilon*d_[2](V(X)), (1, 3) = -(1+w)*rho(tau)*epsilon*d_[3](V(X)), (1, 4) = -(1+w)*rho(tau)*epsilon*d_[4](V(X)), (2, 2) = p(tau)+epsilon*P(X)+epsilon*(diff(PI(X), x, x)-(1/3)*Laplacian(PI(X))), (2, 3) = epsilon*(diff(PI(X), x, y)), (2, 4) = epsilon*(diff(PI(X), x, z)), (3, 3) = p(tau)+epsilon*P(X)+epsilon*(diff(PI(X), y, y)-(1/3)*Laplacian(PI(X))), (3, 4) = epsilon*(diff(PI(X), y, z)), (4, 4) = p(tau)+epsilon*P(X)+epsilon*(diff(PI(X), z, z)-(1/3)*Laplacian(PI(X)))}))

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

(9)

F[1, 1]

rho(tau)+epsilon*R(X)

(10)

 

diff(rho(tau)+epsilon*R(X), x)

epsilon*(diff(R(X), x))

(11)

If you do this and still want to refer to the global geometrical cylindrical coordinate, use :-rho

subs(rho = :-rho, rho(tau)+epsilon*R(X))

:-rho(tau)+epsilon*R(X)

(12)

diff(:-rho(tau)+epsilon*R(X), x)

x(tau)/(x(tau)^2+y(tau)^2)^(1/2)+epsilon*(D[2](R))(tau, x(tau), y(tau), z)

(13)

Independent of the above, I note two other things: if your coordinates are X = (tau, x, y, z), the timelike component of the metric is the 1st one; I recommend setting the signature accordingly using

Setup(signature = "+---")

[signature = `+ - - -`]

(14)

Then to see the components of a tensor you defined using equations as you did with F[mu, nu] and T[mu, nu], you can see their components without using TensorArray, via

F[]

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

(15)

"CompactDisplay(?)"

rho(tau)*`will now be displayed as`*rho

(16)

"F[~]"

F[`~mu`, `~nu`] = Matrix(%id = 36893488152278165372)

(17)

F[mu, `~nu`, matrix]

F[mu, `~nu`] = Matrix(%id = 36893488152269227780)

(18)

NULL


 

Download geometrical_coordinates.mw

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

@nm

You can, of course, add your approach to display any function the way you want, see ?latex,functions, or use any other scheme you imagine - you don't need to populate your question with that - it makes it long, more difficult to read.

Yet, I wanted to express to you that blanket-statements like

"[displaying mathematical functions the way they are displayed in textbooks, there exists notation for all of them, see the Digital Library of Mathematical Functions] makes it very hard when looking at the equations in latex and the pdf to know what these special functions are."

don't look to me appreciative of the diversity of opinions around. My opinion, for instance, is that I haven't seen one single textbook that displays the Bessel function of the first kind as BesselJ(n, z)

As the author of the FunctionAdvisor and latex, I intentionally coded the translation to use mathematical notation, which is standard for mathematical functions, as you see in any textbook, or the DLMF mentioned.

That said, being aware that some people got so familiar with computer algebra that they prefer the old computer notation, from the time there was no computer typesetting, you have several latex options. See ?latex, in Options, scan for "translation = ...", or also in the section for latex:-Settings check the meaning of userestrictedtypesetting, usespecialfunctionrules, usetypesettingcurrentsettings. I imagine the last one will suffice for your purpose, inferring from your question that you may have set your Maple to never display mathematical functions with mathematical notation.

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

Mainly, this system is highly sensitive to the initial conditions; in simple terms, depending on the value of H and initial conditions, you could expect all numerical methods to drift.

I also suggest you open the page ?examples,poincare, where an analysis of the chaotic behaviour of the Henon-Heiles Hamiltonian is performed using the Poincare surface-of-section method, reflecting the progressive disintegration of the KAM surfaces (again, depending on the value you choose for the Hamiltonian and initial conditions). Conditions like the ones that produce the first out of six figures generated with DEtools:-poincare and shown on that page have better chances of preserving the value of H.

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

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