Items tagged with dsolve dsolve Tagged Items Feed

Hi,

i make an attempt to plot the solution to

Here is my code :

> with(plots); with(DEtools);
> ode1 := diff(x(t), t) = v(t); ode2 := diff(v(t), t) = -(.8*9.8)*v(t)/abs(v(t))-cos(t)^2;
> MODEL := {ode1, ode2}; VARS := {v(t), x(t)}; DOMAIN := t = 0 .. 150; RANGE := x = -1 .. 1, v = -5 .. 5; COLORS := [BLACK, BLUE]; IC1 := [x(0) = .5, v(0) = .25]; IC2 := [x(0) = 2.5, v(0) = 3];
> DEplot(MODEL, VARS, DOMAIN, RANGE, [IC1, IC2], stepsize = .1, linecolor = COLORS, scene = [t, x]);
>

and the message cannot evaluate the solution further right of .16015784, maxfun limit exceeded (see ?dsolve,maxfun for details)

Any other attemp has failed.

Have you got somme ideas

Thanks

Phil

Hello, dear experts.
I have a question...
solve the system of differential equations,where one of the initial conditions need to be chosen so thatcondition is metat the end of integration.
The task is not difficult, but I'm having trouble with the syntax.

1.I can't "pull"the desired function from the solution and find its value at a certain point.
I try to do so:
r_ravn:=s->subs(F,r(s));
evalf(r_ravn(s_end));
evalf(r_ravn(0));
but there is no result

2.In this case,instead of"for"it is better to use a while loop, but again the problem arises 1.
Tell me, please,how to implemen my program.

 

restart:
R:=0.3:
theta_min:=Pi/6:
theta_max:=Pi/2:
betta_max:=evalf(Pi/180*80);
p:=2*10^5:

theta0:=s->Pi/3/s_end*s+Pi/6:
r0:=s->R*sin(theta0(s)):
s_end:=evalf(R*(theta_max-theta_min)):

sol1:=solve({sin(betta_max)=c/r0(0)},{c});
const1:=0.1477211630;

betta0:=s->arcsin(const1/r0(s)):
betta:=s->arcsin(r(s)/r0(s)*sin(betta0(s))):
A:=s->cos(betta(s))/cos(betta0(s)):
T1:=s->rT1(s)/r(s):
T2:=s->T1(s)*tan(betta(s))^2:

step:=0.001:
delta:=0.001:
for i from 1 to 3000 do
r_min:=0.3-step:
rT1_n:=p*Pi*r_min^2/2/Pi/sin(theta_min):

sys := diff(rT1(s), s)-A(s)*T2(s)*cos(theta(s)),diff(theta(s), s)-A(s)/T1(s)*(p-T2(s)*sin(theta(s)/r(s))),diff(r(s),s)-A(s)*cos(theta(s)),diff(z(s),s)-A(s)*sin(theta(s));
fcns := {rT1(s),theta(s),r(s), z(s)};
F := dsolve({sys,rT1(0)=rT1_n, theta(0)=theta_min,r(0) = r_min, z(0) = 0}, fcns, numeric,output=listprocedure):
r_ravn:=s->subs(F,r(s)):
if abs(evalf(r_ravn(s_end))-R)=delta then break:
print(r_min):
end if:
end do:

r_ravn:=s->subs(F,r(s));
evalf(r_ravn(s_end));
evalf(r_ravn(0));
plot([r_ravn(s),r(s)],s=0..s_end);

Here my worksheet that at the end of it I have a problem with the dsolve when solving an ode system. and the error is 

Error, (in StringTools:-IsPrefix) second argument must be a string

I know that the dsolve has problem with bracket . Then how can I fix it or how can I change my codes.

 optimal.mwoptimal.mw

I'm currently having some difficulties in solving a system of differential equations numerically.

This is my code.

 

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

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