#1183 added erf and erfc - #1184
Conversation
valentinsulzer
left a comment
There was a problem hiding this comment.
Looks good, just needs CHANGELOG :) and you can remove Erfc
|
|
||
| def _function_diff(self, children, idx): | ||
| """ See :meth:`pybamm.Function._function_diff()`. """ | ||
| return -2 / np.sqrt(np.pi) * Exponential(-children[0] ** 2) |
There was a problem hiding this comment.
I don't think we need this class, given how you defined erfc
|
Not sure why does the test not pass in MacOs. Maybe the values are slightly different and that's why it crashes. Can someone with a Mac check if that's the case? |
|
Yeah it seems like casadi and numpy have different implementations of erf on Mac: |
|
Opened casadi/casadi#2672 |
|
Should I define an |
|
If you can figure out how :) I briefly tried but couldn't. It's still weird that casadi gives different values on mac and windows/linux though |
|
CasADi people say it's not something they can fix. So we should figure out how to implement assertCasadiAlmostEqual |
| (casadi.fabs(casadi.evalf(a) - casadi.evalf(b)) < tol).is_one() | ||
| ) | ||
| else: | ||
| self.assertTrue((casadi.fabs(a - b) < tol).is_one()) |
Description
Added Erf and Erfc functions
Fixes #1183
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.
Key checklist:
$ flake8$ python run-tests.py --unit$ cd docsand then$ make clean; make htmlYou can run all three at once, using
$ python run-tests.py --quick.Further checks: