ecterrab

14085 Reputation

24 Badges

19 years, 100 days

MaplePrimes Activity


These are replies submitted by ecterrab

@nm 

Are you trying from TTY Maple? If so, that is the problem, reported already. You need to update from Maple's GUI, the worksheet, as in open a Maple worksheet and there input Physics:-Version(latest), or use the icons of the MapleCloud toolbar. Both methods work fine for everybody as far as I know.

@acer 
Very interesting cocktail of commands ... Have you tried with different orderings for the output of indets(expr,suffixed(P)? That, I think, is the important question, since the output of indets is a set and the ordering is not predictable with ease. 

Either way, behind the scenes, it is `simplify/size` doing key parts of the job (if you assign `simplify/size` := u -> u; the superb compactification you achieved in your last input line disappears entirely). But I wonder whether the core idea I see in thaw(simplify(collect(expr, [G1, P2, P5], freeze@simplify))) - if it is not so sensitive to the ordering returned by indets (I see you are choosing by hand [G1, P2, P5]) - could be somehow used to improve `simplify/size` itself. In the latest Maplesoft Physics Updates, there is a version of `simplify/size` that works better than the one in Maple 2022.2, but it doesn't achieve the compactification you achieved. The codegen[optimize])(..., tryhard) mentioned by @Carl Love is also an excellent suggestion. This command, `simplify/size`, is relatively good, but being key functionality, any improvement is very welcome!

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

@Ahmed111 
After removing that unnecessary transformation equation, dchange does not interrupt with an error message anymore; that answers your question. Fix also pde -> pde1 in your input and check all of it. Your transformation - the way you present it - involves var[1] and var[2]. There is however nothing like that in the equation you are transforming. Therefore, dchange "does noting" - because nothing is to be done. Your old variables are x and t, only. See the help page ?dchange for examples on how to use the command.

@Ronan 
No that I know of. It is not difficult to write one though - a matter of time only. I preferred to not invest on that - prefer everything in white and black, but did tweak Komodo in several ways for fast-programming activity.

Komodo has this useful functionality where you can program macros, assign triggering key combos, and have the output in a window at the bottom. I have one I call "mint selection" with the purpose you ask, that is to flash up bugs in a portion of code (possibly a whole file).

It is a good example of things I didn't find how to do in other editors so easily, so worth showing here as an example. I want to "Pass selection as input" (an option in Komodo's macros), where by selection I mean "something highlighted with the mouse", and on that selection, execute :
<Maple installation>/bin/mint -s -i 2 -I ~/Maple/lib -l

and in this Komodo macro I have "Command Output Tab", so that the output is presented on a window that opens at the bottom, and there I see, exactly where is the problem with a portion of code I wrote. I cannot write in that output window but I can copy something I see in it and paste in the working window. All extremely useful.

Komodo has several other facilities, I have/use approx 10 macros. It is a pity for me that its development for Macintosh stopped (I use Mac). I managed to have a working version for Monterrey and previous OS versions. Not for Ventura yet.

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

@zenterix 
I am forwarding the problem you posted to the people who take care of that, adding it to the database of issues too.

On the other topic you mentioned, I missed saying that - for programming purposes (not interactive mathematics) - I use a Programmer's File Editor. I do not program within a Maple input line. For me, that is just not comfortable, even if you work using 1D-Math notation. A programmer's editor has significant useful tools. I use a tweaked version of Komodo, but many good programmer editors exist. 

@nm 
Your question is answered in my previous answer; read it slower. I said "Regarding another part of your question, dsolve matches c__n to _Cn only for the integration constants that it introduces / uses, not for al possiblel n (infinitely many)." Pass a fourth order ODE that gets solved and you will see 4 c__n matched to _Cn, and not more than that.

@acer 
I see I wasn't as clear as I thought. In my reply, I mentioned dsolve((2)). Not dsolve((2), arbitraryconstants = subscripted). So, using dsolve((2)), not Physics, no arbitraryconstants = ..., no Maple/toolbox, no mapleinit file, nada, so in that state, not only Maple 2022.2 and 2022.1 trigger the same Warning message, which - I understand - is the issue of this thread, but also Maple 2021 triggers that undesired Warning. Try it; you can download "not related to physics.mw", the worksheet I used to produce my previous reply.

To summarize, this is not related to Physics. Somehow, there is something with the Units package and the input of the worksheet posted such that it triggers this Warning message. The fact that @C_R also uses Physics and the Maplesoft Physics Updates, is a red-herring and deviates the attention from the main issue; this is my understanding of the matter.

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

@acer 

 

Download not_related_to_physics.mw

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

@itsme 
Interesting ... I never installed the Updates from Maple TTY (a terminal). I tried that now, and am able to reproduce your problem. That problem doesn't exist, however, if I install the Updates from the GUI (worksheet). So the solution is: the same input, as always, but within a worksheet, not  a terminal Maple; and I will take a look anyway to see what the problem with a terminal Maple is. 

PS Nov/16: the problem in Maple TTY is now fixed at the company. I will see to include the fix in one of the next versions of the Maplesoft Physics Updates.

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

 

@Carl Love 
The problem posted had nothing to do with the entering something assuming some_property, without specifying variables. The problem, as explained, was related to the use of quotes around the keyword 'right', and that is what got fixed in v.1340 of the Updates.

Your sentence (first paragraph, read it again) implies a recommendation to not use something assuming some_property including "[if you don't use that syntax] it works", followed by "Otherwise some problem occurs", and today "I've encountered an error (I don't remember details)". All that - for me - means "do not use it, it is problematic", while my opinion is use it! it is a great feature! Indeed, it is fantastically handy for symbolic experimentation. And if you find a problem and are able to remember it and post it, the problem will get fixed; we are rather quick at that. By the way, generally speaking, there is no software free of problems - only free of known problems.

Regarding your question,

"Suppose I were to write a command that used keyword parameters. How would I tell assuming about those keywords? "

This is an interesting one. When I wrote this command, I also provided a mechanism to indicate to assuming the keywords of a user-written command. Then Maple's syntax improved and now every procedure's parameter enclosed within {} is automatically a keyword (see ?argument_processing). So now there are two mechanisms to tell assuming about those keywords:

  1. Just create your procedure using {} to indicate a proc's parameter is a keyword, and assuming will automatically take that info into account, and will not place any assumption on it.
  2. Use: "keywords" assuming command keyw1, keyw2, ... in a Maple worksheet or in the Maple initialization file to indicate to assuming the keywords or keyword positions of the procedure command. A range of positions can be specified by using i..j. For example, 2..3 refers to the second and third position and 5..-2 refers to the fifth to second-to-last argument(s). If no keywords or positions are included, the "keywords" assuming command calling sequence returns the recognized keywords and/or keyword positions for command.

Naturally, the way "1." is the simpler and generally speaking it can cover all user-written command's keywords. The way "2." is more involved, and provides more flexibility, mainly for Maple commands written before the introduction of keywords using {}. 

As an example of 1., consider P := proc(x, {real::truefalse := false}) if real then 1; else 0; fi; end. Next input P(x, real) assuming positive and ou receive 1, indicating no assumption was placed on the keyword real.

As an involved example of 2. input "keywords" assuming int and you will see how the keywords of int are set. For simpler ones, try prem or normal instead of int.

Summarizing: I recommend using something assuming some_property as a very handy and quick way for doing symbolic exploration. If you find a problem please remember to post it, we fix things quickly, and yes, you can indicate the keywords of commands you write, either automatically (item 1. above) or in more ellaborate ways (item 2.).

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

@C_R 
Yes, though I'd need to see if I can include it working with the Maplesoft Physics Updates for Maple 2022; tomorrow or next week, I will write here again about that.

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

@awass 
As described in the post, a literal subscript is a letter followed by __ followed by a number, e.g., c__1. They look very similar to c[1], but if you look at the number you see it is italicized instead of roman. So, if you want to assign after dsolve has returned it, go with c__1 := 7, not c[1] := 7. Depending on your work, you may prefer subs(c__1 = 7, solution) instead of assigning a value.

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

@vv 

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

@vv 
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.

best

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) )
end;

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

(1)
 

 

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)]

(2)

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)]

(3)

 

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]

(4)

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]

(5)

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

(6)

simplify((lhs-rhs)(%))

0

(7)

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

2*Re(z)/z-abs(z)^2/z^2

(8)

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

2*((1/2)*z+(1/2)*conjugate(z))/z-conjugate(z)/z

(9)

simplify(2*((1/2)*z+(1/2)*conjugate(z))/z-conjugate(z)/z)

1

(10)

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

``


Download your_suggested_differentiation_rules.mw

 

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

5 6 7 8 9 10 11 Last Page 7 of 62