Items tagged with dsolve dsolve Tagged Items Feed

Hi guys,

I'm studying a system of six differential equations. Given the fact that the system cannot be solved symbolically, I've tried the numeric procedure, and it works. I proceeded like this :

soleqd:=dsolve(sysd2,numeric,var);

then i checked if maple could calculate the solutions for given values of t. It works for t=0, t=0.5, t=1,t=2,...,t=5. The solutions are all real numbers.

But when i try to draw a graphic representation of the solutions, it doesn't work. I do :

ff1:=t->subs(soleqd(t),u[1](t));
gg1:=t->subs(soleqd(t),nu[1](t));

Then :

plot(['ff1(t)','gg1(t)',t=0..5],u[1]=0...1,nu[1]=0...1);

(The square brackets are indices)

Now maple answers that it is "unable to evaluate the function to numeric values in the region". I went to the help page but no solution seems to work. I can't figure it out by myself. Does anybody notice something wrong with my code ?

Thank you for your time,

Best regards,

Louis

Dear Colleges

I have a problem with the following code. As you can see, procedure Q1 converges but I couldn't get the resutls from Q2.

I would be most grateful if you could help me on this problem.

 

Sincerely yours

Amir

 

restart;

Eq1:=diff(f(x),x$3)+diff(f(x),x$2)*f(x)+b^2*sqrt(2*reynolds)*diff(diff(f(x),x$2)^2*x^2,x$1);
Eq2:=diff(g(x),x$3)+diff(g(x),x$2)*g(x)+c*a^2*sqrt(2*reynolds)*diff(diff(g(x),x$2)^2*x,x$1);
eq1:=isolate(Eq1,diff(f(x),x,x,x));
eq2:=subs(g=f,isolate(Eq2,diff(g(x),x,x,x)));
EQ:=diff(f(x),x,x,x)=piecewise(x<c*0.1,rhs(eq1),rhs(eq2));
Eq11:=diff(theta(x),x$2)+pr*diff(theta(x),x$1)*f(x)+pr/prt*b^2*sqrt(2*reynolds)*diff(diff(f(x),x$2)*diff(theta(x),x$1)*x^2,x$1);
Eq22:=diff(g(x),x$2)+pr*diff(g(x),x$1)*f(x)+pr/prt*a^2*c*sqrt(2*reynolds)*diff(diff(f(x),x$2)*diff(g(x),x$1)*x^1,x$1);
eq11:=isolate(Eq11,diff(theta(x),x,x));
eq22:=subs(g=theta,isolate(Eq22,diff(g(x),x,x)));
EQT:=diff(theta(x),x,x)=piecewise(x<c*0.1,rhs(eq11),rhs(eq22));
EQT1a:=eval(EQT,EQ):
EQT2:=eval(EQT1a,{f(x)=G0(x),diff(f(x),x)=G1(x),diff(f(x),x,x)=G2(x)}):
bd:=c;
a:=0.13:
b:=0.41:
pr:=1;
prt:=0.86;
reynolds:=12734151.135786774055543653356602;     #10^6;   #1.125*10^8:

c:=88.419896050808975395120916434619:
;
Q:=proc(pp2) local res,F0,F1,F2;
print(pp2);
if not type(pp2,numeric) then return 'procname(_passed)' end if:
res:=dsolve({EQ,f(0)=0,D(f)(0)=0,(D@@2)(f)(0)=pp2},numeric,output=listprocedure);
F0,F1,F2:=op(subs(subs(res),[f(x),diff(f(x),x),diff(f(x),x,x)])):
F1(bd)-1;
end proc;
fsolve(Q(pp2)=0,pp2=(0..1002));
se:=%;
res2:=dsolve({EQ,f(0)=0,D(f)(0)=0,(D@@2)(f)(0)=se},numeric,output=listprocedure):
G0,G1,G2:=op(subs(subs(res2),[f(x),diff(f(x),x),diff(f(x),x,x)])):
plots:-odeplot(res2,[seq([x,diff(f(x),[x$i])],i=1..1)],0..c);



Q2:=proc(rr2) local solT,T0,T1;
print(rr2);
if not type(rr2,numeric) then return 'procname(_passed)' end if:
solT:=dsolve({EQT2,theta(0)=1,D(theta)(0)=-rr2},numeric,known=[G0,G1,G2],output=listprocedure):
T0,T1:=op(subs(subs(res),[theta(x),diff(theta(x),x)])):
T0(bd);
end proc;
fsolve(Q2(rr2)=0,rr2=(0..100));


shib:=%;
sol:=dsolve({EQT2,theta(0)=1,D(theta)(0)=-shib},numeric,known=[G0,G1,G2],output=listprocedure):
plots:-odeplot(sol,[x,theta(x)],0..c);
#fsolve(Q2(pp3)=0,pp3=-2..2):

Amir

What is the correct mode of using dsolve/numeric/compile with Grid package?

I've tried a lot of different, but only one turned out to be working is by using Grid:-Seq(dsolve..., i=1).

For example:

...

dsol := Grid:-Seq(dsolve(dsys, numeric, parameters = [bb, qq, prf0, `p&theta;f0`], compile = true, optimize = true, output = listprocedure, maxfun = 0), i = 1):

dsol3 := proc (tt) try dsol[3](tt) catch "cannot evaluate the solution further": tt = 0. end try end proc:

st := time[real]():

A := Array([Grid:-Seq([seq(op(2, [dsol[1](parameters = [b[i, j], q[i, j], pr[i, j], `p&theta;`[i, j]]), rhs(dsol3(-10^6))]), j = 1 .. sz[2])], i = 1 .. sz[1])]);

time[real]()-st;

example.mw

But this mode not stable and causing to this error very often:

Error, (in dsolve/numeric/SC/preproc) unable to post-link (rc=31), please try again, and if that fails check that your Windows SDK installation is up to date, and compatible with your Windows compiler

How I can fix this problem?


print(`output redirected...`); # input placeholder
   d ph                                                     
   ---- = (1 - yc) pc + yh prj + urd prd + ugd pgd - yc ph,
    dt                                                      

     d pc                        d pa               
     ---- = yc ph - (2 - yc) pc, ---- = pc ya - pf,
      dt                          dt                

     d prj                 d prd                     
     ----- = pa yrj + prj, ----- = pa yrd - prd urd,
      dt                    dt                       

     d pgd                     
     ----- = pa ygd - pgd ugd,
      dt                       

     d pf                                          
     ---- = (1 - ygd - yrj - yrd) pa + (1 - yh) prj
      dt                                           
ics := ph(0) = 1, pc(0) = 0, pa(0) = 0, prj(0) = 0, prd(0) = 0, pgd(0) = 0, pf(0) = 0;
print(`output redirected...`); # input placeholder
   ph(0) = 1, pc(0) = 0, pa(0) = 0, prj(0) = 0, prd(0) = 0,

     pgd(0) = 0, pf(0) = 0

 

i write this equations in maple

but i get this error

 

Error, (in dsolve) ambiguous input: the variables {pa, pc, pf, pgd, ph, prd, prj} and the functions {pa(0), pc(0), pf(0), pgd(0), ph(0), prd(0), prj(0)} cannot both appear in the system

can anyone help me?

 

 

Using with(Physics):

On an initial condition setting for using dsolve when I do D(theta)(0) it returns  0=0

I'll have to check tonight if it's a mistake on my part.  But perhaps that is supposed to happen.

Hi all,

Thanks for helping me to solve the problem below using Maple.

dsys := {(1-4*(diff(ln(v(z)), z)))*(diff(u(z), z))+((3/2)*z^{-1}-2*(3* z^{-1} *(diff(ln(v(z)), z))+2*(diff(ln(v(z)),z,z )))))*u(z) = 0, -z*(diff(v(z), z))-v(z)+v(z)^(1/2)*u(z) = 0, v(0) = 1, u(0) = 1, (D(v))(0) = 1/4, (D(u))(0) = 3/8}

When trying    sol := dsolve(dsys, numeric)

I got : Error, (in DEtools/convertsys) unable to convert to an explicit first-order system.

 

Note that the analytic solution for z<=0 is:

if z>-4   then  u(z)=(1+z/4)exp(z/8) and   v(z)=exp(z/4)

else u(z)=0  and v(z)= (-4/z)exp(-1)

Regards

I have data file with 6 columns:

X Y Z B1 B2 B3

i.e. 3 coordinates (with some step) and values of B-functions at that 3D point. How to make interpolation of these B-functions to have them in arbitrary (x,y,z) point?

Then I need to solve diff equations like this:

x''(s)+f(...)=0

f(...) depends on x,y,z,x',y',z' and B1,B2,B3. How to write this dsolve(...) construction when we have interpolations inside?

Thanks.

Hello! I'm really craving for a piece of advice from you pros.
For simplicity's sake let's start with this made-up system.

where

and

Here is solver options with pair of events to get idea about what I want.

Plot of solution



For my purposes it's essential to restrict variables m and D(fi1)(t), D(fi2)(t). While it's very convenient to use piecewise() operator in first case with m, I simply can't find working method for second.

I've tried various events for dsolve, but they trigger only once and I failed to provide continuous restriction on the derivatives in question.

That's what I need in the end:


If there's a way to obtain this result, please, don't make secrets of it :) Thank you in advance!

Dear all;

Thank you very much for helping me to understand this problem.

I need your help for this question, it's seem for correct but when I run the code there is no dispaly of the solution with this command  dsolve({ode,ics}) ;

 

ode:=x*diff(y(x),x)+y(x)=x*exp(-x^2);

ics:=y(0)=1;

dsolve(ode);

dsolve({ode,ics}) ;

Hye, have a good day everyone..

can anyone know why I got this error? :(second_grade.mw

Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system


Here I have attached the file. thank you in advance :)

Hello,

After solving ode I am looking only for the values >=1.5. For example at t=1, y(t)=3.8940.

How can I extract the values >= 1.5 from the solution to use it as data (t,y(t)) and save it ?

restart;
with(DEtools); with(plots);
eqn := diff(y(t), t) = -.25*y(t);

 init := y(0) = 5;

sol := dsolve({eqn, init}, {y(t)}, numeric, output = array([seq(i, i = 0 .. 50)]));
p[1] := plot(1.5, t = 0 .. 50, colour = black);

p[2] := odeplot(sol, [t, y(t)], t = 0 .. .50, colour = red);

display(p[1], p[2]);

 

Thanks

please help me a bout:


> u := am+bm*m0*x(t)+cm*n0*y(t);
> v := an+bn*m0*x(t)+cn*n0*y(t);
> eq1 := diff(x(t), t) = 2*A*(sinh(u)-x(t)*cosh(u));
> eq2 := diff(y(t), t) = 2*A*(sinh(v)-y(t)*cosh(v));
> init := x(0) = X, y(0) = Y;
> sol := dsolve({eq1, eq2, init}, {x(t), y(t)});
> param := A = 1/2, am = 0, bm = 1.2*exp(-4), cm = .5*exp(-5), m0 = 10000, an = 0, bn = -exp(-4), cn = 1.2*exp(-3), n0 = 1000;
> ;
> save u, v, param, " narm.sav";
Warning, unassigned variable `u` in save statement
Warning, unassigned variable `v` in save statement
Warning, unassigned variable `param` in save statement
> init := x(0) = 0, y(0) = 0.1e-1;
> eq1 := subs(param, eq1);
> eq2 := subs(param, eq2);
> sol := dsolve({eq1, eq2, init}, {x(t), y(t)}, numeric);
> with(plots);
> odeplot(sol, [x(t), y(t)], 0 .. 60, numpoints = 300, view = [-1 .. 1, -1 .. 1]);

Is it possible to use an option similar to range when using lsode method for dsolve? The ODEs I am trying to solve is stiff and will not work with the flag stiff=true or with method=rosenbrock unless i set Digits:=20. I want to avoid doing that as much as possible, since I believe wit will be very taxing, computationally. I have a very large systeom to solve. I found that method=lsode works with the default Digits=15. 

 

However I need to have the solutions in a given range stored for future access and manipulations. Using range gives me an error: 

Error, (in dsolve/numeric/an_args/lsode) lsode keyword was range, optional keyword must be one of 'ctrl', 'initial', 'itask', 'output', 'procedure', 'procvars', 'start', 'number', 'abserr', 'relerr', 'maxfun', 'minstep', 'maxstep', 'initstep', 'startinit', 'implicit', 'optimize', 'complex'

 

I cannot figure out how to use range or something similar with lsode. Anyone knows? 

Hi! I have to solve a very large system of ODEs for a set of functions that can be indexed with two integers, n and l, call them f[n,l](x), where n ranges from 1 to an order 1000 number and l ranges from 1 to an order 10 number. 

What is the best strategy in dsolve, keeping in mind I will only need to have quick access to the values of the first few such functions, say f[0,0](x) and f[0,1](x) for any given x in a given range. I dont need to store the rest, and trying to store all of them actually will give me a warning about length of output exceeds limit of 1000000. So, having maple output the result of dsolve in a procedural form seems to be what I want. However in doing so, for evey value of x i call the solving procedure maple will solve the system each time, thus taking a long time. 

 

My dilema is: to save storage space and memory I want to use dsolve output as procedures. To save time, when accessing the functions I need (only the first few in the large set of unknown functions that obey the ODE) for a given value of x, I would like maple to have those already stored instead of computing them with each invocation. So, what I need is a somehow split behavior of output. For some of my unknown functions to act as if i use range in dsolve, so that I have access at the values without further computation, and for the rest of the solutions (most of the unknown functions) just keep them in procedural form. How do I achieve this? 

 

Below is a schematic of my probem:

 

ODEs:={Set of about 10000 coupled ODEs for functions labeled f[n,l] n ranging from 1..1000 and l from 1..10}

 

dsolve(ODEs,numeric, output=???)#What options to put in dsolve such that I have quick access to f[0,0](x) and f[0,1](x) in a given range (say xmin=0.1 and xmax=10 for example) but not store the rest. 

 

 

Hello,

The idea: parameter "a" will have a new random value each 10 days.

The way I did it is working but it can get very long especially if I do it for a system of equations and for long time more than a year (365 days).

The code:

with(DEtools); with(plots);
n := 5;

for i to n do Ra[i] := RandomTools:-Generate(distribution(Uniform(0.1e-1, .5))); a[[i]] := Ra[i] end do;

b := 0.1e-2;

T := 10;

 eq := diff(L(t), t) = a*L(t)-b;

init[1] := L(0) = 100;
 sol[1] := dsolve({init[1], subs(a = a[[1]], eq)}, L(t), range = 0 .. T, numeric);


init[2] := L(T) = rhs(sol[1](T)[2]);

sol[2] := dsolve({init[2], subs(a = a[[2]], eq)}, L(t), range = T .. 2*T, numeric);

 

init[3] := L(2*T) = rhs(sol[2](2*T)[2]);
sol[3] := dsolve({init[3], subs(a = a[[3]], eq)}, L(t), range = 2*T .. 3*T, numeric);

p[1] := odeplot(sol[1], [t, L(t)], t = 0 .. T);

p[2] := odeplot(sol[2], [t, L(t)], t = T .. 2*T);

p[3] := odeplot(sol[3], [t, L(t)], t = 2*T .. 3*T);

p := display([p[1], p[2], p[3]]);
display(p);

 

Thank you

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