Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@AndrewG You probably meant:
" so it essentially does what Rouben Rostamian has done without using the weights option" .

@AndrewG Even using weights=<1,1,10^15,1,1,1> appears to do fine.

You need 8 boundary conditions since your system has two dependent variables of highest order 4.
Also you didn't give us the values of p and L.

@mmcdara You must have had a concrete positive integer n, e.g. 20.
It doesn't matter because what you see is just ToInert working on f(x,y,n) evaluated!
But when n=20 (e.g.) you get
f(x,y,n);
with output sqrt(x)*sqrt(y) so you just see the result of
ToInert(sqrt(x)*sqrt(y));
 

Your system is huge you say, but couldn't you give us a (very) simplified version containing the apparently problematic procedure proc(f(x,y), a, b, c, etc...)  (also simplified if possible).
In particular it would help if we knew the relation of the independent variable 't' to f(x,y) and a, b, c, ... ?
And what is the output of the procedure?

@Rouben Rostamian  Very nice.
Your arguments even hold when the derivatives of theta(r) and sigma(r) are just bounded in an interval (0,delta), for some delta > 0.

Not to my knowledge. In fact you basically answered the question yourself by saying:
" Since there are no general methods for constructing Lyapunov functions ... ".
But in doing the algebra involved in the construction of a Lyapunov function Maple is clearly a great help.
 

@Ramakrishnan The solution I gave will apply to the whole session (or all sessions in case of Apply Globally).
Personally I never used equation labels, so I use Apply Globally.

@Markiyan Hirnyk We should be aware that complexplot3d plots the absolute value:
 

plot(abs(sqrt(1/x)*erf(sqrt(x))), x = -2 .. 2, discont,color=red,thickness=3): p1:=%:
plots:-complexplot3d(sqrt(1/z)*erf(sqrt(z)), z = -2-2*I .. 2+2*I, grid = [60, 60]): p2:=%:
tr:=plottools:-transform((x,y)->[x,0,y]):
plots:-display(tr(p1),p2);

@Elisha Do not assign to the dependent variables in an ode system.
So replace v(0):=0.4;  with v0:=0.4; (or whatever name you like).
Then use v(0)=v0 as one of the initial conditions.
Do similarly for the other dependent variables.
Of course you don't have to save the initial values in variables (like v0). Just use v(0)=0.4 if you like.
You haven't assigned to lambda:
 

indets({ode1, ode2, ode3, ode4, ode5},name);

Only {t} should show up here, but you get {lambda,t}.

@_Maxim_ It may be because in the first instance the assumption x<0 is made before ee is evaluated. If so the x in ee has no assumption on it. I recall Edgardo Cheb-Terrab saying something like that in another context.
Also using assume (1) before and (2)  after assigning to ee shows interesting differences:
 

restart;
assume(x<0);
ee:=sqrt(1/x)*erf(sqrt(x));
sqrt(1/x)*erf(sqrt(x));
ee;
restart;
ee:=sqrt(1/x)*erf(sqrt(x));
assume(x<0);
ee;
%;
simplify(%);
sqrt(1/x)*erf(sqrt(x));

 

@Markiyan Hirnyk Your first suggested "workaround" is no workaround, it is also wrong.
 

restart; 
ee := sqrt(1/x)*erf(sqrt(x));
MultiSeries:-series(ee, x = 0, 2) assuming x < 0; #WRONG
series(ee, x = 0, 2) assuming x < 0; #WRONG
series(ee,x=0,2);
% assuming x<0; #Correct
MultiSeries:-series(ee, x = 0, 2); #WRONG
MultiSeries:-series(sqrt(1/x)*erf(sqrt(x)), x = 0, 2); #WRONG
plot(ee,x=-2..2);

 

@Rouben Rostamian  The OP had to use RK4, so the method would be classical[rk4] together with a stepsize as in
 

dsol := dsolve(sys, numeric, method=classical[rkf4], stepsize=0.1);

I gave the following example in https://mapleprimes.com/questions/223689-Comparing-RK4-And-RK45-How-To-Solve

restart;
ode:=diff(y(x),x)=y(x);
h:=0.1: #Stepsize
resRK4:=dsolve({ode,y(0)=1},numeric,method=classical[rk4],stepsize=h, output=Array([seq(h*i,i=0..20)]));
##To see the numbers:
interface(rtablesize=infinity); # or just 21
resRK4;
## To plot
plots:-odeplot(resRK4,[x,y(x)],0..2);

The ode might as well have been of second order or a system of first order.

@mrbayat Notice that your boundary conditions depend on the products r(0)*D(r)(0) and r(0.01)*D(r)(0.01) only.
This means that we can use fsolve to get (as it turns out) 4 possible simplified boundary conditions:
 

odeL,bcs:=selectremove(has,dsys,diff);
ode:=op(odeL); #Removing list brackets
bcs0:=subs(D(r)(0)=rdr0/r(0),D(r)(0.01)=rdr1/r(0.01),bcs);
plot(lhs(bcs0[1]),rdr0=-1500..1500,-.01..0.01);
plot(lhs(bcs0[2]),rdr1=-1500..1500,-.01..0.01);
##
res01:=fsolve(bcs0[1],{rdr0});
res02:=fsolve(bcs0[1],{rdr0=300});
res11:=fsolve(bcs0[2],{rdr1});
res12:=fsolve(bcs0[2],{rdr1=-200});
##
## The 4 possible boundary conditions compatible with bcs are:
##
BCS1:=subs(rdr0=D(r)(0)*r(0),rdr1=D(r)(0.01)*r(0.01),res01 union res11);
BCS2:=subs(rdr0=D(r)(0)*r(0),rdr1=D(r)(0.01)*r(0.01),res01 union res12);
BCS3:=subs(rdr0=D(r)(0)*r(0),rdr1=D(r)(0.01)*r(0.01),res02 union res11);
BCS4:=subs(rdr0=D(r)(0)*r(0),rdr1=D(r)(0.01)*r(0.01),res02 union res12);
## Now try BCS1, ..., BCS4 one at a time
for cond in [BCS1,BCS2,BCS3,BCS4] do
  try
    dsolve({ode} union cond, numeric,  'output' = listprocedure,initmesh=1024)
  catch:
    printf(cat(StringTools:-FormatMessage(lastexception[2..-1]),"\n"));
  end try
end do;

As you will see there is no luck, but for different reasons.
## The imaginary values above from using BCS1 and BCS2 comes (I have reason to think)  from the approximate solution dsolve/numeric/bvp tries to find when not provided with one.
In the first case the approxsoln produced is "contaminated" by small imaginary parts:
[r(X2) = -1.175642159-9.605562427*10^(-10)*I+208.0660747*X2-(1.7*10^(-7)*I)*X2]
Removing these we have
AP1 := [r(X2) = -1.1756422+208.06607*X2]
Similarly for BCS2 we end up with
AP2 := [r(X2) = -3.2598136+75.038417*X2]
Unfortunately, it seems that using those won't get us a solution either.

@mrbayat I don't see any replacement of ln in your latest worksheet. Try:
 

indets(dsys,specfunc(ln));

 

First 51 52 53 54 55 56 57 Last Page 53 of 231