11858 Reputation

24 Badges

17 years, 90 days

MaplePrimes Activity

These are replies submitted by ecterrab


The issue of this thread was about the un-initialization of Physics; that is resolved.

You bring other things to the table. Regarding your first item above, as explained on the help page ?Physics,diff, you have that :-diff and Physics:-diff use the same differentiation rules - say `diff/abs`. Then when Physics is loaded, we automatically switch the differentiation rules of all the complex components to use Wirtinger derivatives. So we need to choose what to return when Physics is not loaded and you call Physics:-diff:

  1. We keep the differentiation rule unchanged because Physics is not loaded (my choice at this point) at the cost you mention; or
  2. We change the differentiation rule just because you called Physics:-diff, even when you didn't load Physics.

There are other more convoluted options, but generally speaking, you cannot have it all.

Regarding your second item, what you say is not correct in that even without having Physics loaded, if you input Physics:-Setup(wirtingerderivatives = true), you have the differentiation rules for the complex components redefined accordingly - you can use them. And if next, at any point, you input Physics:-Setup(wirtingerderivatives = false) you have those differentiation rules redefined back to their original value.

With that cleared, it remains something you touch laterally, which is the Maple definition of the differentiation rule for the complex components when Physics is not loaded. That is something (unrelated to Physics) that can be adjusted further. Do you have a concrete suggestion? We could just use:

So, basically, return them uncomputed, only represented, and in the case of a composite function, apply the chain rule. Any better idea? For reference, this is the current value of these rules:

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

I see, I was probably sleeping at this end :) indeed you mentioned "d/dx for x real". I suppose I was looking for an alternative for complex z in general. Not that that derivative always exists, but sometimes it does. Your rule for real x is thus not what we need.

Independent of that, I didn't spend more time on this yet, but what you call "the bug" might be an issue with the evaluation of abs(1, z). Anyway, I will continue this conversation in this other Mapleprimes thread.


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

 Revising this old post, you suggest this differentiation rule for abs


`diff/abs` := proc(u, z)   # implements d/dx |f(x+i*y|) when f is analytic and f(...)<>0
local u1:=diff(u,z);
1/abs(u)*( Re(u)*Re(u1) + Im(u)*Im(u1) )

proc (u, z) local u1; u1 := diff(u, z); (Re(u)*Re(u1)+Im(u)*Im(u1))/abs(u) end proc



This rule implies on the following rules for the rest of the complex components. Step by step

(FunctionAdvisor(complex_components, quiet))(z)

[Im(z), Re(z), abs(z), argument(z), conjugate(z), signum(z)]


Express all of them in terms of abs

map(proc (u) options operator, arrow; u = convert(u, abs) end proc, [Im(z), Re(z), abs(z), argument(z), conjugate(z), signum(z)])

[Im(z) = -((1/2)*I)*(z-abs(z)^2/z), Re(z) = (1/2)*z+(1/2)*abs(z)^2/z, abs(z) = abs(z), argument(z) = -I*ln(z/abs(z)), conjugate(z) = abs(z)^2/z, signum(z) = z/abs(z)]



Since `diff/abs` is defined, we can differentiate all the right-hand sides, then reconvert the result to the original function. We get:

map(proc (u) options operator, arrow; %diff(lhs(u), z) = convert(diff(rhs(u), z), op(0, lhs(u))) end proc, [Im(z) = -((1/2)*I)*(z-abs(z)^2/z), Re(z) = (1/2)*z+(1/2)*abs(z)^2/z, abs(z) = abs(z), argument(z) = -I*ln(z/abs(z)), conjugate(z) = abs(z)^2/z, signum(z) = z/abs(z)])

[%diff(Im(z), z) = -((1/2)*I)*(1-2*Re(z)/z+(Re(z)-I*Im(z))/z), %diff(Re(z), z) = 1/2+Re(z)/z-(1/2)*(Re(z)-I*Im(z))/z, %diff(abs(z), z) = ((1/2)*z+(1/2)*abs(z)^2/z)/abs(z), %diff(argument(z), z) = -I*(exp(I*argument(z))/z-(1/2)*(exp(I*argument(z)))^3*(1+1/exp((2*I)*argument(z)))/z)/exp(I*argument(z)), %diff(conjugate(z), z) = 2*((1/2)*z+(1/2)*conjugate(z))/z-conjugate(z)/z, %diff(signum(z), z) = signum(z)/z-(1/2)*signum(z)^3*(1+1/signum(z)^2)/z]


Simplifying this result (only expand, then compact)

map(proc (u) options operator, arrow; lhs(u) = simplify(expand(rhs(u)), size) end proc, [%diff(Im(z), z) = -((1/2)*I)*(1-2*Re(z)/z+(Re(z)-I*Im(z))/z), %diff(Re(z), z) = 1/2+Re(z)/z-(1/2)*(Re(z)-I*Im(z))/z, %diff(abs(z), z) = ((1/2)*z+(1/2)*abs(z)^2/z)/abs(z), %diff(argument(z), z) = -I*(exp(I*argument(z))/z-(1/2)*(exp(I*argument(z)))^3*(1+1/exp((2*I)*argument(z)))/z)/exp(I*argument(z)), %diff(conjugate(z), z) = 2*((1/2)*z+(1/2)*conjugate(z))/z-conjugate(z)/z, %diff(signum(z), z) = signum(z)/z-(1/2)*signum(z)^3*(1+1/signum(z)^2)/z])

[%diff(Im(z), z) = (1/2)*(I*Re(z)-I*z-Im(z))/z, %diff(Re(z), z) = (1/2)*(I*Im(z)+Re(z)+z)/z, %diff(abs(z), z) = (1/2)*z/abs(z)+(1/2)*abs(z)/z, %diff(argument(z), z) = ((1/2)*I)*((exp(I*argument(z)))^2-1)/z, %diff(conjugate(z), z) = 1, %diff(signum(z), z) = (1/2)*(-signum(z)^3+signum(z))/z]


The first problem I see here: %diff(conjugate(z), z) = 1. That resulted from differentiation this relationship

conjugate(z) = abs(z)^2/z

conjugate(z) = abs(z)^2/z





diff(rhs(conjugate(z) = abs(z)^2/z), z)



convert(2*Re(z)/z-abs(z)^2/z^2, conjugate)






So, either one of these conversions back-and-forth is not valid, or there is something missing in your suggestion for `diff/abs`?




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


@Carl Love 

Maple's dsolve and pdsolve can tackle differential equations with anticommutative variables. How is that done? Using Physics. That explains all the occurrences of "if `Physics/Initialized` = true then ..." in the differential equation routines that are the majority of the list you show, The calls in diff/xxx, expand, combine and simplify are kinda obvious too: they currently handle anti and non-commutative variables (btw, not a small feat!). The calls in assuming routines are also natural: Physics includes Physics:-Assume that has some advantages with regards to the older lowercase assume command, that is optionally (user setting) used by assuming.

So Physics allows for doing more things, impossible to do in standard computer algebra systems because the computational domain in Physics is larger than just complex variables and functions or matrices. The simplest example is that of algebraic and unit vectors - not matrix representations of them. Tensors and not commutative variables are another one. Then these occurrences of the word Physics in internal routines only extend the functionality of these commands to handle this extended computational domain when Physics is loaded. 

Overall, you can look at this in two ways: Physics changes Maple - I don't want changes, or Physics - optionally - extends what Maple can do, to include the mathematical objects we physicists use all the time to express formulations. Of course, there are nuances, as this thread shows, but essentially that is all about.

My take, obvious from context, is that I am extremely, even passionately, motivated by the second interpretation, that  Maple Physics optionally extends what Maple can do without Physics. And being fully aware of what Maple can do nowadays after you input with(Physics), I sometimes can't even believe it. It is a dream come true. That also matches the feedback I receive from the physics community. Btw, although I am sometimes viewed as a differential equation or mathematical functions guy, and I am that, I am a physicist by formation and heart.

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

@Carl Love @Preben Alsholm @vv @acer, each of these threads has juice. There seems, indeed, to be:

  • an issue in forget (with regards to the syntax form forget(.., x))
  • an issue in unwith (the need for unwith to call forget is clear, not happening)
  • an issue in Physics: although if you input with(Physics) it is expected that the derivatives of the complex components (e.g. conjugate) are redefined so that dz/dconjugate(z) = dconjugate(z)/dz = 0 (Wirtinger derivatives), on the other hand, after reading this thread, I think calling Physics:-diff (and not with(Physics)) should not do this redefinition. And these things need to be documented somewhere visible.

I am a bit overloaded this week but I will try to address some or all of these issues (the one in forget may be out of reach) and upload the adjustments for everybody in the following Maplesoft Physics Updates.

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

Hi @Preben Alsholm 
You are right, unwith unloads the package and forget clears remember tables from results obtained with the package, both concepts apply to any package. This is expected and what one needs to do, @Carl Love, when you want to restore the previous behavior without restart.

@acer , forget - say diff - with subfunctions = true clears remember tables of everything that starst with diff, e.g. `diff/conjugate`, but I suppose you are aware of that so maybe it's Sunday morning here and I'd need to read your answer more carefully.

@vv, several things, not "almost everything", is redefined when you load Physics. The redefinitions are as in more functionality is available, e.g. you can differentiate with respect to a function (say conjugate(z)), and then there are very few exceptions, less than a handful of extended-different behavior that makes sense in the Physics context; e.g. after with(Physics), Heaviside(0) = 1/2 instead of Heaviside(0) = undefined. In this example, more importantly, for all the functions shown by FunctionAdvisor(complex_components), Physics' default is usewirtingerderivatives = true (about that, check this Mapleprimes post), i.e.: z and conjugate(z) are considered in equal footing, dz/dconjugate(z) = dconjugate(z)/dz = 0.

The key idea behind the Physics package integrated into the Maple system is that it extends the default computational domain with vectors, tensors, anti and non commutative variables and functions, curved spacetimes, Wirtinger derivatives for the complex components, differentiation using a jet concept (q(t) and diff(q(t),t) as independent differentiation variables); Etc. All this is explained in ?Physics. Whoever doesn't need any of that, just doesn't load Physics, and whoever needs that, needs it within the Maple system, not separated.

Finally, @Carl Love and @acer , I am surprised that forget(.., conjugate(f(x))) used by Carl, or even forget(.., x) didn't clear the remember table of :-diff. That requires a further look since the expected behavior is for forget to have cleared all tables containing the second (and any subsequent) argument; though this has nothing to do with Physics.

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

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 


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

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


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.


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

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