FindRoot Chemical Balance

FindRoot Chemical Balance - FindRoot Chemical Balance - Сообщения

#1 Опубликовано: 29.10.2016 23:10:59
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: 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 КиБ) скачан 60 раз(а).
1 пользователям понравился этот пост
Radovan Omorjan 30.10.2016 03:59:00
#2 Опубликовано: 30.10.2016 04:14:35
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: 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 КиБ) скачан 60 раз(а).



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 Опубликовано: 30.10.2016 08:36:45
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: 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 Опубликовано: 30.10.2016 11:47:56
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: 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 КиБ) скачан 44 раз(а).
1 пользователям понравился этот пост
Radovan Omorjan 30.10.2016 12:40:00
#5 Опубликовано: 30.10.2016 12:37:15
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: 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 Опубликовано: 30.10.2016 14:29:52
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: 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 Опубликовано: 30.10.2016 15:52:01
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: 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 Опубликовано: 30.10.2016 17:15:08
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: 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!"
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений