ecterrab

13431 Reputation

24 Badges

19 years, 356 days

MaplePrimes Activity


These are replies submitted by ecterrab

Hi @nmacsai 
I am honestly flattered that you liked my profile picture, to the point of using a very similar one: a Ket with a psi(t) function. But it is not a good idea ... People (me included) get a first idea of who is writing by looking at the profile picture, and if we both use the same (I realize yours has the function italicized and with dependency, but that is too minor of a difference), it creates confusion. Would you mind please adjusting this? Thanks in advance.


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

@Carl Love 

First, you see that basically all the other non-alphanumeric characters already have a syntactical meaning. Of course, each one could be seen "ad hoc" and indeed mathematical notation gives meaning in "ad hoc" ways, e.g. A! means the factorial of A. In fact, the prime non-alphanumeric character,  ', also has "ad hoc" meaning: the input x' is syntactically correct and interpreted as differentiation with respect to x. But then, in rather frequent mathematical notation the input x' is also used with a different meaning, to denote a variable that in some context (e.g. transformation of coordinates, or Green functions) we think of it as somehow related to x.

Now, if x' is accepted as syntactically correct to mean differentiation with respect to x, if Typesetting:-Settings(':-useprime' = false) it is natural to me that the same input x' is still syntactically correct just not meaning differentiation, and that is all I implemented now. Is this natural? If you read the original post by @nmacsai you see that is what appeared natural to him too, he asks: 

  • "Can I disable maple's use of the ' function? (aka prime/derivative function) [..] Is there a way that I can disable the operator function of ' so I can use it as a naming scheme"

The answer now is: yes you can disable the prime/derivative function in order to use the prime as a naming scheme. and "without changing anything" since the syntax x' was already allowed as input. All we have now is that, naturally, after disabling prime differentiation you can use x' as a variable.

But even if @nmacsai had not asked about this, consider the input shown:

It is my opinion that, once I set in my mind that t' does not mean differentiation with respect to x, the natural way to input this is psi(t) = Int(G(t, t') * psi(t'), t), not having to input `t'` which for me only indicates there is some obscure computer reason for something so absurd (from the point of view of a human) as having to surround with ``. So all you need is a mimicry of "set in my mind that t' does not mean differentiation with respect to x", and that mimicry is achieved entering Typesetting:-Settings(':-useprime' = false).

As another example, in a recent post I made here in Mapleprimes about Einstein's principle of relativity, there is one place where - when writing the post - I felt rather uncomfortable; copying from the post:

I felt horrible. The motivation for this line was the same as the motivation of @nmacsai to write the question we are replying to here. In physics, you very frequently use the ' to denote variables. That day it didn't pass through my mind that I could fix this in a natural way: tell the system that ' does not mean differentiation and fix the inconsistency that x' is valid syntax (when it is differentiation) and, at the same time, not valid syntax (when it is not differentiation). Now it is always valid syntax. And that addresses the other frequent use of the prime ' in mathematical notation, which is to denote variables.

All that said, I am not trying to convince you or anyone, maybe we just see this differently, and if you prefer to input surrounding with ``, as in `x'` instead of x', and both with the same meaning (`x` and x also have the same meaning), well, you can still do it. By the way, none of this represents the maintenance problem you suggest.

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

 

@nmacsai ​​​​, @Carl Love@rlopez 

Download Primed_symbols_as_variables.mw

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

@nm 
The answer is there in this other answer I gave today to another question of yours: for a solving command, there is a context and mathematical normal form. Depending on what you want - the specification of what you mean by degree in these not-normalized examples - somewhere in the multiple replies above, I mentioned using PDEtools:-dpolyform, which regarding degree emulates properly the context and mathematical normal form used by the DE solving commands to interpret your input and so its degree.

To the side, looking around the replies above, I see one by @Carl Love, and I am not sure he or you are aware of these two commands: PDEtools:-ToJet and PDEtools:-FromJet. They are the commands that, in one step, rewrite a given ODE in a form suitable to work with the DifferentialAlgebra package (I am co-author of that package).

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

@Rouben Rostamian  

Yes. Put this in your mapleinit:

`dsolve/arbitraryconstants` := "subscripted":
`pdsolve/arbitraryfunctions` := "subscripted": 


In this way, you indicate that the starting value is "subscripted".

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

@lemelinm

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

Hi Mario, could you please upload a worksheet with the problem formulated? You can use the Green arrow for that purpose.

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

Hi, please use the Green arrow to upload a Maple worksheet with the input for your problem and some text making your question or expected solution clear; thanks.

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

I hope it helps you in performing your calculations easier.

Download Using_Physics_instead.mw

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

@justauser 
Physics has Fundiff, to compute Lagrange equations in general by variating the Action as an integral of the Lagrangian density. It is true, however, that none of these three packages have a command to tackle the inverse problem, that is, to find the Lagrangian given Lagrange's equations (am I right in understanding that is what you want?)

At first sight, I would think that a direct approach, formulating the problem with L as an unknown, then tackling the system of equations with PDEtools commands, would be the way to go, instead of computing the Helmholtz conditions for the existence of the Lagrangian to then try to compute the Lagrangian itself. If Helmholtz conditions are not satisfied, the PDEtools commands will automatically return nothing.

Could you please write, within a Maple worksheet, who your 'vg' is and what solution (Lagrangian) you expect and upload the worksheet? (For that, use the green arrow you see when posting something here.) If you do not know what you expect, could you please add in that worksheet an example where you give vg and the solution you expect? With that, I can take a look

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

Hi @Carl Love 
I am saying it is a different problem, but not just that: I fixed both problems in two different places. One is: simplifying a RootOf returned by solve may, rarely but can happen, result in a RootOf("...") where "..." has no _Z around. The other is: due to a bug in solve in 1999, there was a line of code removing solutions x = x for single equation problem. That bug got fixed in 2000, but that line in the internal differential equation (solve) routine remained in place. Then you posted what, for me, is a valid example of solution x = x, not related to RootOf(...) that has no _Z. So: two problems that required two fixes. That explains in detail why I wrote "these are two different and unrelated problems."

Then your view on this, that "something", solved with respect to x, could not have x when "something" is simplified, yes, in that sense, there is similitude; your message, however, didn't say that. Instead: "here is another one where solve and PDEtools:-Solve return different, and I (Carl) prefer the output by solve". 

@Rouben Rostamian@nm 

I deleted my previous comment, "uses" Physics:-Vectors is not necessary in Rouben's program, but anyway I preferred to look at this closely. The issue is now resolved in the Maplesoft Physics Updates v.1276.

The details are:

1) Vectors:-`-`  (not a Vectors visibly exported command) is an internal routine coded as a hidden export. I would expect not to be binded by uses, but it is. Maybe my expectation is due to my lack of familiarity with uses, a useful and straightforward idea.

2) Vectors:-`-` was coded (~30 years ago) as a binary operator. Used as an internal routine, that is all that was needed. But the same way as `+`, the `-` operation is well defined with 0, 1 or N > 1 operands.

3) Within Rouben's program, "1 - p.q" is an operation (`-`) with two operands, not just one, but when "uses" is there, Vectors:-`-` receives only one operand, resulting, due to 2), in the error interruption observed. You see that by entering debug(Vectors:-`-` ) before entering my_module:-my_proc(u_,v_). If, in Rouben's program, instead of `-` you use `+`, then debug(Vector:-`+`), you see that two operands are passed to Vectors:-`+`, not just one. (Unlike Vectors:-`-`, Vectors:-`+` is a Vectors visibly exported command, expected to be binded by uses.) So up to what I can see there is an issue in "uses" here: it passes two operands to `+`, but only one to `-`.

Item 2) is corrected by removing the (unnecessary) restriction to "always expect 2 operands"; with that, the problem noticed disappears entirely. Item 3) is now tracked as an issue in uses, to be reviewed by the kernel group.

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

 

Hi @Rouben Rostamian  

The Maple default type 'scalar', as several commands previous to Physics, knows nothing about this extended domain that includes vectors, tensors, abstract matrices (non-commutative symbols) etc. Instead of that, please check the help page for Vectors:-Identify. That is what you need to distinguish a scalar from a vector.

To the side: Physics and its subpackages are self-complete, including, in addition to the package's commands, the Physics:-Library (nops(with(Physics:-Library)) -> 172) and the library of Physics types (nops(with(Physics:-Library:-PhysicsTypes)) -> 114). Those are the internal routines and types with which the Physics package and its subpackages are written.

Of course, there are Maple commands that exist before Physics, and you can use all of them when writing code for the extended domain implemented with Physics, but depending on the (pre-Physics) command or type, you need to first check that they work as you intend. In part for that reason, I made the whole Physics:-Library and its types available and documented at user level - they allow you to code everything you'd need to compute with the extended domain.

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

 

 

Hi Rouben,

Having a unique zero is an intentional design, not a mistake, not a bug nor something of the like.

 

First, note that the error message you show is due to the way you programmed your procedure f enforcing a type checking of its argument that only accepts a vector (what you'd call a non-zero vector). For example, if instead of that you accept input of type algebraic and use Vectors:-Norm, you have the f you seem to have tried to program

 

with(Physics:-Vectors)

 

f := proc (q::algebraic) options operator, arrow; Norm(q)^2 end proc

proc (q::algebraic) options operator, arrow; Physics:-Vectors:-Norm(q)^2 end proc

(1)

f(a_)

Physics:-Vectors:-Norm(a_)^2

(2)

f(k*a_)

Physics:-Vectors:-Norm(k*a_)^2

(3)

expand(%)

k^2*Physics:-Vectors:-Norm(a_)^2

(4)

f(0*a_)

0

(5)

All the product and sum operations between objects of type algebraic are well defined with 0

0+a_

a_

(6)

0.a_

0

(7)

`&x`(0, a_)

0

(8)

In this context, distinguishing between the algebraic 0 you see in (7) and the algebraic 0 you see in (8) is of no use, not for the purpose of performing algebraic computations (computing with objects of type algebraic). Such a distinction would then be artificial; an unnecessary complication.

 

Regarding your comment about other packages, VectorCalculus and LinearAlgebra compute with matrix representations of vectors, and there is indeed a computational distinction between the number 0 and a matrix all of whose components are equal to 0; so these two packages need to distinguish between the number 0 and a "0 vector" (represented as a column matrix of zeros). One of the main disadvantage of the matrix representation of vectors is that you cannot compute with the basic object A_, a non-projected vector, as you do when computing with Physics:-Vectors.

 

By the way, one of the key design differences between Physics and other packages is that, in Physics, instead of restricting the representations of mathematical objects to scalars or matrices, the domains of the operations were extended to handle the objects we use when computing with paper and pencil. That includes abstract vectors, tensors, Einstein's sum rule for repeated indices, anti-commutative and non-commutative objects, spinors, etc. All these objects, not present in the standard domain of computer algebra systems before Physics, are implemented with type algebraic. The number of advantages of having all these objects of type algebraic (when that is possible) is too large to list here, but for me the main one is that it allows for the closest match between what we do when computing with paper and pencil and what we can now do on a computer algebra worksheet.

 

If regardless of the above you still want to have a type that includes 0 as a vector you can use Or(0, PhysicsVectors). Then your procedure f will work as you planned, and in addition you can assign a name to this combo, as in TPV := Or(0, PhysicsVectors).

Download unique_zero.mw

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

 

@bikramphy 

You have now added information, the metric, OK. Below is basically the same worksheet, with small changes, taking into account the form of the metric.

 

with(Physics); with(Tetrads)

_______________________________________________________

(1)

Simplify steps setting the signature as close as possible to the one you want, and set coordinates as you now indicated they are

Setup(signature = "+++-", coordinates = (X = [Q, q, u, t]))

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

(2)

 

Input the metric that you are now indicating

ds2 := dQ*dq+dQ*dq+du*dt+du*dt-Typesetting[delayDotProduct](2*Q/m.(diff(V(q, t), q)), dt, true)*dt

2*dQ*dq+2*du*dt-2*Q*(diff(V(q, t), q))*dt^2/m

(3)

Set compact display to make things more readable 

CompactDisplay(2*dQ*dq+2*du*dt-2*Q*(diff(V(q, t), q))*dt^2/m)

V(q, t)*`will now be displayed as`*V

(4)

Setup(metric = ds2)

[metric = {(1, 2) = 1, (3, 4) = 1, (4, 4) = -2*Q*(diff(V(q, t), q))/m}]

(5)

The tetrad computed by default is orthonormal

e_[]

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

(6)

"IsTetrad(?)"

true

(7)

From

e_[definition]

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

(8)

You see the form of the tetrad metric eta[a, b] that indicates the signature, is "(+++-)"

e_[a, mu]*e_[b, mu]; % = TensorArray(%, simplifier = `@`(simplify, evala))

Physics:-Tetrads:-e_[a, mu]*Physics:-Tetrads:-e_[b, `~mu`] = Matrix(%id = 36893488153619389964)

(9)

You need to find a matrix A such that when redefining the tetrad as A * e_ = E, and substituting into the above, you get "E[a,mu] E[b]^(mu)=([[[1,0,0,0],[0,1,0,0],[0,0,-1,0],[0,0,0,-1]]])", where in the right-hand side you see the signature "(++--)".


I'd search for a matrix of this form, adding one element out of the diagonal, mostly for illustration purposes (you see in the result that was actually not necessary)

A := subs(`~`[`=`]([a[1, 2], a[1, 3], a[1, 4], a[2, 4], a[3, 4]], 0), Matrix(4, symbol = a, shape = symmetric))

Matrix(%id = 36893488151942187836)

(10)

E[a, mu] = A.rhs(e_[])

E[a, mu] = Matrix(%id = 36893488151939865164)

(11)

Define this as a tensor, to use the tensor functionality to build a set of equations for the `a__i,j`

"Define(?)"

{Physics:-D_[mu], Physics:-Dgamma[mu], E[a, 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], Physics:-Tetrads:-l_[mu], Physics:-Tetrads:-lambda_[a, b, c], Physics:-Tetrads:-m_[mu], Physics:-Tetrads:-mb_[mu], Physics:-Tetrads:-n_[mu], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(12)

Introduce the expected form of the tetrad metric to build the set of equations to be solved for the `a__i,j`

Eta[a, b] = Matrix(4, 4, [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, -1, 0], [0, 0, 0, -1]])

Eta[a, b] = Matrix(%id = 36893488153673893876)

(13)

"Define(?)"

{Physics:-D_[mu], Physics:-Dgamma[mu], E[a, mu], Eta[a, b], 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], Physics:-Tetrads:-l_[mu], Physics:-Tetrads:-lambda_[a, b, c], Physics:-Tetrads:-m_[mu], Physics:-Tetrads:-mb_[mu], Physics:-Tetrads:-n_[mu], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(14)

This is the identity you use to adjust the `a__i,j`

E[a, mu]*E[b, `~mu`] = Eta[a, b]

E[a, mu]*E[b, `~mu`] = Eta[a, b]

(15)

TensorArray(E[a, mu]*E[b, `~mu`] = Eta[a, b], simplifier = simplify)

Matrix(%id = 36893488153624419132)

(16)

"convert(?,setofequations)"

{0 = 0, a[1, 1]^2 = 1, a[2, 3]*(a[2, 2]+a[3, 3]) = 0, -a[4, 4]^2 = -1, a[2, 2]^2+a[2, 3]^2 = 1, a[2, 3]^2+a[3, 3]^2 = -1}

(17)

solve({0 = 0, a[1, 1]^2 = 1, a[2, 3]*(a[2, 2]+a[3, 3]) = 0, -a[4, 4]^2 = -1, a[2, 2]^2+a[2, 3]^2 = 1, a[2, 3]^2+a[3, 3]^2 = -1})

{a[1, 1] = 1, a[2, 2] = 1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = 1}, {a[1, 1] = 1, a[2, 2] = 1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = -1}, {a[1, 1] = 1, a[2, 2] = -1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = 1}, {a[1, 1] = 1, a[2, 2] = -1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = -1}, {a[1, 1] = -1, a[2, 2] = 1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = 1}, {a[1, 1] = -1, a[2, 2] = 1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = -1}, {a[1, 1] = -1, a[2, 2] = -1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = 1}, {a[1, 1] = -1, a[2, 2] = -1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = -1}

(18)

Any of these solutions serve your purpose, take the first one, remove that RootOf

sol := convert(({a[1, 1] = 1, a[2, 2] = 1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = 1}, {a[1, 1] = 1, a[2, 2] = 1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = -1}, {a[1, 1] = 1, a[2, 2] = -1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = 1}, {a[1, 1] = 1, a[2, 2] = -1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = -1}, {a[1, 1] = -1, a[2, 2] = 1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = 1}, {a[1, 1] = -1, a[2, 2] = 1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = -1}, {a[1, 1] = -1, a[2, 2] = -1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = 1}, {a[1, 1] = -1, a[2, 2] = -1, a[2, 3] = 0, a[3, 3] = RootOf(_Z^2+1), a[4, 4] = -1})[1], radical)

{a[1, 1] = 1, a[2, 2] = 1, a[2, 3] = 0, a[3, 3] = I, a[4, 4] = 1}

(19)

The tetrad that results in the tetrad metric "(++--)"is then given by

subs(sol, E[])

E[a, mu] = Matrix(%id = 36893488153642495860)

(20)

Set now this matrix as the tetrad

"Setup(tetrad = rhs(?))"

[tetrad = {(1, 1) = ((1/2)*I)*2^(1/2), (1, 2) = -((1/2)*I)*2^(1/2), (2, 3) = (1/2)*2^(1/2)/((Q^2*(diff(V(q, t), q))^2+m^2)^(1/2)/m)^(1/2), (2, 4) = -(1/2)*2^(1/2)*(Q*(diff(V(q, t), q))-(Q^2*(diff(V(q, t), q))^2+m^2)^(1/2))/(((Q^2*(diff(V(q, t), q))^2+m^2)^(1/2)/m)^(1/2)*m), (3, 3) = ((1/2)*I)*2^(1/2)/(-(Q^2*(diff(V(q, t), q))^2+m^2)^(1/2)/m)^(1/2), (3, 4) = -((1/2)*I)*2^(1/2)*(Q*(diff(V(q, t), q))+(Q^2*(diff(V(q, t), q))^2+m^2)^(1/2))/((-(Q^2*(diff(V(q, t), q))^2+m^2)^(1/2)/m)^(1/2)*m), (4, 1) = -((1/2)*I)*2^(1/2), (4, 2) = -((1/2)*I)*2^(1/2)}]

(21)

And that is all.

 

Verify now:

e_[]

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

(22)

This is the tetrad metric you were looking for, associated to a signature of the form "(++--)"

eta_[]

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

(23)

This is the tetrad definition

e_[definition]

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

(24)

This definition is satisfied (by construction)

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

Matrix(%id = 36893488153642493340)

(25)

This is the other way of the definition of the tetrad, relating it to the spacetime metric

e_[a, mu]*e_[a, nu] = g_[mu, nu]

Physics:-Tetrads:-e_[a, mu]*Physics:-Tetrads:-e_[`~a`, nu] = Physics:-g_[mu, nu]

(26)

TensorArray(Physics:-Tetrads:-e_[a, mu]*Physics:-Tetrads:-e_[`~a`, nu] = Physics[g_][mu, nu])

Matrix(%id = 36893488151942188916)

(27)

The equation components are all identities by eye, also by computer (useful when the expressions are difficult to read by eye).

"map(evalb,?)"

Matrix(%id = 36893488151918155164)

(28)

Summarizing: the procedure is the same one shown in the first reply, just that instead of solving the system by eye as I did from (6) to (7) of the previous workshet-reply (something correct in that simple case of Schwarzschild solution) you solve it using the computer as done above from (15) to (18), also arriving at a simple solution.

 

NULL


 

Download arbitrary_signature_(II).mw
 

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

4 5 6 7 8 9 10 Last Page 6 of 60