MathGroup Archive 2003

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

Search the Archive

Re: Re: NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43126] Re: [mg43094] Re: NDSolve
  • From: sean kim <shawn_s_kim at yahoo.com>
  • Date: Wed, 13 Aug 2003 07:49:57 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

when i copy and paste my codes and evaluate, it did cause cause errors
in a new kernel session but only if i start new kernel session. how
weird... maybe it has to do with how texts are copied and pasted into
the notebooks.. i don't know.

here's the fix if you want. note the new system definition called neqns
which is same as eqns with the parameters replaced with numbers.  and
the join commands enters after the neqns and ic definition.

In[1]:=
 ClearAll["Global`*"] 
In[2]:=
eqns = {y1'[x] == -k1 y1[x] y2[x] + km1 y3[x], 
    y2'[x] == -k1 y1[x] y2[x] + km1 y3[x], 
    y3'[x] == k1 y1[x] y2[x] + km2 y4[x] M - (km1 + k2 M) y3[x], 
    y4'[x] == -km2 M y4[x] + k2 M y3[x]}

ic = {y1[0] == 10^13, y2[0] == 10^16, y3[0] == 0, y4[0] == 0}

neqns = eqns /. { k1 -> 10^-11, km1 -> 10^7, k2 -> 10^-11, km2 -> 2
10^-17, 
      k3 -> 8.25 10^5, k4 -> 2.6 10^10, M -> 6 10^16}
Join[{neqns, ic}]

solns = NDSolve[
    Join[{neqns, ic}], {y1[x], y2[x], y3[x], y4[x]}, {x, 0, 50 10^-6}]

Plot[Evaluate[y1[x] /. solns], {x, 0, 50 10^-6}]; Plot[
  Evaluate[y2[x] /. solns], {x, 0, 50 10^-6}]; Plot[
  Evaluate[y3[x] /. solns], {x, 0, 50 10^-6}]; Plot[
  Evaluate[y4[x] /. solns], {x, 0, 50 10^-6}];

the error message suggest the Join command isn't making a list with
ode's and ic's. it was joining term eqns with the ic's instead of eqn
system. above fixes that. 

you can generally troubleshoot by running parts of the codes if
something isn't going right. and see if you identify where the problem
is. 

good luck



=====
when riding a dead horse,  some dismount.

while others... 

write memoirs on the subject of riding a dead horse.

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com


  • Prev by Date: Re: X-windows display of Mathematica graphics run remotely on Mac OS X machine
  • Next by Date: Re: Re: New version, new bugs
  • Previous by thread: Re: NDSolve
  • Next by thread: Re: Page preview in Mathematica ?