acer

32732 Reputation

29 Badges

20 years, 102 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Jean-Michel I don't know which version of Maple you're using, because your Question's header doesn't specify it in the Product field.

But if you are using Maple 2025 then you should be able to change which palettes appear in the left panel by following (GUI ribbon) instructions here.

If you are using Maple 2024 or earlier then you should be able to change which palettes appear in the left panel by using the menubar, ie.
   View -> Palettes -> Show Palette

@sand15 

That reference LinearFitting:-LinearLS gets to,
   Statistics:-Regression:-LinearFitting:-LinearLS
where Statistics:-Regression is the parent module with export LinearFit.

restart;
kernelopts(opaquemodules=false):
showstat(Statistics:-Regression:-LinearFitting:-LinearLS);

What makes it tricky to "view' is that DoFit and name LinearFit (assigned as an overload proc) appear to both be members of an unnamed module declared inside the definition of Statistics:-Regression. But you can still step into them in a debugger run on an example.

It might be that DoFit is just a "helper" that overloaded LinearFit uses to massage into a (consistent?) form for calling LinearFitting:-LinearLS.

@Jean-Michel A small circle is available in the Punctuation palette.

The Layout palette has an item for putting that above something else.

Enter that stacked template item from the Layout palette. Then move focus (Tab key, or mouse) to the top part of that entered item. And then replace that part with the small circle from the Punctuation palette.

Please stop entering separate postings which duplicate any underlying part of this.

If you have followups on this, due to different attempts, then you could add them here.

Regarding one followup file of yours,
    csgn-remove.mw
You could remove the evalc call (where you collect), optionally add assuming real to that line, and then not get those csgn calls you wanted to avoid. That might reveal a zero-in-the-denominator, after your l[1],l[2] substitutions -- possibly a mistake.

@janhardo Yes, I suspect most people who've written here are already quite aware of what you've shown.

The issue is more: why doesn't solve find&use the appropriate k value in this example, when allsolutions is not supplied.

The are even some other parts of Maple that will internally call solve (either under _EnvAllSolutions set to true, or with allsolutions=true), get back that periodic solution form, and then attempt to find a suitable "k" (or _Zn integer) value.

For example,

restart;
#trace(solve);
Student:-Calculus1:-Roots( sin(t)=-1, t=0..2*Pi );

               3 Pi
              [----]
                2

That's not big news. But one could hope that solve itself would also succeed here.

It's not immediately clear why some simple examples are problematic. Vote up for the bug report.

Some other such basic examples do succeed, without the allsolutions option.

However, (Maple 2024.2)

> [ solve({cos(t)=0, t>=Pi, t<=2*Pi}, t) ];
                                      []

> [ solve({sin(t)=-1, t>=0, t<=2*Pi}, t) ];
                                      []

> [ solve({cos(t)=1, t>=Pi, t<=2*Pi}, t) ];
                                      []

Things go better on t=-Pi..Pi, but again three basic ones get missed on t=-2*Pi..0.

[edit] Is that related? That is gets the basic examples sin|cos=-1|0|1 in -Pi..Pi but not those basic ones in -2Pi..-Pi and Pi..2Pi? I should check...

@dharr vote up.

The syntax for block Matrix construction is pretty flexible and easy to use. A few variants exist, and the Matrix constructor itself could also be used here.

restart;

with(LinearAlgebra):

id2 ,z2 := IdentityMatrix(2), ZeroMatrix(2):

 

Matrix( [ [id2, z2], [z2, -id2] ] )

Matrix(4, 4, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -1, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = -1})

< < id2 | z2 >, < z2 | -id2 > >

Matrix(4, 4, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -1, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = -1})

< id2, z2 ; z2, -id2 >

Matrix(4, 4, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -1, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = -1})

< < id2, z2 > | < z2, -id2 > >

Matrix(4, 4, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -1, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = -1})

 

Download M2.mw

@dharr My Maple 2024.2 does not exhibit that behavior.

Download forget_M20242.mw

Is the behavior new to M2025?

@nm I don't think that you really understand what's going on here, and I don't think that you understand the question in terms of what it actually means.

More importantly, you could very easily have branched this Question thread off of that older one or one of its Replies. That would insert cross-reference links automatically. Instead you didn't even add any link at all, which is unhelpful and counter-productive. The substance is clearly highly related (even if you maintain it's not the "same").

The earlier (followup) query boiled down to this: once the undesirable form has been created, how can one get the desired form? One cannot enter/get that same expression in the desired form unless one can change its stored & simpl'd structure. It's only because of that fact that I gave the other Asker an alternative of merely displaying something that looked like his desired form of the expression -- that might not be what he asked for, which was how to "write" it.

The easiest thing to do is just to make sure that the first call to CompleteSquare is like the following (for this! example):

restart;

eq := x^2 + y^2 + z^2 - 2*x + 8*y - 6*z - 30 = 0:

Student:-Precalculus:-CompleteSquare(eq, [z,y,x]);

(x-1)^2+(y+4)^2+(z-3)^2-56 = 0

Download comp_sq_01.mw

If you have unfortunately already created your result in the undesirable form then it is somewhat problematic to get it to exist in your desird form in ther same session. Consider:

restart;

eq := x^2 + y^2 + z^2 - 2*x + 8*y - 6*z - 30 = 0:

Student:-Precalculus:-CompleteSquare(eq, [x,y,z]);

(z-3)^2+(y+4)^2+(x-1)^2-56 = 0

Student:-Precalculus:-CompleteSquare(eq, [z,y,x]); # no good now

(z-3)^2+(y+4)^2+(x-1)^2-56 = 0

restart;

eq := x^2 + y^2 + z^2 - 2*x + 8*y - 6*z - 30 = 0:

Student:-Precalculus:-CompleteSquare(eq);

(z-3)^2+(y+4)^2+(x-1)^2-56 = 0

Student:-Precalculus:-CompleteSquare(eq, [z,y,x]); # no good now

(z-3)^2+(y+4)^2+(x-1)^2-56 = 0

Download comp_sq_02.mw

It is possible to turn targeted addends into function calls which can be sorted.

Here are a few ways, to get such pretty-printed,

restart;

expr := (z-3)^2 + (y+4)^2 + (x-1)^2 - 56  =  0;

(z-3)^2+(y+4)^2+(x-1)^2-56 = 0

 

L := [ (x-1)^2, (y+4)^2, (z-3)^2 ]:

 

F := u->InertForm:-Display(u,'inert'=false):
sort(subsindets(expr,`^`,F), order=plex(F~(L)[]));

Typesetting:-msup(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("x"), Typesetting:-mo("&minus;"), Typesetting:-mn("1"))), Typesetting:-mn("2"))+Typesetting:-msup(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("y"), Typesetting:-mo("&plus;"), Typesetting:-mn("4"))), Typesetting:-mn("2"))+Typesetting:-msup(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("z"), Typesetting:-mo("&minus;"), Typesetting:-mn("3"))), Typesetting:-mn("2"))-56 = 0

`print/G` := u->subsindets(u,name,convert,`local`):
sort(subsindets(expr,`^`,G), order=plex(G~(L)[]));

G((x-1)^2)+G((y+4)^2)+G((z-3)^2)-56 = 0

H := u -> subsindets(u,`^`,`%^`@op):
InertForm:-Display(sort(H(expr), order=plex(H~(L)[])), 'inert'=false);

`%^`(x-1, 2)+`%^`(y+4, 2)+`%^`(z-3, 2)-56 = 0; "_noterminate"


Download sort_fun.mw

There are other variants on some of those, depending on what one wants targeted or handled programagically.

That list L (of, say, addends of the lhs) could also be sorted programatically, using a grading scheme of one's choice. That could be done with, say, lexicographic aspects, taking into consideration the various names in the addends. Lists of terms can be sorted by arbitrary comparators.

@janhardo Please don't post duplicates of this as wholly separate Questions/Posts. Duplicate postings (especially with no context or differences or extra queries, etc) will get flagged as such and may be deleted.

restart;

kernelopts(version);

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

ode := diff(y(x),x) +cos(1/exp(2*x))*y(x) = sin(1/exp(x)):

IC := a*D(y)(x0)+ c*y(x0) = b*y0:

maple_sol:=dsolve([ode,IC],y(x));

y(x) = (Int(sin(exp(-_z1))*exp(-(1/2)*Ci(exp(-2*_z1))), _z1 = x0 .. x)+(sin(cosh(x0)-sinh(x0))*a-b*y0)/(cos(cosh(2*x0)-sinh(2*x0))*cosh((1/2)*Ci(cosh(2*x0)-sinh(2*x0)))*a+cos(cosh(2*x0)-sinh(2*x0))*sinh((1/2)*Ci(cosh(2*x0)-sinh(2*x0)))*a-c*cosh((1/2)*Ci(cosh(2*x0)-sinh(2*x0)))-c*sinh((1/2)*Ci(cosh(2*x0)-sinh(2*x0)))))*exp((1/2)*Ci(exp(-2*x)))

odetest(convert(maple_sol,exp), [ode, IC]);

[0, 0]

Download nm_ode_ex2.mw

@Rouben Rostamian

Naturally one can can test the sign (and I'm sure you did). And the OP did also mention a step by step way. (vote up)

For direct programming, years ago I'd usually reach for `radnormal` which is still usually pretty quick. But as machines got faster I found myself preferring `evala` for such situations where I needed to bolster what `simplify` did.

Also, there still seem to be more situations where both `radnormal` or `simplify` also need help from `rationalize` -- even if not the case here -- while `evala` more often does not.

How you handle this can depend on what you think it means to have a numeric solution of an IVP on the other side of the singularity from the IC information.

Btw, I told you just a few hours ago that DEplot can use dsolve,numeric . And that is also the case for your new example.

@nm The calls to DEtools:-DEplot in your Question above do call dsolve,numeric , for example, as,

   dsolve({diff(y(x), x) = x*(x^2+9)^(1/2), y(-4) = 0}, {y(x)},
               output = listprocedure, type = numeric, method = rkf45,
               range = -9.950000000 .. 9.950000000)

That kind of thing happens in `DEtools/DEplot/drawlines` .

You can see it as, 

  showstat(`DEtools/DEplot/drawlines`)

and notice how the result from dsolve gets used to produce the values for the lines/curves.

This might be getting off topic, though. What might be relevant to your original question is that going out-of-range (as far as the obsrange option is concerned) could be a slightly tricky consideration, and if floats are used then there could be a tolerance gotcha.

[edit] Note that the OP has augmented his Reply (immediately above this) with an additional example only after I add this Repy. That is unhelpful. It would be better to add it in a new Reply, so that the material would all appear in order and make more sense. Adding new examples to earlier queries/replies can make responses look like they've overlooked it.

Anyway, the smaller view that plot gets for this added followup example is due to the internal behaviour controlled by its smartview option. With smartview=false one gets a taller y range, and with default smartview=true one gets the shorter range (that slightly obscures the asymptote at the singularity, imo). Internally, it adds a VIEW substructure to restrict what parts of the computed data is rendered.

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