-
Notifications
You must be signed in to change notification settings - Fork 1
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
Taylor series #48
base: dev
Are you sure you want to change the base?
Taylor series #48
Conversation
Many thanks for adding this! julia> using Ephemerides, TaylorSeries
julia> eph_spk = EphemerisProvider("de440.bsp")
1-kernel EphemerisProvider:
"de440.bsp"
julia> time = Taylor1(5)
1.0 t + 𝒪(t⁶)
julia> pos = ephem_vector3(eph_spk, 3, 399, time)
3-element StaticArraysCore.SVector{3, Taylor1{Float64}} with indices SOneTo(3):
3543.2122880199786 - 0.007819282437845182 t - 1.1070930264252339e-8 t² + 8.950613857694201e-15 t³ + 3.761528551396154e-21 t⁴ - 1.9973114109467468e-27 t⁵ + 𝒪(t⁶)
3240.7653939449465 + 0.008093354620577769 t - 9.94896857688314e-9 t² - 7.43180726250546e-15 t³ + 5.169442616501638e-21 t⁴ + 3.7299514157257047e-28 t⁵ + 𝒪(t⁶)
924.6896922398621 + 0.0036612834090198375 t - 2.8165693209656376e-9 t² - 3.499002547324463e-15 t³ + 1.6203643125542688e-21 t⁴ + 2.988340338110004e-28 t⁵ + 𝒪(t⁶) I think this is working in principle and can be really useful to do computations over the JPL DE440/441 ephemerides in Julia. The only caveat would be that, to get the best performance, we might want to add some |
I just created the minimal working interface and have not optimized it for performance. Can TaylorSeries work in-place? In this case, we can use the following interface, which is tailored for in-place evaluations: Ephemerides.jl/src/interfaces.jl Line 45 in 9d0766d
and implement some overloads for the siblings' methods. |
If it was an easy plug-and-play then this is a good sign of the Ephemerides.jl interface design!
It can in the sense that variables of type |
Hi there! Not at the moment. In the current implementation all the In this regard, what would be needed to improve the compatibility and performance of TaylorSeries with Ephemerides? |
@PerezHz I've noticed that this extension will not be compatible with all versions of TaylorSeries. For some compatibility reasons with my registry, the highest TaylorSeries version I was able to install was the v0.13. However, the code you reported failed on that one because it did not have an implementation for julia> t = Taylor1(5)
1.0 t + 𝒪(t⁶)
julia> 1.0 < t
ERROR: MethodError: no method matching isless(::Float64, ::Taylor1{Float64}) Do you by any chance recall when were those features added? This way we can properly limit the minimum supported version of TaylorSeries in the extension |
If I'm not mistaken I think those features were added in v0.15 though perhaps it'd be better if @lbenet can confirm this. |
We would have to take a deeper look at the code, but I think a way forward could be to add in-place |
Indeed, the minimum required version of TaylorSeries for |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #48 +/- ##
==========================================
- Coverage 97.93% 97.21% -0.72%
==========================================
Files 26 27 +1
Lines 2466 2481 +15
==========================================
- Hits 2415 2412 -3
- Misses 51 69 +18 ☔ View full report in Codecov by Sentry. |
Ok, I think that this would anyway involve some work on Ephemerides.jl. In short, speaking about the most relevant format (type 2/3), we now basically read the data from the binary file and create an interpolation cache. In this cache, we store both the binary data and some intermediate results that are associated with the independent variable (so, on Taylor1 in this case). So I would foresee at least the following steps on the way forward:
|
About point 1, the place to look would be About point 2, in the Ephemerides.jl/src/interp/chebyshev.jl Line 20 in 9d0766d
Is the |
@andreapasquale94 I think this pull request is ready to be merged as soon as the last test errors are fixed. I also had to add an additional function For the errors, I would just like a small confirmation from @PerezHz, assuming I want to compute the value of a function and its derivative at time julia> t = Taylor1(5)
1.0 t + 𝒪(t⁶)
julia> x = fcn(t + 54)
julia> evaluate(x)
julia> evaluate(differentiate(x)) If so, the current errors can easily be solved by reducing the test tolerances. |
The The second reason is to introduce compatibility with ForwardDiff. Indeed, you can see the
To conclude the previous sentence, the eltype of I think it might be worth to spend a little bit more time on thinking whether a better design of this cache could more easily support different differentiation backends because, please correct me if I'm wrong, but I don't see many use cases in which one would use both TaylorSeries and ForwardDiff. |
To answer your question @MicheleCeresoli if you have a function |
I mean you probably could find a way to do it, but yeah I don't think it's a very common use case right now to combine TaylorSeries with ForwardDiff (and if it turns out to be that case can be tackled later on). |
Hey, just found out that the current dispatches don't work with TaylorSeries mixtures (but can be included easily): dq = get_variables()
time = Taylor1([dq[1], one(dq[1])])
ephem_vector3(eph_spk, 3, 399, time) # throws error I'll post a suggestion in a bit |
SPKSegmentHeader1, SPKSegmentHeader5, SPKSegmentHeader9, | ||
SPKSegmentHeader14, SPKSegmentHeader18 | ||
|
||
using TaylorSeries: constant_term, Taylor1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using TaylorSeries: constant_term, Taylor1 | |
using TaylorSeries: constant_term, Taylor1, AbstractSeries |
This is to introduce TaylorSeries.jl interoperability.