Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inexact slope for determining pH #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

briochemc
Copy link

Probably fixes #3.

I tried to make this PR as minimal as possible.

Hopefully this change is sufficient! Quick testing shows that the new slope is accurate close to machine precision (relative error bounded by about 1e-14).

I think this should only make pH solves a little bit more accurate where it used to be inaccurate (e.g., for extreme input) at the price of a few extra computations that I hope incur only a marginal cost. This also potentially reduces the number of Newton iterations, so it could turn out a bit more efficient.

But just to be sure, could someone check that I did not mess anything up? Is there a test suite available somewhere?

briochemc and others added 2 commits June 30, 2022 17:01
@mvdh7
Copy link

mvdh7 commented Jul 1, 2022

Hey, nice work @briochemc! Would suggest also adding this to the more recently updated CO2SYSv3 here: https://github.com/jonathansharp/CO2-System-Extd

@briochemc
Copy link
Author

Oh I had no idea this existed! I'll take look soon...

Is it worth adding some link pointing users to the new version in the ReadMe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Suggestion] More robust root finding for pH evaluation
2 participants