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

How to get first n derivatives all at once efficiently? #74

Closed
orebas opened this issue May 17, 2024 · 2 comments
Closed

How to get first n derivatives all at once efficiently? #74

orebas opened this issue May 17, 2024 · 2 comments

Comments

@orebas
Copy link

orebas commented May 17, 2024

Feature request:
Based on the package design, it seems like it is probably possible to calculate the first n derivatives of a function at once (with one call).

Right now to get that out probably requires using internal details. It would be nice to have an API to return the value and the first n derivatives at once (in a tuple or vector). It would also be nice to have an example in the docs.

@tansongchen
Copy link
Member

tansongchen commented May 17, 2024

Yes, that is definitely helpful. Right now, interfaces are like

@inline function derivative(f, x, l, vN::Val{N}) where {N}
    t = make_taylor(x, l, vN)
    return extract_derivative(f(t), N)
end

where make_taylor construct the seeds, f(t) get all derivative from order 0 ~ N, and extract_derivative extract the N-th order. Did you mean returning f(t), which is a Taylor polynomial or array of polynomials, directly?

@tansongchen
Copy link
Member

ok so this is a quick fix: 3770f8b

Now you can use the derivatives API to get all derivatives

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

No branches or pull requests

2 participants