Re: NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg62660] Re: NDSolve
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Wed, 30 Nov 2005 00:08:12 -0500 (EST)
- Organization: The University of Western Australia
- References: <dlkc4b$ppg$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <dlkc4b$ppg$1 at smc.vnet.net>, Uli Wuerfel <uli.wuerfel at fmf.uni-freiburg.de> wrote: > I reduced it to a simple diffusion equation, but still it does not work. > My Input is like: > > dcb=0.001; > rcb=1000; > gen=5e20; > ab=2000; > d=0.001; > > sol=nc/.First[NDSolve[ > {0==dcb*nc(2)[x]+gen*Exp[-ab*x]-rcb*(nc-nc0), > nc[0]==nc0,nc(1)[d]==0},nc,{x,0,d}]] > > wherein nc(i)[x] stands for the i-th spatial derivative of nc[x]. > > I don´t understand why Mathematica does not accept this. First note that Mathematica can solve this problem exactly: DSolve[{0 == dcb nc''[x] + gen/E^(ab x) - rcb (nc[x] - nc0), nc[0] == nc0, nc'[d] == 0}, nc, x] There are three problems with your above code: [1] gen=5e20 is not numerical. However, you will encounter a problem with stiffness if you try gen=5 10^20; [2] You have not specified nc0. [3] You have (nc-nc0) but nc is a function of x. Fixing these problems, the following works fine: dcb = 0.001; rcb = 1000; gen = 5*10^10; ab = 2000; d = 0.001; nc0 = 1; sol = NDSolve[{0 == dcb nc''[x] + gen/E^(ab x) - rcb (nc[x] - nc0), nc[0] == nc0, nc'[d] == 0}, nc, x] Plot[Evaluate[nc[x] /. sol], {x, 0, d}] Cheers, Paul _______________________________________________________________________ Paul Abbott Phone: 61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) AUSTRALIA http://physics.uwa.edu.au/~paul