nm

11693 Reputation

20 Badges

13 years, 155 days

MaplePrimes Activity


These are questions asked by nm

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]

 

Could someone please check if these are new in Maple 2025.2? I am on windows 10.

eqs:=[_C1+_C2 = 0, _C1*exp(3^(1/2)*((cos(1/6*Pi*3^(1/2))-1)*(cos(1/6*Pi*3^(1/2))+1))^(1/2)/(cos(1/6*Pi*3^(1/2))-1)^(1/2)/(cos(1/6*Pi*3^(1/2))+1)^(1/2)*ln(cos(1/6*Pi*3^(1/2))+(cos(1/6*Pi*3^(1/2))^2-1)^(1/2)))+_C2*exp(-3^(1/2)*((cos(1/6*Pi*3^(1/2))-1)*(cos(1/6*Pi*3^(1/2))+1))^(1/2)/(cos(1/6*Pi*3^(1/2))-1)^(1/2)/(cos(1/6*Pi*3^(1/2))+1)^(1/2)*ln(cos(1/6*Pi*3^(1/2))+(cos(1/6*Pi*3^(1/2))^2-1)^(1/2))) = 4];
c:=[_C1, _C2];
solve(eqs,c);

#Error, (in convert/real_rat) too many levels of recursion

And

eqs:= [3^(1/4*3^(1/2))*exp(3/4*Pi)*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2*exp(-1/6*Pi*3^(1/2))]:
c:=[_C1, _C2];

solve(eqs,c)

Trace shows they are coming from Algebraic: best unknown/equation

Cannot upload worksheet due to security. Here is screen shot

Could someone please check if this error happens in earlier versions of Maple? I have only Maple 2025.2 on Windows.

Unable to upload worksheet due to new security. Here is the code to run


restart;
integrand:=-3*(Pi-2*arcsin(tau))*(tau+1)^(1/2)*(tau+(tau^2-1)^(1/2))^(2*(tau^2-1)^(1/2)/(tau-1)^(1/2)/(tau+1)^(1/2))*(tau-1)^(1/2)*(-16/3*tau^2+Pi-2*arcsin(tau)+8/3)/(4*tau^2-4);

int(integrand,tau)

The error is 

Update dec 12, 2025

Here is another int() error. In Maple 2025.2.  It comes from

RationalTrigOnly: case ratpoly*trig(arg)
Error, (in unknown) too many levels of recursion

 

I still can not upload worksheet. So here is the code followed by screen shot

 

integrand:=-(tau+(tau^2-1)^(1/2))^(1/2*(tau^2-1)^(1/2)/(tau-1)^(1/2)/(tau+1)^(1/2))*(64*tau^4+Pi^2-4*Pi*arcsin(tau)+4*arcsin(tau)^2-64*tau^2+8)*(tau-1)^(1/2)*(tau+1)^(1/2)/(16*tau^2-16);

int(integrand,tau);
....
TrigOnly: case of integrand containing trigs
RationalTrigOnly: case ratpoly*trig(arg)
Error, (in unknown) too many levels of recursion


 

I did not make new question as this seems to be same source of error but can not be sure now.

Second update DEC 12, 2025

Here is 3rd one. Seems also the same. comes from RationalTrigOnly: case ratpoly*trig(arg)

integrand:=-(tau + sqrt(tau^2 - 1))^(2*sqrt(tau^2 - 1)/(sqrt(tau - 1)*sqrt(tau + 1)))*(Pi - 2*arcsin(tau))*(12*tau^2 + Pi - 2*arcsin(tau) - 6)*sqrt(tau - 1)*sqrt(tau + 1)/(16*tau^2 - 16);

int(integrand,tau);

Why one is no longer able to upload worksheet here showing a problem? I found an internal error in int() but can't upload worksheet.

When I click on the green arrow and select my worksheet, I get this message

What is going on? I am on windows 10 and I tried 2 different browsers. So the problem is on the Mapleprimes site.

Can anyone else try to upload a worksheet to test to see if they get same problem?

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