Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: new to group - Chemical Equation Solutions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100213] Re: [mg100175] new to group - Chemical Equation Solutions
  • From: "David Park" <djmpark at comcast.net>
  • Date: Thu, 28 May 2009 04:29:11 -0400 (EDT)
  • References: <6147782.1243412890107.JavaMail.root@n11>

(eqns = {a == b + c + d, e == f + g + c + 2 d, h == c/(b g), 
    i == d/(c g), h i == d/(b g^2), j == (m g)/f, k == l m, 
    n + m + b + c == g + l}) // Column

I take it that {h, i, j, k} are equilibrium constants and
{a, b, c, d, e, f, g, l, m, n} are species of chemicals. You only have 8
equations and they do not seem to be all independent. So you can only solve
for 7 species. So you will have to specify the 4 equilibrium constants and 3
input species. One possibility is:

sols = Solve[eqns, {b, c, d, f, g, n, l}]

That gives 3 very long solutions and probably only one of them gives
positive real values for all of the solved species. 

If we try a set of data:

data = Thread[{h, i, j, k, a, e, m} -> {1, 1, 1, 1, 1, 1, 1}];

we do obtain one solution:

First@Select[sols /. data // N, FreeQ[#, Complex] &]
{n -> -0.611858, l -> 1., d -> 0.070959, f -> 0.317183, c -> 0.223717,
  b -> 0.705324, g -> 0.317183}

In general, these kind of equations may be numerically difficult. There is
probably a polytope in species space that defines the region of positive
real solutions. If some of the equilibrium constants are very high or low
the desired solution may be very close to a wall or corner of the polytope
and the numerical evaluation may lose precision. So you may luck out with
the standard Mathematica solutions or you may have to use special numerical
methods. I published several articles on numerical methods for solving mass
action chemical equilibrium equations and was able to obtain nearly full
computer precision over nearly the full real number dynamic range for these
equations. (Journal of Chemical Physics, 1976, Vol 65, No. 8, pp 3085-3091,
Computers Chem. 1990, Vol 14, No.2, pp 141-156) but your equations are
slightly different and may require modified methods. There are probably
similar good methods and programs but I don't know offhand of any
implemented as general purpose packages in Mathematica.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/   


From: Jem [mailto:not.a.ninja25 at gmail.com] 

Hi,

Hi, I am a postgrad student and completely new to mathematica, I am just
starting to realise the possibilities.

I am trying to do a chemical speciation calculation.
I have a set of simultaneous equations which represents the equilibria, mass
balance, and charge balance in the system.

I want to eliminate some of the variables, and then be able to solve for the
remaining ones.
My system of equations looks like this:
a=b+c+d
e=f+g+c+2d
h=c/(bg)
i=d/(cg)
hi=d/(bg^2)
j=mg/f
k=lm
n+m+b+c=g+l

I will try to attach an image of what my formula looks like sofar.
Basically, I can solve for the variable I want, but I am having trouble
eliminating the ones I don't want (ie. I am getting an answer that is in
terms of the wrong variables)

I have been in the help files for ages, and don't really understand how to
do this.
I would really appreciate some pointers!!
Thanks


Solve[{a == b + c + d, e == f + g + c + 2 d, h == c/(b*g),
  i == d/(c*g), h*i == d/(b*g^2), j == m*g/f, k == l*m,
  n + m + b + c == g + l}, {g}]





  • Prev by Date: Re: Dynamic performance - input fields slow
  • Next by Date: Re: simultaneous equations for chemical speciation
  • Previous by thread: Re: Mathematica for Behavioral Research?
  • Next by thread: Re: Re: new to group - Chemical Equation