acer

32562 Reputation

29 Badges

20 years, 24 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

On a somewhat related note, I recall that I once wrote this, to mimic independent aspect ratios for axes of a particular flavor (implicitplot3d) of 3D plot.

That's not the same as the zooming thing for 3D plots, but the two topic intertwine, in practice.

I don't actually believe that a pure Library-size solution is possible, despite having written that old Post. What I suspect might be best would be wholly new elements of the PLOT3D structure, which would denote to the (GUI) plot-renderer what axes-aspect-ratios and scaling/zoom factor to use. Those substructure elements would, naturally, be constructed via new options to the relevent Library plotting commands.

@C_R There is a form for it, here.

Whether it goes through the form, or though tech support, it ends up in the same bug tracking database system (and for which triage assessment gets items assigned to the appropriate developer or group).

In your example, this expression (as well as the values substituted into it) does not depend on x,

    rhs(isolate(de5, diff(p(x), x)))

And that's what's used for the vertical (second) component in your plotted points.

It doesn't depend on x, and it doesn't vary with x.

@salim-barzani Please put your followup example for this here, not in a wholly separate and new Question thread. A separate Question thread on this will be deleted.

So, was this the effect you were after, in the sense of avoiding unwanted fractions?

nb. Some more cosmetic improvement could be had by rearranging terms in sums, so that fewer leading terms have a minus sign. I have several variants of code that do this, and can handle this example. (This example is useful because some coefficients in the collect call have opposing needs for sort re-ordering. So no single sort call applied to the whole expression might serve. I have a prototype of a routine that runs through the sub-term sums individually, figuring out a "nice" term re-ordering, in a coefficient-by-coefficient way. Maybe I will make a Post about it. Let me know if you just want a one-off to further beautify this example sooner/now.)

Which fractions do you object to?

Which expressions are you wanting to export?

@vv I thought you might enjoy this (forced) variant, done in Maple 2024.2,

restart;

A := (-8*x - 16)*exp(x/2) + x^2 + 4*x + 16*exp(x) + 4;

(-8*x-16)*exp((1/2)*x)+x^2+4*x+16*exp(x)+4

B := (4*exp(x/2)-x-2)^2;

(4*exp((1/2)*x)-x-2)^2

simplify(eval(factor(expand(eval(A,x=2*t))),t=x/2));

(-4*exp((1/2)*x)+x+2)^2


Download nm_simp_exB.mw

@vv That's nice, short, and easily understandable. (vote up, naturally)

In Maple 2025.0, without the factor@expand,

> kernelopts(version);
   Maple 2025.0, X86 64 LINUX, Mar 24 2025, Build ID 1909157

> A := -x*(x - 4*exp(x/2) + 2):
> B := x*sqrt((-8*x - 16)*exp(x/2) + x^2 + 4*x + 16*exp(x) + 4):

> simplify(eval(A-B,x=2*t)) assuming t::real;

                0

In Maple 2024.2 it doesn't need the substitution,

restart;

kernelopts(version);

`Maple 2024.2, X86 64 LINUX, Oct 29 2024, Build ID 1872373`

A := -x*(x - 4*exp(x/2) + 2):

B := x*sqrt((-8*x - 16)*exp(x/2) + x^2 + 4*x + 16*exp(x) + 4):

simplify(A-B) assuming x::real;

0

Download nm_simp_ex.mw

@nm Why not consider it a sympy weakness?

What does that O(..) term represent there? Is it so useful, that its presence/absence might not be used for some addititional programmatic leverage?

Please put your queries in a "Question", rather than a "Post", in future.

I've changed this one to a "Question", for you.

ps. Yesterday you submitted two Posts for it, concurrently, with the exact same content, before any moderator touched either. There's no need for that.

@zenterix You had several flavours of plot call. If you run into issues for any of them then you can come back to this, and force it with these options.

@segfault When my Java GUI locks up, and it won't close down using its window's corner icons, then I kill the parent java process in my OS.

That usually also kills its child mserver processes, but if not then I kill those afterwards


ps. Since I sometimes run multiple worksheets (some of which I really don't want to die if any other worksheet freezes the GUI) I use an option to allow wholly separate Java virtual engines. I do this by adding    -standalone   after the executable call string in the Properties of the desktop icon that can launch the Maple GUI.

@segfault If I change the color and font of "Maple Input", then Ctrl-j inserts a new Execution Group that respects those choices.

And if I save that choice for an empty .mw worksheet file, and set it for "Open worksheet at startup", then each new worksheet (File->New) also gets those choices for "Maple Input", including in new Exec Groups inserted using Ctrl-j.

It also gets the modified style choices if I use F3 to split (or get a new Exec Grp below, if focus is at the end of the current Grp).

I didn't have to manage "Style Sets" (per se) to get that working. I just modified "Maple Input" (via "Format", from the menubar), removed all content of the sheet, the saved the empty .mw file and made it the default start-sheet.

It's unfortunate you can't get that working; perhaps you have bad luck. Can you not upload and attach your custom empty/template start-sheet here?

@segfault Your original Question text is not clear about whether you wanted only to change the Input from black 2-D Math to plaintext reddish Maple Notation, or whether you also wanted a custom font family and input color.

If you want to adjust the color (Burgundy to Red, say), or to use a different named font, then you can create a Style Set for that. See the link in my Answer.

You can also create an empty Worksheet that uses your custom Style Set, and then make that the default (unnamed) sheet that appears when you do File->New to open another. See the menubar item,
    Tools->Options->Interface->Open worksheet at startup
and set it to your empty (template) worksheet that has the Style Set you want. (You might also be able to put it on a customized Start Page, but that doesn't seem simplest.)

In the original Question the OP mentioned simplify only a a failed way to get the desired sub-term sorting effect. as I read it. (I didn't originally interpret that as a request to also factor or simplify.)

But here that is, with some factoring as a preliminary step:

restart;

odes := [-(diff(x__1(t), t, t))+(2*x__1(t)-2*x__2(t))*`λ__12`(t)+(2*(-x__3(t)+x__1(t)))*`λ__31`(t) = 0, -(diff(y__1(t), t, t))+(2*y__1(t)-2*y__2(t))*`λ__12`(t)+(2*(-y__3(t)+y__1(t)))*`λ__31`(t) = 0, -(diff(z__1(t), t, t))+(2*z__1(t)-2*z__2(t))*`λ__12`(t)+(2*(z__1(t)-z__3(t)))*`λ__31`(t) = 0, -(diff(x__2(t), t, t))+(-2*x__1(t)+2*x__2(t))*`λ__12`(t)+(2*(x__2(t)-x__3(t)))*`λ__23`(t) = 0, -(diff(y__2(t), t, t))+(-2*y__1(t)+2*y__2(t))*`λ__12`(t)+(2*(y__2(t)-y__3(t)))*`λ__23`(t) = 0, -(diff(z__2(t), t, t))+(-2*z__1(t)+2*z__2(t))*`λ__12`(t)+(2*(z__2(t)-z__3(t)))*`λ__23`(t) = 0, -(diff(x__3(t), t, t))+(-2*x__2(t)+2*x__3(t))*`λ__23`(t)-(2*(-x__3(t)+x__1(t)))*`λ__31`(t) = 0, -(diff(y__3(t), t, t))+(-2*y__2(t)+2*y__3(t))*`λ__23`(t)-(2*(-y__3(t)+y__1(t)))*`λ__31`(t) = 0, -(diff(z__3(t), t, t))+(-2*z__2(t)+2*z__3(t))*`λ__23`(t)-(2*(z__1(t)-z__3(t)))*`λ__31`(t) = 0]

the code


The factors of 2 can be pulled out of the coefficients.

new := eval(subsindets(-~odes, `+` ,
                       u->``(content(u))*simplify(u/content(u))),
            ``=(u->u));

[diff(diff(x__1(t), t), t)+2*(-x__1(t)+x__2(t))*lambda__12(t)+2*(-x__1(t)+x__3(t))*lambda__31(t) = 0, diff(diff(y__1(t), t), t)+2*(-y__1(t)+y__2(t))*lambda__12(t)+2*(-y__1(t)+y__3(t))*lambda__31(t) = 0, diff(diff(z__1(t), t), t)+2*(-z__1(t)+z__2(t))*lambda__12(t)+2*(-z__1(t)+z__3(t))*lambda__31(t) = 0, diff(diff(x__2(t), t), t)+2*(x__1(t)-x__2(t))*lambda__12(t)+2*(-x__2(t)+x__3(t))*lambda__23(t) = 0, diff(diff(y__2(t), t), t)+2*(y__1(t)-y__2(t))*lambda__12(t)+2*(-y__2(t)+y__3(t))*lambda__23(t) = 0, diff(diff(z__2(t), t), t)+2*(z__1(t)-z__2(t))*lambda__12(t)+2*(-z__2(t)+z__3(t))*lambda__23(t) = 0, diff(diff(x__3(t), t), t)+2*(x__2(t)-x__3(t))*lambda__23(t)+2*(-x__3(t)+x__1(t))*lambda__31(t) = 0, diff(diff(y__3(t), t), t)+2*(y__2(t)-y__3(t))*lambda__23(t)+2*(-y__3(t)+y__1(t))*lambda__31(t) = 0, diff(diff(z__3(t), t), t)+2*(z__2(t)-z__3(t))*lambda__23(t)+2*(z__1(t)-z__3(t))*lambda__31(t) = 0]


And now the sorting of subterms can be done.

F(new);

[diff(diff(x__1(t), t), t)+2*(x__2(t)-x__1(t))*lambda__12(t)+2*(x__3(t)-x__1(t))*lambda__31(t) = 0, diff(diff(y__1(t), t), t)+2*(y__2(t)-y__1(t))*lambda__12(t)+2*(y__3(t)-y__1(t))*lambda__31(t) = 0, diff(diff(z__1(t), t), t)+2*(z__2(t)-z__1(t))*lambda__12(t)+2*(z__3(t)-z__1(t))*lambda__31(t) = 0, diff(diff(x__2(t), t), t)+2*(x__1(t)-x__2(t))*lambda__12(t)+2*(x__3(t)-x__2(t))*lambda__23(t) = 0, diff(diff(y__2(t), t), t)+2*(y__1(t)-y__2(t))*lambda__12(t)+2*(y__3(t)-y__2(t))*lambda__23(t) = 0, diff(diff(z__2(t), t), t)+2*(z__1(t)-z__2(t))*lambda__12(t)+2*(z__3(t)-z__2(t))*lambda__23(t) = 0, diff(diff(x__3(t), t), t)+2*(x__2(t)-x__3(t))*lambda__23(t)+2*(x__1(t)-x__3(t))*lambda__31(t) = 0, diff(diff(y__3(t), t), t)+2*(y__2(t)-y__3(t))*lambda__23(t)+2*(y__1(t)-y__3(t))*lambda__31(t) = 0, diff(diff(z__3(t), t), t)+2*(z__2(t)-z__3(t))*lambda__23(t)+2*(z__1(t)-z__3(t))*lambda__31(t) = 0]


And, if you want that rendering in separate lines,

map(print, new):

diff(diff(x__1(t), t), t)+2*(x__2(t)-x__1(t))*lambda__12(t)+2*(x__3(t)-x__1(t))*lambda__31(t) = 0

diff(diff(y__1(t), t), t)+2*(y__2(t)-y__1(t))*lambda__12(t)+2*(y__3(t)-y__1(t))*lambda__31(t) = 0

diff(diff(z__1(t), t), t)+2*(z__2(t)-z__1(t))*lambda__12(t)+2*(z__3(t)-z__1(t))*lambda__31(t) = 0

diff(diff(x__2(t), t), t)+2*(x__1(t)-x__2(t))*lambda__12(t)+2*(x__3(t)-x__2(t))*lambda__23(t) = 0

diff(diff(y__2(t), t), t)+2*(y__1(t)-y__2(t))*lambda__12(t)+2*(y__3(t)-y__2(t))*lambda__23(t) = 0

diff(diff(z__2(t), t), t)+2*(z__1(t)-z__2(t))*lambda__12(t)+2*(z__3(t)-z__2(t))*lambda__23(t) = 0

diff(diff(x__3(t), t), t)+2*(x__2(t)-x__3(t))*lambda__23(t)+2*(x__1(t)-x__3(t))*lambda__31(t) = 0

diff(diff(y__3(t), t), t)+2*(y__2(t)-y__3(t))*lambda__23(t)+2*(y__1(t)-y__3(t))*lambda__31(t) = 0

diff(diff(z__3(t), t), t)+2*(z__2(t)-z__3(t))*lambda__23(t)+2*(z__1(t)-z__3(t))*lambda__31(t) = 0

Download Format_odes_acc2.mw

note: Here, I omitted assigning the result from F (which sorts the subterms) to yet another name, just to show that the effect on new is in-place,

Some more natural attempts at the preliminary step of such factoring can sometimes run amok of automatic simplification getting in the way (eg. if one tried collect(...,[..lambda__ij's..],..) say). That relates to what the OP has noted about automatic simplification happening on 2*(a+b) but not on 2*(a+b)*c say.

ps. I didn't need to utilize ``(...) specifically in the preliminary stage. I could have chosen something else, like __K(...) in its stead, as the way to temporarily wrap the content(u) and avoid immediate automatic simpliciation. I only chose ``(...) because it can be fun/insightful to see the intermediate expression before that's removed with the eval call. As it happens that preliminary factoring&simplification could also be done for this example with,

   collect(lhs~(-~odes),[diff],u->content(u)*simplify(u/content(u)))=~0;

But, as mentioned, you sometimes have to be careful with the last action in a collect call, due to automatic simplication.

Lastly, I'm confident you've realized that the following would happen, also due to automatic simplification.

2*((x__2(t) - x__1(t))*lambda__12(t) - (x__1(t) - x__3(t))*lambda__31(t));

2*(x__2(t)-x__1(t))*lambda__12(t)-2*(x__1(t)-x__3(t))*lambda__31(t)

So far I haven't used any inert representation to get a rendered formatting to avoid that; My previous answers have produced expressions that print as they are. But here's a variant that pulls out the common factors of 2, and represents it inertly, in a couple of ways,

restart;

odes := [-(diff(x__1(t), t, t))+(2*x__1(t)-2*x__2(t))*`λ__12`(t)+(2*(-x__3(t)+x__1(t)))*`λ__31`(t) = 0, -(diff(y__1(t), t, t))+(2*y__1(t)-2*y__2(t))*`λ__12`(t)+(2*(-y__3(t)+y__1(t)))*`λ__31`(t) = 0, -(diff(z__1(t), t, t))+(2*z__1(t)-2*z__2(t))*`λ__12`(t)+(2*(z__1(t)-z__3(t)))*`λ__31`(t) = 0, -(diff(x__2(t), t, t))+(-2*x__1(t)+2*x__2(t))*`λ__12`(t)+(2*(x__2(t)-x__3(t)))*`λ__23`(t) = 0, -(diff(y__2(t), t, t))+(-2*y__1(t)+2*y__2(t))*`λ__12`(t)+(2*(y__2(t)-y__3(t)))*`λ__23`(t) = 0, -(diff(z__2(t), t, t))+(-2*z__1(t)+2*z__2(t))*`λ__12`(t)+(2*(z__2(t)-z__3(t)))*`λ__23`(t) = 0, -(diff(x__3(t), t, t))+(-2*x__2(t)+2*x__3(t))*`λ__23`(t)-(2*(-x__3(t)+x__1(t)))*`λ__31`(t) = 0, -(diff(y__3(t), t, t))+(-2*y__2(t)+2*y__3(t))*`λ__23`(t)-(2*(-y__3(t)+y__1(t)))*`λ__31`(t) = 0, -(diff(z__3(t), t, t))+(-2*z__2(t)+2*z__3(t))*`λ__23`(t)-(2*(z__1(t)-z__3(t)))*`λ__31`(t) = 0]

the code

new := eval(subsindets(-~odes, `+` ,
                       u->``(content(u))*simplify(u/content(u))),
            ``=(u->u)):

F(new):

map(print,Equate(collect(lhs~(new),[diff],
                         u->ifelse(member(content(u),[-1,1]),u,
                                   ``(content(u))*collect(u/content(u),[]))),
                 rhs~(new))):

diff(diff(x__1(t), t), t)+``(2)*((x__2(t)-x__1(t))*lambda__12(t)+(x__3(t)-x__1(t))*lambda__31(t)) = 0

diff(diff(y__1(t), t), t)+``(2)*((y__2(t)-y__1(t))*lambda__12(t)+(y__3(t)-y__1(t))*lambda__31(t)) = 0

diff(diff(z__1(t), t), t)+``(2)*((z__2(t)-z__1(t))*lambda__12(t)+(z__3(t)-z__1(t))*lambda__31(t)) = 0

diff(diff(x__2(t), t), t)+``(2)*((x__1(t)-x__2(t))*lambda__12(t)+(x__3(t)-x__2(t))*lambda__23(t)) = 0

diff(diff(y__2(t), t), t)+``(2)*((y__1(t)-y__2(t))*lambda__12(t)+(y__3(t)-y__2(t))*lambda__23(t)) = 0

diff(diff(z__2(t), t), t)+``(2)*((z__1(t)-z__2(t))*lambda__12(t)+(z__3(t)-z__2(t))*lambda__23(t)) = 0

diff(diff(x__3(t), t), t)+``(2)*((x__2(t)-x__3(t))*lambda__23(t)+(x__1(t)-x__3(t))*lambda__31(t)) = 0

diff(diff(y__3(t), t), t)+``(2)*((y__2(t)-y__3(t))*lambda__23(t)+(y__1(t)-y__3(t))*lambda__31(t)) = 0

diff(diff(z__3(t), t), t)+``(2)*((z__2(t)-z__3(t))*lambda__23(t)+(z__1(t)-z__3(t))*lambda__31(t)) = 0

map(print,Equate(collect(lhs~(new),[diff],
                         u->ifelse(member(content(u),[-1,1]),u,
                                   eval('Typesetting:-Typeset'(content(u)))*collect(u/content(u),[]))),
                 rhs~(new))):

Parse:-ConvertTo1D, "invalid input %1", Typesetting:-mprintslash([diff(diff(x__1(t), t), t)+Typesetting:-mn("2")*((x__2(t)-x__1(t))*lambda__12(t)+(x__3(t)-x__1(t))*lambda__31(t)) = 0], [diff(diff(x__1(t), t), t)+Typesetting:-mn("2")*((x__2(t)-x__1(t))*lambda__12(t)+(x__3(t)-x__1(t))*lambda__31(t)) = 0])

Parse:-ConvertTo1D, "invalid input %1", Typesetting:-mprintslash([diff(diff(y__1(t), t), t)+Typesetting:-mn("2")*((y__2(t)-y__1(t))*lambda__12(t)+(y__3(t)-y__1(t))*lambda__31(t)) = 0], [diff(diff(y__1(t), t), t)+Typesetting:-mn("2")*((y__2(t)-y__1(t))*lambda__12(t)+(y__3(t)-y__1(t))*lambda__31(t)) = 0])

Parse:-ConvertTo1D, "invalid input %1", Typesetting:-mprintslash([diff(diff(z__1(t), t), t)+Typesetting:-mn("2")*((z__2(t)-z__1(t))*lambda__12(t)+(z__3(t)-z__1(t))*lambda__31(t)) = 0], [diff(diff(z__1(t), t), t)+Typesetting:-mn("2")*((z__2(t)-z__1(t))*lambda__12(t)+(z__3(t)-z__1(t))*lambda__31(t)) = 0])

Parse:-ConvertTo1D, "invalid input %1", Typesetting:-mprintslash([diff(diff(x__2(t), t), t)+Typesetting:-mn("2")*((x__1(t)-x__2(t))*lambda__12(t)+(x__3(t)-x__2(t))*lambda__23(t)) = 0], [diff(diff(x__2(t), t), t)+Typesetting:-mn("2")*((x__1(t)-x__2(t))*lambda__12(t)+(x__3(t)-x__2(t))*lambda__23(t)) = 0])

Parse:-ConvertTo1D, "invalid input %1", Typesetting:-mprintslash([diff(diff(y__2(t), t), t)+Typesetting:-mn("2")*((y__1(t)-y__2(t))*lambda__12(t)+(y__3(t)-y__2(t))*lambda__23(t)) = 0], [diff(diff(y__2(t), t), t)+Typesetting:-mn("2")*((y__1(t)-y__2(t))*lambda__12(t)+(y__3(t)-y__2(t))*lambda__23(t)) = 0])

Parse:-ConvertTo1D, "invalid input %1", Typesetting:-mprintslash([diff(diff(z__2(t), t), t)+Typesetting:-mn("2")*((z__1(t)-z__2(t))*lambda__12(t)+(z__3(t)-z__2(t))*lambda__23(t)) = 0], [diff(diff(z__2(t), t), t)+Typesetting:-mn("2")*((z__1(t)-z__2(t))*lambda__12(t)+(z__3(t)-z__2(t))*lambda__23(t)) = 0])

Parse:-ConvertTo1D, "invalid input %1", Typesetting:-mprintslash([diff(diff(x__3(t), t), t)+Typesetting:-mn("2")*((x__2(t)-x__3(t))*lambda__23(t)+(-x__3(t)+x__1(t))*lambda__31(t)) = 0], [diff(diff(x__3(t), t), t)+Typesetting:-mn("2")*((x__2(t)-x__3(t))*lambda__23(t)+(-x__3(t)+x__1(t))*lambda__31(t)) = 0])

Parse:-ConvertTo1D, "invalid input %1", Typesetting:-mprintslash([diff(diff(y__3(t), t), t)+Typesetting:-mn("2")*((y__2(t)-y__3(t))*lambda__23(t)+(-y__3(t)+y__1(t))*lambda__31(t)) = 0], [diff(diff(y__3(t), t), t)+Typesetting:-mn("2")*((y__2(t)-y__3(t))*lambda__23(t)+(-y__3(t)+y__1(t))*lambda__31(t)) = 0])

Parse:-ConvertTo1D, "invalid input %1", Typesetting:-mprintslash([diff(diff(z__3(t), t), t)+Typesetting:-mn("2")*((z__2(t)-z__3(t))*lambda__23(t)+(z__1(t)-z__3(t))*lambda__31(t)) = 0], [diff(diff(z__3(t), t), t)+Typesetting:-mn("2")*((z__2(t)-z__3(t))*lambda__23(t)+(z__1(t)-z__3(t))*lambda__31(t)) = 0])

 

 

Download Format_odes_acc2b.mw

First 9 10 11 12 13 14 15 Last Page 11 of 595