Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'avoiding divide by zero error in NDsolve' topicStudent Support Forum > General > "avoiding divide by zero error in NDsolve"

Next Comment >Help | Reply To Topic
Author Comment/Response
Pradeep Suresh
11/23/05 3:41pm

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

URL: ,

Subject (listing for 'avoiding divide by zero error in NDsolve')
Author Date Posted
avoiding divide by zero error in NDsolve Pradeep Suresh 11/23/05 3:41pm
Re: avoiding divide by zero error in NDsolve Peter Pein 11/23/05 8:24pm
Re: avoiding divide by zero error in NDsolve yehuda ben-s... 11/24/05 07:52am
Next Comment >Help | Reply To Topic