nm

11353 Reputation

20 Badges

13 years, 12 days

MaplePrimes Activity


These are questions asked by nm

After I switched to using arrows = curve in the call to DEtools:-DEplot I found errors in some calls. 

Is there a workaround other than not using this option? As phase plot looks like better with this option. For now, I will remove this option.

Here is an example

restart;

ode:=diff(y(x),x)-1/(-x^2+1)^(1/2) = 0;
x_range:=-0.99 .. 0.99;
DEtools:-DEplot(ode,y(x),x =x_range,y = -1.6 .. 1.6,[y(0) = 0],arrows = 'curve')

Error, (in DEtools/DEplot/direction) cannot assign a complex value to a hardware float Array

But this works

restart;

ode:=diff(y(x),x)-1/(-x^2+1)^(1/2) = 0;
x_range:=-0.99 .. 0.99;
DEtools:-DEplot(ode,y(x),x =x_range,y = -1.6 .. 1.6,[y(0) = 0])

I will report this to Maplesoft as it looks like a bug to me. 

May be someone can find a workaround so I can use arrows = curve?

Maple 2023.2 on windows 10

``

restart;

292176

ode:=diff(y(x),x)-1/(-x^2+1)^(1/2) = 0;
x_range:=-0.99 .. 0.99;
DEtools:-DEplot(ode,y(x),x =x_range,y = -1.6 .. 1.6,[y(0) = 0],arrows = 'curve')

diff(y(x), x)-1/(-x^2+1)^(1/2) = 0

-.99 .. .99

Error, (in DEtools/DEplot/direction) cannot assign a complex value to a hardware float Array

restart;

292176

ode:=diff(y(x),x)-1/(-x^2+1)^(1/2) = 0;
x_range:=-0.99 .. 0.99;
DEtools:-DEplot(ode,y(x),x =x_range,y = -1.6 .. 1.6,[y(0) = 0])

diff(y(x), x)-1/(-x^2+1)^(1/2) = 0

-.99 .. .99

 

Download detools_deplot_arrows_curve_problem_NOV_10_2023.mw

Update FEB 18, 2025

FYI, This is another example of DEplot failing. This time when using arrows=comet.

I hope Maplesoft can fix these problems in Maple 2025.


 

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1843 and is the same as the version installed in this computer, created 2025, January 25, 22:5 hours Pacific Time.`

 

ode:=diff(y(x),x) = y(x)/x-2/x*sin(3*y(x)/x)^(1/2);

diff(y(x), x) = y(x)/x-2*sin(3*y(x)/x)^(1/2)/x

DEtools:-DEplot( ode, y(x), x=-5..5,y=-5..5);

 

DEtools:-DEplot( ode, y(x), x=-5..5,y=-5..5,'arrows'='comet');

Error, (in DEtools/DEplot/direction) cannot assign a complex value to a hardware float Array

DEtools:-DEplot( ode, y(x), x=-5..5,y=-5..5,'arrows'='comet',arrowsize =  magnitude);

Error, (in DEtools/DEplot/direction) cannot assign a complex value to a hardware float Array

 


 

Download comet_gives_error.mw

 

Given a system of 2 first order ode's which are autonomous (i.e. the RHS does not explicitly depend on time), one can make phase plot in Maple using DEtools:-DEplot

I am trying to get my Maple output to look like I get with Mathematica. I am getting close, but there are two issues. First, here is what I get in Maple

restart;

ode1:=diff(x(t),t)=2*x(t)*y(t);
ode2:=diff(y(t),t)=1-x(t)^2-y(t)^2;

DEtools:-DEplot([ode1,ode2],[x(t),y(t)],
                           t=0..1,x = -4..4, y = -4..4,arrows=curve,linecolor=red,
                           numpoints =300,arrowsize='magnitude',scene=[x(t),y(t)]);

Here is the same thing in Mathematica

ode1=x'[t]==2*x[t]*y[t]
ode1=y'[t]==1-x[t]^2-y[t]^2

StreamPlot[{2 x*y,1-x^2-y^2},{x,-4,4},{y,-4,4},
    FrameLabel->{{y[t],None},{x[t],None}},BaseStyle->16,ImagePadding->{{50,10},{50,0}}]

Is it possible to get the arrows to be stream lines similar to how they show up? Also, the axes labels in Maple are internal and hard to see. Is it possible to have on the outside like above so they are easier to see?

On a side question: Should one use DEtools:-DEplot or DEtools:-phaseportrait I could never understand when to use one vs. the other.

Maple 2023.2 on windows

May be someone could help me understand the logic that Maple goes through in this example.

restart;
ode:=diff(y(x), x) = sqrt(y(x))*sin(x);
dsolve([ode,y(0)=0]);
dsolve([ode,y(0)=0],'implicit');

For first dsolve it returns y(x)=0 and for the second it returns what is expected which is sqrt(y(x)) + cos(x)/2 - 1/2 = 0

Why this difference in result? Just trying to understand the logic behaind it. 

Maple 2023.1 on windows 10

``

restart;

ode:=diff(y(x), x) = sqrt(y(x))*sin(x);
dsolve([ode,y(0)=0]);
dsolve([ode,y(0)=0],'implicit');

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

y(x) = 0

y(x)^(1/2)+(1/2)*cos(x)-1/2 = 0

 

Download why_dsolve.mw

This setup works, where B extends A, then B method access local variable in A directly, since it now becomes part of the object B itself

restart;
                            
module A()
  option object;
  local s::string:="";
end module;

module B()
   option object(A);
   export foo::static:=proc(_self,$)
      _self:-s := cat(_self:-s,"something");
      print(_self:-s);
   end proc:
end module;

o:=Object(B);
o:-foo()

Gives "something"

Now, I changed B, by adding an anonymous local proc() and did the same exact thing as above, which is to access s.

Now Maple complains that B does not export s

restart;

module A()
  option object;
  local s::string:="";
end module;

module B()
   option object(A);
   export foo::static:=proc(_self,$)
        proc()
            _self:-s:=cat(_self:-s,"somethig");
            print(_self:-s);
        end proc();
   end proc:
end module;

o:=Object(B);
o:-foo()

It gives

Error, (in anonymous procedure called from anonymous procedure) module `B` does not export `s`

Could someone help me understand why this happens? How it works in the first example but not in the second?  I do not see why it would make difference. isn't anonymous procedure part of the class that is being extended?

Update

It is worst than I thought. Even named local proc, inside method now fail. Here is an example

restart;

module A()
  option object;
  local s::string:="";
end module;

module B()
   option object(A);
   export foo::static:=proc(_self,$)
        local z::string:="something";
        local my_inner_proc:=proc()
            _self:-s:=cat(_self:-s,z);
        end proc();
        my_inner_proc();
   end proc:
end module;

o:=Object(B);
o:-foo()

Gives 

Error, (in anonymous procedure called from anonymous procedure) module `B` does not export `s`
I was using code which worked before, but now after extending the class, I am finding all these problems.

Is this documented something that local proc()'s inside method do not work as expected when extending classes in Maple OOP? It means now I have to move these local proc() to the outside of its current enclosing proc() to make Maple happy.  I just do not understand why this limitation.

Maple 2023.1 on Windows 10

integral of sqrt(sin(x)) is known to be as given in few place such as in here and other places.

Maple gives a result which is much more complicated (but also in terms of EllipticE special function). 

Could someone find a way to simplify it to the above answer and also to the same answer given by Mathematica?

int(sqrt(sin(x)),x)

Compare to 

Maple's result seems to be correct, as I plotted it and compared the smaller known resut. But I was not able to simplify it to obtain the smaller antiderivative.

Any tricks to do that?

First 44 45 46 47 48 49 50 Last Page 46 of 199