MaplePrimes Questions

Search Questions:

how to get the solution for this ode i am getting error 

in the pdf for the same parameter values getting plots but here it is showing error

santosh_sir_work.pdf

santosh_sir_work.mw

Not able to make an example, since it depends of code flow and not able to reproduce it in small code. I spend hrs trying to make one. It depends on how memory is arranged and this problem shows only when running my large program.

But I can show screen shots from a debugging session showing clearly the problem, and the solution I found.

Maple was giving this result, when calling simplify to simplify a matrix:

Notice what happend. There was a matrix [3/2,-1,-3/2,0],[0,0,0,0],[-2,2,2,0]] before that was simplfied.

Next iteration called simplify on modified version of the matrix, which is  [3/2,-1,-3/2,0],[0,0,0,0],[0,2/3,0,0]].  (called e in the above).

But simplify returned as result the old copy. Which is completely wrong.

It simplified  [3/2,-1,-3/2,0],[0,0,0,0],[0,2/3,0,0]]  to  [3/2,-1,-3/2,0],[0,0,0,0],[-2,2,2,0]]  !

Now see what happes when calling forget(simplify)

You see, now it simplfies it correctly. (there is actually nothing to simplify, so it returned back same matrix as expected, and no copy it had in memory).

So now I went over all my code, and everywhere it calls simplify, added 

     forget(simplify)

right after each call.

Problem fixed.

May be someone can shed a light on why this happens. Any information needed will try to provide. I can reproduce this each time but using the debugger.

restart;

ode:=diff(y(x),x) = 3*(y(x)*x)^(1/2); 
IC:=y(0)=2;
sol:=dsolve([ode,IC])

This is a report of a Maple_2015's bug, apparently fixed in more recent versions, but which may have persisted for a few versions beyond 2015.
I don't think it's necessary to fill out an RCS form.

All started with an error in my code which was balanced by a maple 2015 bug. So I didn't see any error until I sent my code to @C_R  who uses a newer Maple version.
More precisely, in my Maple 2015 code I defined a NxN matrix B, a vector A of length N, that I mistakenly defined as a vector column, and finally computed the quantity R = A . B . A+.
Of course Maple should have fire an error.

The bug is that Maple 2015 doesn't fire an error if A is a float vector and B a float matrix.

restart

kernelopts(version)

`Maple 2015.2, APPLE UNIVERSAL OSX, Dec 20 2015, Build ID 1097895`

(1)

A := Vector(2, symbol=a):
B := Matrix(2$2, symbol=b):
R := A.B.A^+

Error, (in LinearAlgebra:-Multiply) cannot multiply a column Vector and a Matrix

 

A := Vector(2, i -> i):
B := Matrix(2$2, (i, j) -> i+j):
R := A.B.A^+

Error, (in LinearAlgebra:-Multiply) cannot multiply a column Vector and a Matrix

 

A := evalf(Vector(2, i -> i)):
B := evalf(Matrix(2$2, (i, j) -> i+j)):
R := A.B.A^+

30.

(2)

R := A^+.B.A

30.

(3)
 

 

Download Maple_2015_Bug.mw

Dear all,
I am trying to build an animated activity to introduce the concept of a definite integral.
My goal is to animate the graph simultaneously with a three-column table displaying the values of the upper Riemann sum, the lower Riemann sum, and the definite integral.
Any ideas or suggestions on how to implement this?
Many thanks in advance.

Riemann_Anim_table.mw

This is a good example of how Maple result looks different depending on what calls to Maple were made before.

I can't upload worksheet so have to show code and screen shot. Compare the screen shot below. Maple 2025.2. Same exact input., In first example the polynomial terms display in different order compared to the second example, even though the same exact input is used.

Clearly the first example is because Maple remembered this polynomial in its remember table somewhere before due to earlier call, and did not want to make new copy since it is same polynomial?

But I do want to make new polynomial. The old copy/order this polynomial in Maple internal tables is getting in the way.

But do not know how to tell Maple to clear its cache so I get same display as in the second example. I know both answers is the same. But the issue is why it displays different.

How could I get same output from first example as in the second one? What do I need to clear? I tried forget(Student:-Precalculus:-CompleteSquare) but this had no effect. ALso tried forget(all); also forget(all,forgetpermanent = true,reinitialize=true); also forget(Student:-Precalculus:-CompleteSquare,subfunctions=true);

code

restart;

eq := x^2 + y^2 + z^2 - 2*x + 8*y - 6*z - 30 = 0:
eq:=Student:-Precalculus:-CompleteSquare(eq):
e1:=convert(indets(%,`^`),list):
e2:=zip((a,b)->a=b,e1,[X,Y,Z]):
e3:=sort(eval(eq,e2));
e4:=map(X->rhs(X)=lhs(X),e2);
eval(e3,e4);

restart;

e3 := X + Y + Z - 56 = 0;
e4 := [X = (x - 1)^2, Y = (y + 4)^2, Z = (z - 3)^2];
eval(e3,e4);

[moderator: duplicate of this earlier question]

i found the same as author found but is not give me zero when i replace in my pdes can anyone see the problem?

test.mw

When clicking on a pink error message I get this

Can someone explain what is going on? Quite unusual for me all this.

I do not have a server to white list. What can I do about it?

Is that Sucuri thing safe?

Is there a way to disable / turn of ai in Maple Learn. The question is relevant because it is not allowed for our students to use AI during their exams.

Regards and happy holiday

What is the current status of SupportTools? Is this something that still brings fixes in Maple before official release?

I am asking because there have not been an update to ST since June 23, 2025. Almost 6 months ago.

Should one still check for current version of SupportTools, is it still being updated or not? If not, then what does SupportTools package actualy do or contain if it is no longer needed/used? 

This is all fussy for me, and some clarification for users will be good to better understand the role of this package.

odetest does not want to verify this maple solution against the IC.  Anyone could find why or a trick to get [0,0] from odetest?

Can not upload worksheet due to firewall at Mapleprime issue. Here the code and screen shot.

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));
the_residue:=odetest(maple_sol,[ode,IC]);

#not zero, also simplify did not give zero

Hi everyone,

I'm trying to simplify

sqrt(sqrt(12)/(9 + sqrt(108)))

into

1-sqrt(3)/3

using Maple. Could someone please show me the Maple commands or step-by-step procedure that would do the simplification for me?

Thanks in advance for your help!

using regular expression in Maple is little annoying, because one has to escape \ in the regx string itself, which makes it more complicated compared to other languages. For example

StringTools:-RegMatch("^\[.*\]$","[A]")

gives false. But

StringTools:-RegMatch("^\\[.*\\]$","[A]")

gives true.

Other languages have special function to generate the regx itself, which does not require escaping the \ when writing the regx Which makes it easier to see the regx (escaping is done under the cover). like this

Since all places and web sites that show examples of regx., do not have to escape \ before using, it will be good if Maple adds such special new function to StringTools to generate regx like the above so users do not have to remember to escape \.   

It is hard enough to use regx without having to also remember to escape things.

I could not find such a function in Maple. Does one exist?

Maple 2025.2

I use plot(sol,...) to plot solution of ode. I do not give x or y ranges and let Maple figure the best values. Then use the command 

T:=rhs~(indets(p, identical("originalview")=anything))[];    

To extract the x and y ranges used and then use these in the command DEtools:-DEplot(....)

The plot() command shows the solution plot fully (in this example below, the left and right sides).

But the  DEtools:-DEplot(....) only shows part of the solution on top of the slope field arrows.  Even though the same x and y ranges is used.

I found that if I increase the y range for the DEtools:-DEplot(....) by a little bit, now the full solution shows, which is same as plot command generated.

Since I am doing all this in code, without looking, I am first plotting the solution using plot() and then use the ranges generated for DEtools:-DEplot(....).

If I do not use the y range in DEtools:-DEplot(....) but only use the x range, sometimes it works and sometimes Maple gives warnings. (depending on the solution). So I am  back to using the ranges generated by plot() command to be safe.

Here is an example to show this problem

ode:=diff(y(x),x) = x*(x^2+9)^(1/2);
IC:=y(-4) = 0;
sol:=dsolve([ode,IC]);
p:=plot(rhs(sol),'axes'='boxed','labels'=[x,y(x)],'axis'=['gridlines'=['color'='lightblue']],'color' = 'red');

Now the x and y ranges used above is extraced

T:=rhs~(indets(p, identical("originalview")=anything))[];      
from_x := op(1,T[1]);
to_x   := op(2,T[1]);
from_y := op(1,T[2]);        
to_y   := op(2,T[2]);  

#gives

      T := [-9.94999999999999929 .. 9.94999999999999929, 
        -32.6629164062620561 .. 332.469298224442980]


                 from_x := -9.94999999999999929
                  to_x := 9.94999999999999929
                 from_y := -32.6629164062620561
                  to_y := 332.469298224442980

These are used in the DEplot

DEtools:-DEplot(ode,[y(x)],x=from_x..to_x,y=from_y ..to_y ,[IC],
                'dirfield'=[15,15],
                'labels'=[x,y(x)],
                'axes' = 'boxed',                
                'arrows'='smalltwo', #'curve', 
                'color' = 'blue',#color of arrows
                'linecolor'='red'#color of solution
                );

Notice how the solution (red line) is truncated.  It turns out in this case adding say 10% to the y range, it now shows the solution like this

DEtools:-DEplot(ode,[y(x)],x=from_x..to_x,y=from_y-(0.1*abs(from_y)) ..to_y ,[IC],
                'dirfield'=[15,15],
                'labels'=[x,y(x)],
                'axes' = 'boxed',                
                'arrows'='smalltwo', #'curve', 
                'color' = 'blue',#color of arrows
                'linecolor'='red'#color of solution
                );

But I do not know if this trick will work for each example. 

As I said, I can not give the y range to DEplot, then in this example, it will now show the full solution. But I have examples where this can cause warnings.

The question is, why giving same y range used by plot to DEplot cause the solution (red line) to truncate? Why one has to increase the y range to make it show the full solution?

Is there a better method that the above to make DEplot show full solution same as plot() does? 

Maple 2025.2

ps. I just tried upload the worksheet and now it works! it looks like mapleprimes web site is fixed.
 

interface(version);

`Standard Worksheet Interface, Maple 2025.2, Windows 10, November 11 2025 Build ID 1971053`

ode:=diff(y(x),x) = x*(x^2+9)^(1/2);
IC:=y(-4) = 0;

diff(y(x), x) = x*(x^2+9)^(1/2)

y(-4) = 0

sol:=dsolve([ode,IC]);

y(x) = (1/3)*(x^2+9)^(3/2)-125/3

p:=plot(rhs(sol),'axes'='boxed','labels'=[x,y(x)],'axis'=['gridlines'=['color'='lightblue']],'color' = 'red');

 

T:=rhs~(indets(p, identical("originalview")=anything))[];      
from_x := op(1,T[1]);
to_x   := op(2,T[1]);
from_y := op(1,T[2]);        
to_y   := op(2,T[2]);  

[-9.94999999999999929 .. 9.94999999999999929, -32.6629164062620561 .. 332.469298224442980]

-9.94999999999999929

9.94999999999999929

-32.6629164062620561

332.469298224442980

DEtools:-DEplot(ode,[y(x)],x=from_x..to_x,y=from_y ..to_y ,[IC],
                'dirfield'=[15,15],
                'labels'=[x,y(x)],
                'axes' = 'boxed',                
                'arrows'='smalltwo', #'curve',
                'color' = 'blue',#color of arrows
                'linecolor'='red'#color of solution
                );

DEtools:-DEplot(ode,[y(x)],x=from_x..to_x,y=from_y-(0.1*abs(from_y)) ..to_y ,[IC],
                'dirfield'=[15,15],
                'labels'=[x,y(x)],
                'axes' = 'boxed',                
                'arrows'='smalltwo', #'curve',
                'color' = 'blue',#color of arrows
                'linecolor'='red'#color of solution
                );

 


 

Download example_phase_plot.mw

How to explain this strange behavior?   odetest(sol,ode) does not give zero. But odetest(sol,[ode,IC]) gives [0,0]

Same solution and same ode. Why adding IC, now odetest says solution verifies the ode, but without adding IC, it does not give zero right away. I know I can simplify the result to zero. But the point is that it should have given zero right away, because that is what it did when adding IC.

Should it not have given zero in first case also?

Can't upload worksheet due to security. Here is code and screen shot

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;
sol:=y(x) = ((-cos(exp(-2*x0))*a + c)*Int(sin(exp(-tau))*exp(-1/2*Ci(exp(-2*tau))), tau = 0 .. x0) + Int(sin(exp(-tau))*exp(-1/2*Ci(exp(-2*tau))), tau = 0 .. x)*(cos(exp(-2*x0))*a - c) + exp(-1/2*Ci(exp(-2*x0)))*(a*sin(exp(-x0)) - b*y0))*exp(1/2*Ci(exp(-2*x)))/(cos(exp(-2*x0))*a - c);

odetest(sol,ode);

#not zero

#now

odetest(sol,[ode,IC]);

#gives [0,0]

 

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