Polynomials.fit changes behavior somewhere between (inclusive) Julia 1.7.3 and Julia 1.10.4, the latter being self-inconsistent (problematic)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- julia
- Domain
- backend-api-design
Research direction
Start with the Polynomials.fit entry point and reproduce the supplied MWE on the reported Julia versions. Compare the returned coefficient lengths and identify the version-dependent behavior; done means the degree argument has consistent, documented coefficient-count behavior or the discrepancy is explained.
Written by the indexing model from the issue text.
Description
This is my first issue report, so please forgive me if I "didn't get the memo" about this finding at some earlier date, but it's quite simple and shouldn't waste much time in the worst-case:
In Julia 1.7.3, Polynomials.fit with the third input argument ("deg"), i.e., the degree of the polynomial desired, of value x always returns a Polynomial of x+1 number of coefficients.
In Julia 1.10.4, Polynomials.fit with the third input argument ("deg") of value x ALMOST always returns a Polynomial of x+1 number of coefficients.
MWE (note the difference in one of the returns between the two code blocks with the same two Polynomial.fit commands run in the two Julia versions):
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.7.3 (2022-05-06)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using Polynomials
julia> x=-2:1
-2:1
julia> y=[0.0360126786947437, 0.020007043719302054, 0.0360126786947437, 0.020007043719302054]
4-element Vector{Float64}:
0.0360126786947437
0.020007043719302054
0.0360126786947437
0.020007043719302054
julia> Polynomials.fit(x,y,2).coeffs
3-element Vector{Float64}:
0.026409297709478707
-0.0032011269950883254
6.640921040373548e-19
julia> y=[0.00361, 0.00201, 0.00361, 0.00201]
4-element Vector{Float64}:
0.00361
0.00201
0.00361
0.00201
julia> Polynomials.fit(x,y,2).coeffs
3-element Vector{Float64}:
0.00265
-0.00031999999999999976
-2.926366747177586e-19
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.10.4 (2024-06-04)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using Polynomials
julia> x=-2:1
-2:1
julia> y=[0.0360126786947437, 0.020007043719302054, 0.0360126786947437, 0.020007043719302054]
4-element Vector{Float64}:
0.0360126786947437
0.020007043719302054
0.0360126786947437
0.020007043719302054
julia> Polynomials.fit(x,y,2).coeffs
2-element Vector{Float64}:
0.026409297709478707
-0.0032011269950883254
julia> y=[0.00361, 0.00201, 0.00361, 0.00201]
4-element Vector{Float64}:
0.00361
0.00201
0.00361
0.00201
julia> Polynomials.fit(x,y,2).coeffs
3-element Vector{Float64}:
0.00265
-0.0003199999999999998
-2.5554890278056236e-19
- Dominant language
- Julia
- Stars
- 321
- Forks
- 81
- Avg merge
- 10h 1m
- Merged PRs (30d)
- 5
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaMath/Polynomials.jl
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
JuliaMath/Polynomials.jl#647 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
JuliaMath/Polynomials.jl#641 ·
-
tagbot-manual
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
JuliaMath/Polynomials.jl#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 38/100
JuliaMath/Polynomials.jl#620 · 6 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
JuliaMath/Polynomials.jl#585 · 7 comments ·
All issues in JuliaMath/Polynomials.jl
Similar issues
-
bignums
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JuliaNLSolvers/NLsolve.jl#319 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
gridap/GridapPETSc.jl#129 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100