MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Avoiding divide by zero error in NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62586] Re: [mg62479] Re: Avoiding divide by zero error in NDSolve
  • From: Daniel Huber <dh at metrohm.ch>
  • Date: Tue, 29 Nov 2005 04:44:20 -0500 (EST)
  • References: <dm49jj$sul$1@smc.vnet.net> <200511250725.CAA18016@smc.vnet.net> <438A6178.30504@purdue.edu>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Pradeep,
my notes are still valid even for the coupled system. All your equation 
are of the form:

D[M y,t] == k2
with an initial value for M[0]==0

this gives
M' y + M y' == k2
for t=0 and M[0]==0:
M' y ==k2

Therefore, at start time the value of y' is not determined!!,  the 
equations can not be solved numerically from 0 on !!  Towards this aim, 
the diffential equation should allow to calculate  the drivative!
I think your equations are  not correct. Either you used an invalid 
simplification or made an error somewhere.

Daniel

Pradeep Suresh wrote:

> Hi,
> Thank you very much for your response to my question about avoiding 
> divide by zero error in using NDSolve  with a specific set of 
> equations i had in mind namely(just to refresh your memories)
>
> 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}]
>
> What is suprising is that everyone of you had suggested a solution to 
> this problem by solving the first equation seperately and using the 
> result to solve the second equation(btw Plz  pardon the simplicity of 
> the final solution, this is just a test case). The problem is slightly 
> more complicated because the purpose behind this question is that our 
> research group is trying to write a program to generate mathematica 
> statements for solving any given set of differential equations 
> encountered in our domain(generally simple ODE's and DAE's) and in 
> orber to be able to do that, there is must be a standard way of 
> solving a set of equations, namely, 
> NDSolve[{eqns},{vars},{var,lowlim,upplim}].
> That is why i had wanted to solve this set of equations 
> simultaneously. Now by solving each equation in isolation this 
> solution becomes non-genralizable. So i have to ask, is there a way of 
> solving this set of equations simulatneously avoiding the divide by 
> zero error? is there a way i can specifiy the order of equations to be 
> solved in mathematica? any other suggestions?
>
> thank you guys so much for your dedication to mathematica!
> regards
> pradeep
>


-- 

Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh at metrohm.ch>
Internet:<http://www.metrohm.ch>


  • Prev by Date: Re: Re: Package development
  • Next by Date: Re: Random Normal deviates within compiled function?
  • Previous by thread: Re: Avoiding divide by zero error in NDSolve
  • Next by thread: Re: Avoiding divide by zero error in NDSolve