# Interested in using TaylorSeries.jl as an implementation of high-order automatic differentiation / AD , as presented in the book by W. Tucker

Below is my (initial) solution to an issue I was having with TaylorSeries.jl , which leads to another question >> And more generally I’m interested in using TaylorSeries.jl as an implementation of high-order automatic differentiation

One partial SOLN : Using TaylorSeries.jl to get the inverse function exp by defining Taylor1 function log works now

``````julia> tBig = Taylor1(BigFloat, 50) # Independent variable with BigFloats, With order 50 precision 1.0 t + ?(t⁵¹)
julia> p = log(tBig + 1.0)
julia> TaylorSeries.evaluate(inverse(p), TaylorSeries.evaluate(p, 0.9))
8.999082e-01
julia> TaylorSeries.evaluate(inverse(p), 0.9)
1.459603
julia> exp(0.9)
2.45960311115695
julia> TaylorSeries.evaluate(inverse(p), 0.9) + 1.0
2.459603111156949
``````

###########################

Using TaylorSeries.jl to get the inverse function exp by defining Taylor1 function log works now ( see above )

Next Question: but How do we do vice-versa aka for an arbitrary function f and f^-1 ?

tBig = Taylor1(BigFloat, 50) # Independent variable with BigFloats, With order 50 precision 1.0 t + ?(t⁵¹)

TaylorSeries.evaluate(inverse(exp(tBig)), TaylorSeries.evaluate(exp(tBig), 0.9))

DEBUG ERROR: ArgumentError: Evaluation of Taylor1 series at 0 is non-zero. For high accuracy, revert a Taylor1 series with first coefficient 0 and re-expand about f(0).

More generally I’m interested in Introduction using TaylorSeries.jl as an implementation of high-order automatic differentiation, as presented in the book by W. Tucker per description here >> https://www.juliadiff.org/TaylorSeries.jl/stable/background/ and would appreciated any tips or advice there also.

TaylorSeries.jl already is exactly an implementation of high-order AD as in the book by Tucker, except that it also works for functions of several variables.

What is it exactly that you want to do?

1 Like

TaylorSeries.jl essentially follows the implementation described in Tucker’s book, in the sense that it uses the recursion formulas to construct the Taylor expansion. This is also applied to the multivariate case, exploiting the same ideas on homogeneous polynomials of a fixed degree; see for instance The Parameterization Method for Invariant Manifolds, by Alex Haro et al.

The k-th order coefficient of the series is related to the k-th derivatives of the function, except for a k!. You can access that coefficient using a vector-index notation:

``````julia> using TaylorSeries

julia> t = Taylor1(15)
1.0 t + 𝒪(t¹⁶)

julia> t = Taylor1(5)
1.0 t + 𝒪(t⁶)

julia> p = exp(t)
1.0 + 1.0 t + 0.5 t² + 0.16666666666666666 t³ + 0.041666666666666664 t⁴ + 0.008333333333333333 t⁵ + 𝒪(t⁶)

julia> p[3]   # same as p.coeffs[4]
0.16666666666666666
``````

Therefore, to get the actual third derivative you should multiply `p[3]` by `3!`, or alternatively use:

``````julia> differentiate(3, p) # third order derivative of p
1.0
``````

If you can formulate more concrete questions, it will be easier for us to help you. Also, please feel welcome to open issues or pull requests to improve the package.

3 Likes

My package Grassmann.jl already supports higher order dual numbers or Taylor series also.

1 Like

Great! Could you please give an example?

2 Likes