Avoiding divide by zero error in NDSolve
- To: mathgroup at smc.vnet.net
 - Subject: [mg62443] Avoiding divide by zero error in NDSolve
 - From: pradeep suresh <pradeep at purdue.edu>
 - Date: Thu, 24 Nov 2005 06:33:43 -0500 (EST)
 - Organization: Purdue University
 - Sender: owner-wri-mathgroup at wolfram.com
 
Hi all,
I am having this problem of mathematica not letting me specify the exact 
intial values to a differential equation set. a simple example follws
Simple Mass Balance Equation set in Chemical Systems.
Nsp = 5;
k1 = 100;
For[i = 1, i < (Nsp + 1), i++, k2[i] = k1/Nsp];
eqn1 = {D[M[t], t] == k1, M[0] == 0};
eqn2 = Table[{D[M[t]y[i][t], t] == k2[i],y[i][0] ==k2[i]/k1},{i,Nsp}];
var1 = Table[y[i][t], {i, Nsp}];
var2 = Join[{M}, var1];
sol=NDSolve[{eqn1,eqn2},var2,{t,0,10}]
Mathematica refuses to solve this system showing error messages of 
encountering 1/0. If i change the initial condition of M to some 
arbitrary nonzero value, it is able to solve this system although now 
the set of equations are practically meaningless for me. Is there any 
way i can retain the meaning of my equations and still get them solved 
by mathematica? Plz advice!
Thanks & Happy thanksgiving,
Pradeep
- Follow-Ups:
- Re: Avoiding divide by zero error in NDSolve
- From: <bsyehuda@gmail.com>
 
 
 - Re: Avoiding divide by zero error in NDSolve