## 351 Reputation

13 years, 215 days

## Partial solution...

see attached.

http://www.maplesoft.com/support/help/Maple/view.aspx?path=dsolve/numeric

I used method lsode. As this problem is stiff, use stiff = true, but you have to provide the diff of the function (see the help above above).

 > restart:
 > de := diff(Y(x), x)+10^5*(Y(x)^2-YFD(x)^2)/x^2 = 0;
 (1)
 > YFD:=proc (x)  local xi; g:=2; if not type(evalf(x),'numeric') then       'procname'(x)    else Re(evalf((1/2)*g*(int((xi^2-x^2)^(1/2)*xi/(exp(xi)+1), xi = x .. infinity))/Pi^2)); end if; end proc;
 Warning, `g` is implicitly declared local to procedure `YFD` (2)
 > IC:=Y(1)=YFD(1);
 (3)
 > #infolevel[all]:=10;
 > sol:=dsolve({de,IC},type=numeric,known='YFD',method=lsode,maxfun=0):
 > sol(1);
 (4)
 > sol(1.00001);
 (5)
 > sol(1.0001);
 (6)
 > #sol(1.001);
 >

I ran for shorttimes, it is taking long. You can read about lsode options if you want to use this. Also, please consider using classic worksheet or maple format for display. Most of the time was spent on copying and pasting from your code to mine, not the actual solution itself. Try classic worksheet, and see for yourself how easy it is to copy paste commands or write a code with large number of sentences/commands.

## solves...

Without BCs.  May be you can see that and find out which one makes sense. A second order BVP can have only 2 BCs. you have 3 for each variable.

with(inttrans);

this should work

## Try Events approach...

If you know what causes singularity, you can do this by finding the time at which event happens. See for example the code below. You can ofcourse use v(a) =b and call both initial t values and intial conditions as parameters in dsolve and then call the dsolve solution for different parameters.

 > restart;
 > Digits:=15;
 (1)
 > ode1:=      -0.1*diff(u(z),z,z) +      (z-2*diff(v(z)^(-1/2),z))*diff(u(z),z)+(3-2*diff(v(z)^(-1/2),z,z))*u(z)           =      0;
 (2)
 > ode2:= 0.1*diff(v(z),z,z)+0.01*z*diff(v(z),z)+0.02*v(z)-u(z)*v(z)^(1/2)=0;
 (3)
 > ics:= u(0)=0, v(0)=0.1, D(u)(0)=0, D(v)(0)=0:
 > sol:= dsolve({ode||(1..2), ics}, numeric,stop_cond=[v(z)-1e-7],abserr=1e-10):
 > s1:=sol(100);
 Warning, cannot evaluate the solution further right of 4.1328703, event #1 triggered a halt (4)
 > z1:=subs(s1,z);
 (5)
 >

## Alternate approach...

If you know the specific integral you want to calculate beforehand, then add an additional variable z(t) defined as

dz/dt = y^2 with z(0)=0. z(1) gives the integral. The advantage is that the integral you get is of the same order of accuracy as u. You can use arbitrary number of Digits (Digits = 20 or 30).

Unfortunately this approach can be used only if the resulting system is an ODE. If your resulting system is a DAE, Maple cannot solve it (DAE BVP)

 > restart:
 > eq:=-1.2*diff(y(t),t\$2)+0.2*y(t)=2;
 (1)
 > bcs:=y(0)=1,y(1)=0;
 (2)
 > eq2:=diff(z(t),t)=y(t)^2;
 (3)
 > sol:=dsolve({eq,eq2,bcs,z(0)=0},type=numeric,abserr=1e-8,maxmesh=100):
 > with(plots):
 > odeplot(sol,[[t,y(t)],[t,z(t)]],0..1,thickness=3,axes=boxed);
 > sol(1);
 (4)
 >

## Solve V(t) first and then solve for C(t)...

hope this helps.

 > restart:
 > eq1:=diff(V(t)*C(t),t)=G-K*C(t);
 (1)
 > eq2:=diff(V(t),t)=alpha-beta;
 (2)
 > dsolve({eq1,eq2});
 (3)
 > V(t):=c1+(alpha-beta)*t;
 (4)
 > eq1;
 (5)
 > dsolve({eq1,C(0)=c2});
 (6)
 >

## Try DAE form...

Then enter to Maple in DAE form. My guess is that you are lucky because this approach works for this case as the addition of u enables Maple to convert this system to explicit dy/dt = f form.  But in general Maple cannot solve nonlinear DAEs or ODEs if it cannot convert them to explicit ODE form dy/dt = f. In fact, this is a serious flaw. The assumption made here is that all ODEs and DAEs can be converted to dy/dt = f(y) form. This is not true for many nonlinear or implicit ODEs until you add addtional variables. Maple avoids using Newton Raphson or any nonlinear solvers in its ODE solver.

Code attached. It is best to post some range for parameters or the physics of the problem. I can't guess the values of the parameters. You have to find u(0) for every set of parameters. For the parameters I chose, there is a singularity at 3.22 or so.

 > restart:
 > ODE1:=A*u(t)^2+B*u(t)*(h(t)+C)+E*h(t)=F*cos(u(t));
 (1)
 > eqic:=A*u1^2+B*u1*C=F*cos(u1);
 (2)

For the simulation shown u has an initial condition of Pi/2. When parameters change, change ic accordingly.

 > ODE2:=diff(h(t),t)=u(t):
 > sol:=dsolve({ODE1,ODE2,h(0)=0,u(0)=Pi/2},type=numeric,parameters=[A,B,C,E,F],stiff=true,maxfun=0):
 > sol('parameters'=[0,0,1,1,1]):
 > with(plots):
 > odeplot(sol,[t,h(t)],0..3);
 > odeplot(sol,[t,u(t)],0..1);
 >
 >