JuliaDiff / TaylorDiff.jl

Taylor-mode automatic differentiation for higher-order derivatives
https://juliadiff.org/TaylorDiff.jl/
MIT License
73 stars 8 forks source link

Vector-valued functions #46

Closed landreman closed 1 year ago

landreman commented 1 year ago

Hi, what would be involved in applying TaylorDiff to vector-valued functions? When I try now (with Julia 1.9.2 and TaylorDiff 0.2.1 or main), TaylorDiff.derivative returns false instead of the correct derivative. Example:

using TaylorDiff
using ForwardDiff

f(x) = [x, 2x]

x0 = 0.2

@show ForwardDiff.derivative(f, x0)  # Returns [1.0, 2.0] as expected
@show TaylorDiff.derivative(f, x0, 1)  # Returns false

Thanks.

tansongchen commented 1 year ago

TaylorDiff.jl should be able to handle vector valued functions, that is weird. I will take a look.

tansongchen commented 1 year ago

Just updated the main branch, please test again. Now you should be able to do any AbstractArray-valued functions.

landreman commented 1 year ago

Perfect, works now. Thank you!