JuliaMath / JuliaMath/Polynomials.jl
Use of Measurements.jl values works in some cases and fails in others.
- Dominant language
- Julia
- Stars
- 320
- Forks
- 80
- Avg merge
- 8h 46m
- Merged PRs (30d)
- 3
Description
Hi!
When using Measurement types, Polynomials plays nicely with Measurements.jl until the polynomials get large enough / complicated enough in fitting that Vandermonde is used. Is there any way to skip this and use a nieve fitting method when I'm needing to use these types to propagate error?
Working minimal example: You will find that the following works
```Julia
julia> Polynomials.fit([1, 2, 3] .± 0.3, [4, 5, 6.3].±0.2, 2)
> Polynomials.Polynomial(3.3 ± 1.6 + 0.55 ± 1.9*x + 0.15 ± 0.49*x^2)
```
and this will not
```Julia
julia> Polynomials.fit([1, 2, 3] .± 0.3, [4, 5, 6.3].±0.2, 4)
ERROR: MethodError: no method matching Float64(::Measurement{Float64})
Closest candidates are:
(::Type{T})(::Real, ::RoundingMode) where T<:AbstractFloat at rounding.jl:200
(::Type{T})(::T) where T<:Number at boot.jl:772
(::Type{T})(::AbstractChar) where T<:Union{AbstractChar, Number} at char.jl:50
...
Stacktrace:
[1] convert(#unused#::Type{Float64}, x::Measurement{Float64})
@ Base .\number.jl:7
[2] setindex!(A::Vector{Float64}, x::Measurement{Float64}, i1::Int64)
@ Base .\array.jl:966
[3] vander(P::Type{Polynomials.Polynomial}, x::Vector{Measurement{Float64}}, degs::UnitRange{Int64})
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.