Skip to content

Fix inexact slope for determining pH#7

Open
briochemc wants to merge 3 commits intojamesorr:masterfrom
briochemc:patch-3
Open

Fix inexact slope for determining pH#7
briochemc wants to merge 3 commits intojamesorr:masterfrom
briochemc:patch-3

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