## 13316 Reputation

18 years, 77 days

## Just a way to represent the norm of a ve...

Answering the question the way you put it, abs(F) always represents the absolute value of the complex variable F, regardless of whether Physics is loaded.

Now, about this Mechanics (Statics) section: in general, depending on the problem, you can choose to represent the objects with which you compute in one way or another. In this problem, the modulus of a vector - say A_ - which in Physics:-Vectors is represented by Norm(A_) - can also be represented as abs(A) (with A, not A_). Sometimes in textbooks, you see Norm(A_) represented by just the letter A, not |A| and not ||A_||.

And why using abs(A) (that displays |A|) instead of Norm(A_) (that displays ||A_||)? The technique used to solve this problem you are mentioning uses assignments. You see right at the beginning R_[B] := abs(R[B]) * _k. An assignment like this one would interrupt you with an "Error, recursive assignment" if on the right-hand side of that assignment, you use Norm(R_[B]). Using abs(R[b]) represents the object properly (within the context of this problem) avoids that recursive assignemnt, is short input, and places a visually open and close |...| which helps the readability of the output.

One could as well tackle this problem without using assignment, using equations instead, as in R_[B] = Norm(R_[B]) * _k, (note = instead of := ), then use substitutions to perform the computational steps. That is done in the majority of the other solved problems in this MaplePrimes presentation about Mechanics.

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

## PDEtools:-dchange...

You can use PDEtools:-dchange, it has code for doing precisely that, among other things. Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

## Physics handles the problem, both with M... Download inert_matrix_products_(reviewed).mw

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

## Non-obvious...

In retrospective, I think the most impactful decision I took when writing a new latex command  for Maple 2021 was to not rely on `latex/foo` for displaying anything. Instead, rely on the Typesetting of it, which is "what you see displayed".

At the user level of latex, this is non-obvious; at the implementation level, for me at least, it was the only natural thing: we already have, in the Typesetting code, "how things should look"; coding that a second time as `latex/foo` didn't sound right. I made the same "wipe out" of redundant code years ago when removing `D/foo` routines from the library: nowadays, D uses the differentiation rules coded as `diff/foo`.

In both cases, `D/foo` and `latex/foo`, the old mechanism is still in place, but basically used nowhere in the Maple library.

So, besides the examples shown in ?latex,functions, if you want to see something closer to the actual implementation to write your own routines, say for AnticommutatorI suggest you input the expression, have it displayed in front of you, as it comes, or construct the way you want it displayed e.g. using the palettes, and recall that since Maple 2021 latex is based on what you are a looking at (the displayed expression) , then input:

> Typesetting:-Typeset(%);

Copy the output, paste, and you can do the experiments you feel appropriate to write your `latex/foo` routine as explained in ?latex,functions.

A question related to yours is: "How do you code `print/foo`?" Nowadays, that also takes advantage of Typesetting. For instance, input with(Physics), then

> showstat(`print/AntiCommutator`)

and you will see it using Typesetting structures. From `print/AntiCommutator`  to a customized `latex/AntiCommutator` is two steps.

In fact, it suffices for you to write your `print/foo` to have that automatically taken into account by latex.

Now, the construction of Typesetting structures is not documented. But, you know, Maple is fantastic for its openness: for anything you find interestingly displayed, input lprint(Typesetting:-Typest(%)) followed by copy and paste on an input line for experimentation, and you will figure out rather quickly how Typesetting structures work.

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

## It works fine in Maple 2022...

I suppose you are using an older version of Maple, before the rewriting of latex that happened for Maple 2021. This is the output in the current Maple 2022, and is as expected, mentioned by @Rouben Rostamian, no need for additional manipulations to make it work. Edgardo S. Cheb-Terrab
Physics, Differential Equations and Matheatical Functions, Maplesoft

## MaplePrimes post and TransformCoordinate...

Hi
For a succinct approach to check that these transformations leave the metric invariant, see the help page for Physics:-TransformCoordinates on how to apply it to the metric. Then, for a more general discussion see this MaplePrimes post about Lorentz transformations, though I am not sure that presentation is reproducible in the old Maple 2016 - you may need a newer one.

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

## Fixed within the Maplesoft Physics Updat...

I don't recall seeing this one before; a fix is distributed within the Maplesoft Physics Updates v.1383 or newer.

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

A fix for this that works in Maple 2022 is distributed in the Maplesoft Physics Updates v.1379 or newer. Regarding the issue itself, historically, there were some open/close () surrounding y' within powers, as in this image: Those unnecessary parentheses got removed from the typesetting of expressions (you see this in recent Physics Updates). That is correct, but a correlated change in latex to enclose y' within {} (because latex represents that as y^') to avoid power of power was missed; it is now in place.

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

A fix for this is distributed for everybody using Maple 2022 within the Maplesoft Physics Updates v.1377. The dsolve command now returns no answer for this ODE; though I still want to revise this further, it might be solvable; for next week.

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

## Setup(coordinates = X)...

Hi

Input Setup(coordinates = X) and you have a set of arbitrary coordinates, with the only assumption that they are real. You can see that for instance entering about(x1). If that assumption is an issue for you (regarding generality), you can always map(u -> Assume(u = u), [X]) and those assumptions disappear.

You can read more about this in the help page ?Physics,Tensors, section 1.a where all this is explained, or in the help page ?Physics:-Coordinates.

If this level of generality is not general enough for your computation, could you please post a worksheet showing where the problem is (where you feel there is a lack of generality), and we continue the conversation from there.

By the way, the special cases Cartesian, cylindrical and spherical when you input Setup(coordinate = <one of those three>) just places additional corresponding assumptions, e.g. phi is between 0 and 2*Pi.

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

## The Physics package...

Hi,
There are two packages with which you can compute mostly everything related to General Relativity: Physics and DifferentialGeometry. For this task, generally speaking, Physics is the way to go in that the package is more modern, its use is more straightforward, it works with standard algebraic Maple expressions, the notation is as in textbooks, and the package is more versatile. All this is documented in the help system.

The pages you may want to look are ?g_ for the metric, ?D_ for the covariant derivative, ?Riemann, ?Ricci and ?Weyl for the corresponding tensors and, generally speaking, part II "Curved spacetimes" of the help page ?Physics,Tensors, That page has a reasonably complete presentation with examples.

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

## PDEtools:-dpolyform...

See the help page with examples for PDEtools:-dpolyform; it does exactly what you are asking for. Although algeqtodiffeq, also mentioned in the answers, achieves the same in some particular cases (the expression must be holonomic, the resulting differential equation can only be linear or the problem is out of the scope of algeqtodiffeq), the dpolyform command is general, can perform the task also when the result involves nonlinear differential equations and handles holonomic and non-holonomic expressions in equal footing.

By the way, both dsolve and pdsolve use dpolyform to rewrite differential equations with mathematical functions and non-integer powers as systems of differential equations rational in the unknowns an its derivatives, in that way making it possible to perform differential elimination in the presence of mathematical functions and non-integer powers.

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

## Exact solution and region of validity...   NOTE Jan/11: answer updated following comment by @Kitonum - the integral can be computed exactly.

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

## latex:-Settings(usedefaultlatexmacros = ...

Hi @nmacsai, you need to change your icon: I mentioned this when you copied mine time ago.

Try latex:-Settings(usedefaultlatexmacros = true). These settings are explained in the ?latex help page, although usedfaultlatexmacros is not yet documented. It is however visible when inputting latex:-Settings(). With usedefaultlatexmacros = true, Maple will use the closer default LaTeX macro instead of the macros found in maple.sty, at the cost of sometimes not achieving a final-pdf-look closer to what you see in the worksheet.

By the way, in the computer algebra world, everything beyond arithmetics has a help page, and it is recommended to take a quick look at it before using a command or answering a question in our minds (in ?latex it is mentioned the maple.sty file)

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

## Second order ODEs... 