FindRoot Chemical Balance

FindRoot Chemical Balance - FindRoot Chemical Balance - Messages

#1 Posted: 10/29/2016 11:10:59 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

"I was using SMath 0.98.6128 an NonlinerSolver 1.1.6099.14159"

Try that one Radovan

Jean

Solve Given_Find [UN CO2].sm (25 KiB) downloaded 65 time(s).
1 users liked this post
Radovan Omorjan 10/30/2016 3:59:00 AM
#2 Posted: 10/30/2016 4:14:35 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Wrote

"I was using SMath 0.98.6128 an NonlinerSolver 1.1.6099.14159"

Try that one Radovan

Jean

Solve Given_Find [UN CO2].sm (25 KiB) downloaded 65 time(s).



Thank you Jean for this example,

This is a quite tricky example for root solving because the results are quite close to zero. Your version does not work for me, FindRoot() failed here (it gives me few rather high values of concentrations, order of magnitude 10^5). As usual, when I change the IC, I can get the result which gives the balance equations close to zero. However, as the solutions are also close to zero we can get small negative values as well. This is not acceptable as the solution because we have concentrations here (nonnegative values). Here I changed the last two parameters for FindRoot() (relative and absolute errors) and I get all the positive values.

jean-hoh1.png

Moreover, the Mathcad solution is more agreeable (for example, H.equil=OH.equil=10^-7). Carbonic acid is the subject, our solution will indicate that this is stronger acid than expected - which is not the case.

Regards,
Radovan

P.S. By more careful examining this case, I think even Mathcad solution is quite suspicious...see the next post
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#3 Posted: 10/30/2016 8:36:45 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello Jean,

Here is a bit better solution (I think) and might help in these situations.

jean6.PNG

The acidity of this solution is close to the acidity of natural rain (ph=5.65,[H]~2.2e-6

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#4 Posted: 10/30/2016 11:47:56 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

"Carbonic acid" is a monkey business to manage. Especially wrt to
atmospheric gas phase and temperature. That reminds me Syncrude
[Alberta tar sand] asked me to improve their pH control. Good thing
I had several "Doctors in Chemestry" to help me and vice versa.
That is 35 years back and got rusted/diluted, since.

I will check your latest post [just arrived as I type this one]
How can you trust those very small sanity results, FindRoot is
only ± 0.0001 !!! ???

I managed a bit more from Mathcad.

Thanks Radovan, Jean
______________________________________________

The very original document is Mathcad 7 or lower from Dr. Griffin.
No more in contact from years.

Solve Given_Find [UN CO2].sm (101 KiB) downloaded 52 time(s).
1 users liked this post
Radovan Omorjan 10/30/2016 12:40:00 PM
#5 Posted: 10/30/2016 12:37:15 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

You are very welcome Jean,

I do not have experience with this system at all, I just used logs because of low concentrations. I know from somewhere ( I forgot from where? ) that logs might help. Actually, not always. It might get you into troubles when you get logs from negative values (complex numbers etc.). BTW, FindRoot() is not only ± 0.0001 (I think). Look at the last two numbers arguments of FindRoot()- these are for controlling relative and absolute errors.

I know of Dr. Griffin Mathcad pages many years back as well.

Regards,
Radovan

P.S. You might forget to divide by C(x) to get the plot? - not sure

jean1.PNG
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#6 Posted: 10/30/2016 2:29:52 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Thanks Radovan,

I will try FindRoot(4)in my version.
The problem was with your plotting
suggestion it crashes 5346 UNofficial !
Was tried before "freak scale" invention.

Jean
#7 Posted: 10/30/2016 3:52:01 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Just to remember it, when there are multiple unknowns IC and results are assumed to be in alphabetical order (something I'm changing in code refactoring).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#8 Posted: 10/30/2016 5:15:08 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Wrote

Just to remember it, when there are multiple unknowns IC and results are assumed to be in alphabetical order (something I'm changing in code refactoring).



Davide, I always forget that and I remember the comment of Martin Kraska. He mentioned that it took him lot of time to figure this out. It is really easy to forget and I also assume that this would not be a restriction anymore.

Best Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • New Posts New Posts
  • No New Posts No New Posts