darioizzo / audi

Header only, C++ library (and the Python pyaudi package) implementing the algebra of Taylor truncated polynomials and a few algorithms useful for its applications (Differential Intelligence, automatic differentiation, Taylor Models, etc.)
http://darioizzo.github.io/audi/
GNU General Public License v2.0
71 stars 18 forks source link

Proposed Inclusions in gdual interface #50

Open Microno95 opened 4 years ago

Microno95 commented 4 years ago

For further numpy compatibility, the following improvements may be useful in expose_gdual.hpp in this section:

https://github.com/darioizzo/audi/blob/365a0719ec939319df57b792f996b0efea2a1225/pyaudi/expose_gdual.hpp#L145-L186

Proposed inclusions:

.def(
            "log10", [](const gdual<T> &d) { return log(d)/log(10); }, "Base 10 Logarithm.")
.def(
            "log2", [](const gdual<T> &d) { return log(d)/log(10); }, "Base 10 Logarithm.")
.def(
            "log1p", [](const gdual<T> &d) { return log(d + 1.0); }, "Logarithm of x+1, inverse of exp(x) - 1")
.def(
            "expm1", [](const gdual<T> &d) { return exp(d) - 1.0; }, "exp(x) - 1, inverse of log1p")
.def(
            "erfc", [](const gdual<T> &d) { return 1.0 - erf(d); }, "Error Function Complement")

Not sure how to implement these in an efficient manner, but they may be a good idea:

Proposed revisions:

darioizzo commented 4 years ago

:) cool suggestions thanks .... should be relatively straight forward to implement (most of them at least ...). Not sure when I will have the time to work on a PR for this, feel free to start one in case you have the motivation ....