Sure, I can attach the source, though it's not really something usable, it's rather a proof of concept. I have onle series with Float64 as coefficients, though other number types might be interesting. The data structure is lazy, because it computes data only when asked. I implemented getindex, so you can type t[1000000] (and go for lunch, I guess). Taylor is just a function (type Int64->Float64) computing a coefficient, and for efficiency, it's cached (using a dictionary, of course). I define some functions through integral equations: e = exp(t) = exp(t[0])+integral(t'*e). That works, because you need only n-1 coefficients of e to compute n coefficients of the right-hand side. I need a special form of assignment to the left-hand side, though, copying only the coefficient function (and its cache), and I (mis-)use the operator <| for that: e<|exp(t[0])+integral(t'*e) is essentially my definition of exp(t). It makes the data structure recursive, naturally. I'm not certain I understand your question concerning energy: total energy is conserved, of course, only kinetic/potential energy change. The former is z^2/2, and can be computed easily, BTW, it's cos(y)-cos(y0)+z0^2/2, in this case.
taylor.jl
Description: Binary data
