Chemical Forums

Chemistry Forums for Students => Physical Chemistry Forum => Topic started by: ursus101 on October 27, 2012, 03:20:12 PM

Title: simultaneous equilibria
Post by: ursus101 on October 27, 2012, 03:20:12 PM
Hi all,

I am trying to understand how to find an equilibrium concentration [AB] in the following system. All reactions are in solution. All substrates are soluble (i.e. no heterogeneous phases). Initial concentrations of A and B are Ao and Bo, respectively.

A + B ::equil:: AB, dissociation constant K1
A + A ::equil:: AA, dissociation constant K2
B + B ::equil:: BB, dissociation constant K3

unknowns: [AB], [AA], [BB]

[1] Is it possible to find a general analytical expression for equilibrium concentrations [AB] as a function of (Ao,Bo,K1,K2,K3)? I was trying to denote equilibrium concentrations [AB] and [AA] as unknown variables x and y, respectively, and to build a system of equations using mass balance laws. However, I got stuck instantly.

[2] Assuming I am given numerical values for Ao, Bo, K1, K2, K3, how would I solve this problem?

Thanks,
Ursus
Title: Re: simultaneous equilibria
Post by: Borek on October 27, 2012, 06:44:05 PM
[1] Is it possible to find a general analytical expression for equilibrium concentrations [AB] as a function of (Ao,Bo,K1,K2,K3)?

Not sure if there will exist a nice analytical solution, as what you have here is a set of simultaneous nonlinear equations. At best I would expect to get a polynomial of at least 3rd degree - if not higher.

Quote
I was trying to denote equilibrium concentrations [AB] and [AA] as unknown variables x and y, respectively, and to build a system of equations using mass balance laws. However, I got stuck instantly.

That's the correct approach, but it is not guaranteed to yield a nice solution.

Quote
[2] Assuming I am given numerical values for Ao, Bo, K1, K2, K3, how would I solve this problem?

Numerically, for example using some variant of a Newton-Raphson method.
Title: Re: simultaneous equilibria
Post by: curiouscat on October 28, 2012, 01:43:04 AM
[tex]
K_1=\frac{AB}{A.B} \\

K_2=\frac{AA}{A^2} \\
 
K_3=\frac{BB}{B^2} \\
[/tex]

3 eq. 5 unknowns.

What would be the other 2 eq. The Mass balance, yes, but how to formulate?

Edit: Ok, maybe these?

[tex]
A_0=A+AB+2.AA \\

B_0=B+AB+2.BB
[/tex]
Title: Re: simultaneous equilibria
Post by: Borek on October 28, 2012, 04:50:47 AM
Writing these equation is not that difficult. Solving them is challenging.

You can use \times in multiplications - [itex]2\times AA[/itex].
Title: Re: simultaneous equilibria
Post by: curiouscat on October 28, 2012, 05:33:46 AM
Writing these equation is not that difficult. Solving them is challenging.

Analytically, yes. Numerically, should be easy. Something like Matlab should spit out the answer in a jiffy.

Quote
You can use \times in multiplications - [itex]2\times AA[/itex].

Thanks.

The [B] tag doesn't seem to work though.  ???
Title: Re: simultaneous equilibria
Post by: Borek on October 28, 2012, 05:44:03 AM
The [nоbbc][/nоbbc] tag doesn't seem to work though.  ???

Thanks for the report, I will see what is going on.

As I expected, solving these equations is not easy. Maxima (http://en.wikipedia.org/wiki/Maxima_(software)) already works for about half an hour and have not yet found the solution.
Title: Re: simultaneous equilibria
Post by: curiouscat on October 28, 2012, 05:59:24 AM
The [nоbbc][/nоbbc] tag doesn't seem to work though.  ???

Thanks for the report, I will see what is going on.

As I expected, solving these equations is not easy. Maxima (http://en.wikipedia.org/wiki/Maxima_(software)) already works for about half an hour and have not yet found the solution.

...an analytical closed-form solution may not even exist.
Title: Re: simultaneous equilibria
Post by: Borek on October 28, 2012, 06:03:24 AM
...an analytical closed-form solution may not even exist.

Which is what I suggested in the very first post in the thread.

Time to kill Maxima. Another 15 minutes and nothing has changed.

Title: Re: simultaneous equilibria
Post by: Borek on October 28, 2012, 06:09:59 AM
OK, everything is OK about [B] tag - that is, it works as usual. I guess you copy pasted text from the post formatting explanation - there are some tricks used there to make the post look like I wanted it to look.

I am editing your post to make the tag look correctly. Unfortunately [B] is difficult to use, and there is not much that can be done about it.
Title: Re: simultaneous equilibria
Post by: curiouscat on October 28, 2012, 06:11:21 AM
OK, everything is OK about [B] tag - that is, it works as usual. I guess you copy pasted text from the post formatting explanation - there are some tricks used there to make the post look like I wanted it to look.

I am editing your post to make the tag look correctly. Unfortunately [B] is difficult to use, and there is not much that can be done about it.

Trying again...


[tex]

K_1=\frac{[AB]}{[A][B]} \\  K_2=\frac{[AA]}{[A]^2} \\   K_3=\frac{[BB]}{[B]^2} \\

[/tex]


Yup; works. Thanks. This is why I'd wanted it..
Title: Re: simultaneous equilibria
Post by: ursus101 on October 28, 2012, 04:16:02 PM
Hi everyone,

Thanks a lot for your feedback. It seems that there does not exist an analytical solution. I also tried to solve the system of equations but without success.

For my particular task, I tried to denote x = [A], y = [B]. Then, in equilibrium state:
[itex][AB] = K_1 x y[/itex]
[itex][AA] = K_2 x^2[/itex]
[itex][BB] = K_3 y^2[/itex]

(1) [itex]x + K_1 x y + 2 \times K_2 x^2 = A_0[/itex]
(2) [itex]y + K_1 x y + 2 \times K_3 y^2 = B_0[/itex]

Mathematica spits out three solutions for this system -- each two-pages long. None of them seems right to me. Trying to substitute Ao, Bo, K1, K2, K3 with some real numbers results in gibberish -- complex numbers or numerical errors (like division by zero, etc.)

I tried to formulate problem differently, by denoting x = [AB], y = [AA], z = [BB]. Then,
[itex][A] = A_0 - x - 2y[/itex]
[itex][B] = B_0 - x - 2z[/itex]

(1) [itex]K_1 = \frac {x} {(A_0 - x - 2y)(B_0 - x - 2z)}[/itex]

(2) [itex]K_2 = \frac {y} {(A_0 - x - 2y)^2}[/itex]

(3) [itex]K_3 = \frac {z} {(B_0 - x - 2z)^2}[/itex]

Then solve for x, y, z. Nothing good happens here too...
Title: Re: simultaneous equilibria
Post by: Borek on October 28, 2012, 04:19:12 PM
Numerical approach seems to be the best one.
Title: Re: simultaneous equilibria
Post by: Borek on October 28, 2012, 04:43:00 PM
If you solve K1 for B] K2 for AA and K3 for BB, and you put these into the B mass balance, you will get a 2nd degree equation in A and AB only, this can be solved for A. The result can be in turn put into the A mass balance, yielding an equation in AB only. Still not easy to solve, but at least you have one unknown only.
Title: Re: simultaneous equilibria
Post by: ursus101 on October 28, 2012, 05:17:05 PM
Let's see what it may look like (I will be slowly updating this post as I progress).

Solving K1 for [B]:
(1) [itex][B] = \frac {1}{K_1} \frac {[AB]} {[A]}[/itex]

Solving K2 for [AA]:
(2) [itex][AA] = K_2 [A]^2[/itex]

Solving K3 for for [BB]:
(3) [itex][BB] = K_3 [B]^2 = K_3 (\frac {1}{K_1} \frac {[AB]} {[A]})^2[/itex]

Put these into the B mass balance:
(4a) [itex][B] = B_0 - [AB] - 2[BB][/itex]

(4b) [itex]\frac {1}{K_1} \frac {[AB]} {[A]} = B_0 - [AB] - 2[BB][/itex]

(4c) [itex]\frac {1}{K_1} \frac {[AB]} {[A]} = B_0 - [AB] - 2K_3 (\frac {1}{K_1} \frac {[AB]} {[A]})^2[/itex]

Solve (4c) for [A] (with Mathematica's help):

(5) [itex][A] = \frac {[AB] \pm [AB] \sqrt {8 B_0 K_3 - 8 K_3 [AB] + 1}} {2 B_0 K_1 - 2 K_1 [AB]}[/itex]

Put the result into the A balance:
(6a) [itex][A] = A_0 - [AB] - 2[AA][/itex]

(6b) [itex]\frac {[AB] \pm [AB] \sqrt {8 B_0 K_3 - 8 K_3 [AB] + 1}} {2 B_0 K_1 - 2 K_1 [AB]} = A_0 - [AB] - 2 K_2 [A]^2[/itex]

(6c) [itex]\frac {[AB] \pm [AB] \sqrt {8 B_0 K_3 - 8 K_3 [AB] + 1}} {2 B_0 K_1 - 2 K_1 [AB]} = A_0 - [AB] - 2 K_2 ( \frac {[AB] \pm [AB] \sqrt {8 B_0 K_3 - 8 K_3 [AB] + 1}} {2 B_0 K_1 - 2 K_1 [AB]} ) ^2[/itex]

(6d) ...
Title: Re: simultaneous equilibria
Post by: ursus101 on October 28, 2012, 06:32:41 PM
(6d) I get a solution but it is too long to paste it here. Anyway, the solution does not seem to be the right one -- I guess, there are numerical problems in such situations.
Title: Re: simultaneous equilibria
Post by: curiouscat on October 29, 2012, 12:15:30 AM

Mathematica spits out three solutions for this system -- each two-pages long. None of them seems right to me.


Try adding constraints. Problem with Mathematica often is that it assumes the most general domain for x,y,z. Say, all complex.

Try adding:

 x,y,z ε Real
x,y,z all positive

x,y,z < A0, B0

etc.
Title: Re: simultaneous equilibria
Post by: Big-Daddy on October 31, 2012, 06:38:41 PM
As I expected, solving these equations is not easy. Maxima (http://en.wikipedia.org/wiki/Maxima_(software)) already works for about half an hour and have not yet found the solution.

Is Maxima a software good at solving these problems (e.g. simultaneous non-linear equations, solve analytically for a particular variable in terms of chosen set of others, provided of course that such a solution is possible at all)? I was looking for a software that could help solve this type of problem.

Also, is an analytical solution always possible when the equilibrium constants involved are limited to Ka, Kb, Kw, Ksp and/or Kf?
Title: Re: simultaneous equilibria
Post by: Borek on October 31, 2012, 07:01:48 PM
Is Maxima a software good at solving these problems (e.g. simultaneous non-linear equations, solve analytically for a particular variable in terms of chosen set of others, provided of course that such a solution is possible at all)? I was looking for a software that could help solve this type of problem.

From what I know Maxima is not best, and it has some quirks that I don't like. But it is free and reasonably good in my experience.

Quote
Also, is an analytical solution always possible when the equilibrium constants involved are limited to Ka, Kb, Kw, Ksp and/or Kf?

Quite the opposite, you can be sure there is no analytical solution in most cases, apart from the most simple ones.

Strong acid in water yields a second degree equation in [H+]. Each additional dissociation constant increases the degree by 1, so solution for a monoprotic weak acid will be a polynomial of a 3rd degree, of diprotic acid 4th degree, of triprotic acid - 5th degree, and it is a known fact that there is no analytical solution for 5th degree polynomials.
Title: Re: simultaneous equilibria
Post by: Big-Daddy on October 31, 2012, 11:18:55 PM
Is Maxima a software good at solving these problems (e.g. simultaneous non-linear equations, solve analytically for a particular variable in terms of chosen set of others, provided of course that such a solution is possible at all)? I was looking for a software that could help solve this type of problem.

From what I know Maxima is not best, and it has some quirks that I don't like. But it is free and reasonably good in my experience.

Quote
Also, is an analytical solution always possible when the equilibrium constants involved are limited to Ka, Kb, Kw, Ksp and/or Kf?

Quite the opposite, you can be sure there is no analytical solution in most cases, apart from the most simple ones.

Strong acid in water yields a second degree equation in [H+]. Each additional dissociation constant increases the degree by 1, so solution for a monoprotic weak acid will be a polynomial of a 3rd degree, of diprotic acid 4th degree, of triprotic acid - 5th degree, and it is a known fact that there is no analytical solution for 5th degree polynomials.

Yes, but to find the polynomial in [H+]? That should always be possible, no?

After that, substitution of numerical values into the extra terms (Ca, Ka, Kw, etc.) yields an equation that can always be solved so long as there is a real solution.

I will do some investigating into mathematical software that may be able to reach the polynomial stage from the set of simultaneous equations using abstract algebra alone (i.e. without specifying the values of the constants or concentrations, leaving them in algebraic form).
Title: Re: simultaneous equilibria
Post by: curiouscat on November 01, 2012, 12:55:01 AM


Is Maxima a software good at solving these problems (e.g. simultaneous non-linear equations, solve analytically for a particular variable in terms of chosen set of others, provided of course that such a solution is possible at all)? I was looking for a software that could help solve this type of problem.

Mathematica is the best I've seen. Unfortunately not free.

Maple is decently good.
Title: Re: simultaneous equilibria
Post by: Borek on November 01, 2012, 05:09:54 AM
Strong acid in water yields a second degree equation in [H+]. Each additional dissociation constant increases the degree by 1, so solution for a monoprotic weak acid will be a polynomial of a 3rd degree, of diprotic acid 4th degree, of triprotic acid - 5th degree, and it is a known fact that there is no analytical solution for 5th degree polynomials.

Yes, but to find the polynomial in [H+]? That should always be possible, no?

In my experience, with a correct approach, yes it is. At least for acid/base equilibria. See equation 11.16 (http://www.chembuddy.com/?left=pH-calculation&right=pH-salt-solution#eq11.11) - while it is not in a polynomial form, converting it to one is just an exercise in patience.

Quote
After that, substitution of numerical values into the extra terms (Ca, Ka, Kw, etc.) yields an equation that can always be solved so long as there is a real solution.

Numerically, yes.
Title: Re: simultaneous equilibria
Post by: Big-Daddy on November 01, 2012, 11:02:10 AM
Strong acid in water yields a second degree equation in [H+]. Each additional dissociation constant increases the degree by 1, so solution for a monoprotic weak acid will be a polynomial of a 3rd degree, of diprotic acid 4th degree, of triprotic acid - 5th degree, and it is a known fact that there is no analytical solution for 5th degree polynomials.

Yes, but to find the polynomial in [H+]? That should always be possible, no?

In my experience, with a correct approach, yes it is. At least for acid/base equilibria. See equation 11.16 (http://www.chembuddy.com/?left=pH-calculation&right=pH-salt-solution#eq11.11) - while it is not in a polynomial form, converting it to one is just an exercise in patience.

Quote
After that, substitution of numerical values into the extra terms (Ca, Ka, Kw, etc.) yields an equation that can always be solved so long as there is a real solution.

Numerically, yes.

I can't find the necessary polynomial in the case of this problem. But I suppose this one doesn't involve common equilibrium constant terms like Ka, Kw, Ksp, etc. so could be impossible to solve.