Preben Alsholm

13010 Reputation

22 Badges

18 years, 183 days

MaplePrimes Activity

These are replies submitted by Preben Alsholm

@dearcia You must have an older Maple version.
Replace DEtools:-DEplot by DEtools[DEplot] and you should be OK.
If, however, your version is older than Maple 13 then elementwise application (using the tilde ~) is not available. You can work around that rather easily by using map.
Here is a version that I made for Maple 12 on the basis of my Maple 2021 version.
That made me realize how convenient the elementwise operation is. It came with Maple 13.
There are several changes as you will notice.
## This version also works in Maple 2021.


F0 := 0; zeta := .25; w := 1; Omega := 1; m := 1;

ode1 := diff(x(t), t) = y(t); ode2 := diff(y(t), t) = F0*cos(Omega*t)/m-2*zeta*w*y(t)-w^2*x(t);

res:=dsolve({ode1, ode2,x(0)=x0,y(0)=y0},numeric,parameters=[x0,y0]);

P:=proc(xy0::list,tR::range:=0..10) if not xy0::list(realcons) then return 'procname(_passed)' end if;
end proc;

#Test of P



L:=[[x(0) = 0, y(0) = 50], [x(0) = 9, y(0) = 25], [x(0) = 85, y(0) = 20], [x(0) = .25, y(0) = .5], [x(0) = 7, y(0) = 5]];


opts:=zip(`=`,[color$5],[red, green, black, navy, maroon]),[(thickness=3)$5],zip(`=`,[linestyle$5],[dash, dashdot, dot, longdash, spacedash]);


p0:=DEtools[DEplot]([ode1, ode2], [x(t), y(t)], t = 0 .. 1, x = -100 .. 100, y = -100 .. 100,
 [[x(0) = 0, y(0) = 0]],arrows = medium,color=green):







@tomleslie OK, I misread the result from A3 as having a minus Float(infinity).

But my real mistake was to use a wrong ordering of the arguments of f3.
I should have considered

W1:=eval(W,[m,s,t,w]=~[1, 3, -2, -1]);

instead of

W1:=eval(W,[s,t,w,m]=~[1, 3, -2, -1]);

which gives no problems.
The plot of the correct W1 shows a clear indication of a singularity at x = 1/3

singular(W1,0..1); # {x = 0}, {x = 1/3}, {x = 1}
evalf(Int(Re(W1),x=0..1/3)); # -0.002885966034
evalf(Int(Re(W1),x=1/3..1)); # Problems


@tomleslie Obviously the real value is wrong since it must be larger than -2 if the following plots can be believed:



@tomleslie laurent only exists as numapprox:-laurent and as such you can see that it relies entirely on the builtin procedure series.


'laurent' is also a type:


@pazduha Your k can be written simpler:

k2:=piecewise(t < t1, kmax, t < 2*t1 + sqrt(2)*t1, -kmax, t < 3*t1 + 2*sqrt(2)*t1, kmax, t < 4*t1 + 2*sqrt(2)*t1, -kmax, 0);

piecewise works this way: If the first condition is satisfied then you get the value given in the second argument no matter what the other conditions are.
If the first condition is not satisfied, then the next condition is considered: If true then the value following that condition is returned, if not then on to the third condition etc.
Since your times t1, 2*t1 + sqrt(2)*t1, 3*t1 + 2*sqrt(2)*t1, 4*t1 + 2*sqrt(2)*t1 are increasing (when t1 >0) then the "And" you are using is unnecessary.
Finally if the last condition (here  t < 4*t1 + 2*sqrt(2)*t1) is not satisfied, you don't need an extra condition together with a value. Just give the value (here 0). You can if that value is actually 0 leave it out; it will be assumed to be zero.

@Muhammad Usman
(1) Your triple loop begins with m = n = k = 0. thus exp(k*eta[3] + m*eta[1] + n*eta[2]) = 1.
     this explains the error.
(2) The first argument to coeff is supposed to be a polynomial in a variable or expression (your case).
     Your Eq1 is a fraction: try numer(Eq1) and denom(Eq1).
     So Eq1 is not a polynomial in exp(k*eta[3] + m*eta[1] + n*eta[2]) for any m,n,k with m+n+k>0.

You should let us know what you are actually looking for.

Eq2 is not defined in that worksheet.

@rcorless Actually odetest also works:

odetest(y(t)=theta,diff(y(t),t,t)+omega^2*sin(y(t))=0);  # 0

where theta is defined as in your worksheet.

@rcorless I managed to get zero by treating the two terms in the ode differently:

k := sin(alpha/2);
theta := 2*arcsin(k*JacobiSN(omega*t, k));
t2:=simplify(diff(theta, t, t));
simplify(t1+t2);  # 0


@Muhammad Usman XJTU Since you say that you are new to Maple and have little knowledge of it, you probably shouldn't have just taken over the code written by somebody else for another ode.
Your ode as presented in Maple code is first order, so as pointed out by Tom Leslie and Rouben Rostamian you are only allowed one condition and shooting doesn't make any sense.
Rouben suggests that you present your problem in words and not in Maple code.
I think you should do that. Is your intended ode actually the one we see?

You don't seem to be defining the function PHIb anywhere. What is it?

Perhaps needless to say, but the user needs kernelopts(floatPi=true) as the code is written. That setting is the default.
I have chosen not to use it though,so I just replace 2.*Pi by twoPi, where twoPi is
local twoPi:=evalf(2*Pi).

@vv My guess is that he mistakenly thinks that the expression depends on the ratio L/z only.
That is not correct, which I guess is your reason for wondering.

A simple counterexample is given here:

ex := L/(z*sqrt(z^2 + L^2));
eval(ex,{L=1,z=1}); # L/z = 1
simplify(eval(ex,{L=2,z=2})); # L/z =1
## Those are not equal
simplify(eval(ex,L=LDZ*z)) assuming z>0; # LDZ=L/z


@Thomas Richard I quite agree! But in a moment of I don't know I did this:


and we see that the last two lines confirm the solve result which is

{x1 = 0, x2 = -efe/cosh(y1*l/r1)}

Thus we really need to see that worksheet!

First 7 8 9 10 11 12 13 Last Page 9 of 218