Preben Alsholm

13471 Reputation

22 Badges

20 years, 251 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@jennierubyjane Which values do you want to print out?
You said:  " ... dont know how to print out the values tsk tsk"
What does "tsk tsk" refer to?

From your do loop in the code I see that the procedures for phi(eta) and -diff(phi(eta),eta) are saved.
Are those numerical procedures the ones you call values?

While waiting for your answer to my question I shall allow myself to continue mmcdara's worksheet
ODEprobz_mmcdara.mw here:

 

L := [0.7e-1, .2, .7, 2, 7, 20, 70];
for k from 1 to numelems(L) do
   res[k]:=dsolve(
                  eval({BC1, BC2, BC3, DE1, DE2, DE3}, [Pr = L[k], Nb=1, Nt=1, Le=1, Bi=1]), 
                  numeric,output=listprocedure
                 );
   
end do:
display(Array([
               display(seq(odeplot(res[k],[eta,phi(eta)]),k=1..numelems(L))),          
               display(seq(odeplot(res[k],[eta,-diff(phi(eta),eta)]),k=1..numelems(L)))
             ]));

I deleted your recent repost of this question. It appears that you already received an answer.
If you have further questions then continue this thread. Don't start another one.

We may use that the system has a conserved quantity.
Also it's worth noticing that the system can de solved exactly. We shall not use that solution though.

## sys is defined above in my answer.
dsolve({sys});
ode:=eval(diff(sys[1],xi),sys[2]);
EQ1:=map(int,ode*diff(u(xi),xi),xi)+(0=C);
isolate(EQ1,C);
EQ2:=subs(sys[1],u(xi)=u,z(xi)=z,%);
params1:={kao=0.1,Kga=.2,beta=1};
plots:-display(seq(plots:-implicitplot(eval(EQ2,params1 union {C=k/200}),u=-1..1,z=-1..1),k=-2..2));
params2:={kao=-0.1,Kga=-.2,beta=1};
plots:-display(seq(plots:-implicitplot(eval(EQ2,params2 union {C=k/10}),u=-1..1,z=-1..1),k=-2..2));
rhs(EQ2);
plots:-contourplot(eval(rhs(EQ2),params1),u=-1..1,z=-1..1,contours=[seq(k/10,k=-2..2)],grid=[50,50]);
plots:-contourplot(eval(rhs(EQ2),params2),u=-1..1,z=-1..1,contours=[seq(k/10,k=-2..2)],grid=[50,50]);

The plots from contourplot are not as good as the ones from implicitplot for C = 0 and (u,z) near (0,0).

MaplePrimes (right now anyway) seems to have a serious problem bringing the (first) implicitplot when I just copy and paste.
So I saved the plot as a png file:


Here is the second implicitplot:

@SuganyaG I knew that my worksheet in my answer above had lots of details that needed explanation.

Here is an attempt:
MaplePrimes2021-11-25_perturbation_2.mw

Comment: I also tried setting n:=5 instead of n:=4.
This works too, but plot gets a problem for some reason, probably because of the huge size of the input.
A simple way out is to set the environmental variable UseHardwareFloats to false, like this
UseHardwareFloats:=false;
Its default value is 'deduced'.

@Carl Love You are quite right. Thank you.

@Carl Love Thank you Carl for pointing out my mistake. I will revise my answer accordingly. This also means that my statement about vectors will be removed.

@nm You are right. Something strange is going on.
If in a new worksheet I start with my integrand2 and then do int(integrand2,x) I get an error.
If I then execute simplify(integrand2) and then int(integrand2,x) I get the result.
And if again in a fresh worksheet I start with your original integrand, then do simplify(integrand) then finally
int(integrand,x) then I get a result. Notice that I'm not using the simplified version:

restart;
integrand:=(((-3*x^2-18*x-27)*exp(2)^2+(30*x^3+330*x^2+1170*x+1350)*exp(2)-75*x^4-1200*x^3-7050*x^2-18000*x-16875)*ln(x)+(12*x^2+54*x+81)*exp(2)^2+(-120*x^3-1106*x^2-3510*x-4050)*exp(2)+225*x^4+3560*x^3+20990*x^2+54000*x+50625)/((3*x^4+18*x^3+27*x^2)*exp(2)^2+(-30*x^5-330*x^4-1170*x^3-1350*x^2)*exp(2)+75*x^6+1200*x^5+7050*x^4+18000*x^3+16875*x^2);
simplify(integrand);
int(integrand,x);

I get the errors also from your Calendar version though.
Using restart doesn't remove everything (see ?restart).
So in testing this we must start with a fresh worksheet (a new engine).

 

@ You are wrong. The general term tends to 0:
 

limit(1/k^(2-cos(1/k)),k=infinity); # 0
## Obvious also since the term is positive and satisfies:
1/k^(2-cos(1/k))<= 1/k; 

 

@Kitonum If the result isn't obvious it may be a good idea to see how Maple finds that:
 

restart;
infolevel[int]:=5;
int(1/k^(2-cos(1/k)), k=1..infinity);
# So try this
asympt(1/k^(2-cos(1/k)),k);

So the result infinity appears to be OK.

@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.
MaplePrimes21-10-22_ode_phaseplot_VersionM12.mw
 

restart;

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;
   res(parameters=xy0);
   plots:-odeplot(res,[x(t),y(t)],tR,_rest)
end proc;

#Test of P

P([0,50],linestyle=dash,color=blue,thickness=3);

P([0,50],-5..15,linestyle=dash,color=blue,thickness=3);

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]];

L1:=map(x->map(rhs,x),L);

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

nopts:=nops([opts]);

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):

plots[display](seq(P(L1[i],seq(opts[j,i],j=1..nopts)),i=1..5),p0);

plots[display](seq(P(L1[i],-0.9..10,seq(opts[j,i],j=1..nopts)),i=1..5),p0);

 


 

Download MaplePrimes21-10-22_ode_phaseplot_VersionM12.mw

 

@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]);
plot(Re(W1),x=0..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:
 

int(-1/(1-x)^(1/2),x=0..1);
plot([Re(eval(W,{s=1,t=3,w=-2,m=-1})),-1/(1-x)^(1/2)],x=0..1);

 

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

showstat(numapprox:-laurent);

'laurent' is also a type:

showstat(`type/laurent`);

@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.

First 13 14 15 16 17 18 19 Last Page 15 of 225