Re: NDSolve and Systems of DEs
- To: mathgroup at smc.vnet.net
- Subject: [mg74187] Re: NDSolve and Systems of DEs
- From: dh <dh at metrohm.ch>
- Date: Wed, 14 Mar 2007 03:41:20 -0500 (EST)
- References: <et5pgb$kao$1@smc.vnet.net>
Hi Matteo,
here is you problem with corrected syntax:
eqs={
D[p[x,t],t]==k D[ p[x,t],{x,2}],
D[n[x,t],t]==k D[ p[x,t],{x,2}],
D[ El[x,t],t]==p[x,t]-n[x,t],
p[x,0]== 10*UnitStep[-x],p[100,t]==0,p[-100,t]==10,
n[x,0]==10*UnitStep[x],n[100,t]==10,n[-100,t]==0,
El[x,0]==0
};
k=1;
NDSolve[eqs,{p[x,t],n[x,t], El[x,t]},{x,-100,100},{t,0,1}]
However, nothe that it is not very clever to use the non-continuous
UnitStep function in a numerical DE. Better use a continuos
differentiable function like e.g. ArcTan.
Daniel
e-touch at libero.it wrote:
> Hello everybody!
> In order to better understand the behaviour of NDSolve, I decided to try to=
> solve a more simple system of equations...take a look here
>
> eq1--d/dt p[x,t]==== k dd/dx2 p[x,t]
> eq2--d/dt n[x,t]==== k dd/dx2 n[x,t]
> eq3--d/dx El[x,t]====p[x,t]-n[x,t]
> with:
> p[x,0]====10*UnitStep[-x]; p[100,t]====0; p[-100,t]====10;
> n[x,0]====10*UnitStep[x]; n[100,t]====10; n[-100,t]====0;
> El[x,0]====0;
>
> Eq1 and Eq2 are simple diffusion equations and El[x,t] it's just a function=
> that I tried to couple with the other two...
> All I get are error messages...
> "NDSolve::pdord: Some of the functions have zero differential order so the =
> \
> equations will be solved as a system of differential-algebraic equations."
> "NDSolve::bcart: Warning: An insufficient number of boundary conditions hav=
> e \
> been specified for the direction of independent variable x. Artificial \
> boundary effects may be present in the solution."
> "NDSolve::icfail: Unable to find initial conditions which satisfy the resid=
> ual \
> function within specified tolerances. Try giving initial conditions for bo=
> th \
> values and derivatives of the functions."
>
> The strange thing is that if I derive the funcion El[x,t] respect to time i=
> nstead of x...so with
> eq3--d/dt El[x,t]====p[x,t]-n[x,t];
> El[x,0]====0;
> ...it works!!!
> Could anyone explain this to me???
> Thanks everybody
> Matteo
>
>
>
> ------------------------------------------------------
> Leggi GRATIS le tue mail con il telefonino i-mode=99 di Wind
> http://i-mode.wind.it13mar07
>
>