Skip to content

Commit

Permalink
conversion from ChebyshevT; close issue #372 (#373)
Browse files Browse the repository at this point in the history
* conversion from ChebyshevT; close issue #372

* doctest fix
  • Loading branch information
jverzani authored Dec 23, 2021
1 parent ecad0cc commit 687d788
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "Polynomials"
uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
license = "MIT"
author = "JuliaMath"
version = "2.0.19"
version = "2.0.20"

[deps]
Intervals = "d8418881-c3e1-53bb-8760-2df7ec849ed5"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/polynomials/chebyshev.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ChebyshevT(1⋅T_0(x) + 3⋅T_2(x) + 4⋅T_3(x))
julia> p = convert(Polynomial, c)
Polynomial(-2.0 - 12.0*x + 6.0*x^2 + 16.0*x^3)
Polynomial(-2 - 12*x + 6*x^2 + 16*x^3)
julia> convert(ChebyshevT, p)
ChebyshevT(1.0⋅T_0(x) + 3.0⋅T_2(x) + 4.0⋅T_3(x))
Expand Down
3 changes: 2 additions & 1 deletion src/polynomials/ChebyshevT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ end
@register ChebyshevT

function Base.convert(P::Type{<:Polynomial}, ch::ChebyshevT)
T = eltype(P)

T = _eltype(P,ch)
X = indeterminate(P,ch)
Q = (P){T,X}

Expand Down
10 changes: 8 additions & 2 deletions test/ChebyshevT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ end
# issue 326 evaluate outside of domain
@test Polynomials.evalpoly(2, c1, false) fn(2)
@test Polynomials.evalpoly(3, c1, false) fn(3)

# GCD
c1 = ChebyshevT([1, 2, 3])
c2 = ChebyshevT([3, 2, 1])
Expand Down Expand Up @@ -221,6 +221,12 @@ end
# issue #295
x = BigFloat[-2/3, -1/3, 1/3, 2/4]
y = BigFloat[1, 2, 3, 4]
fit(ChebyshevT, x, y, 1)
fit(ChebyshevT, x, y, 1)

# issue #372
xs = [0,0,1]
@test eltype(convert(Polynomial, ChebyshevT{Float64}(xs))) == Float64
@test eltype(convert(Polynomial, ChebyshevT{BigFloat}(xs))) == BigFloat
@test eltype(convert(Polynomial{BigFloat}, ChebyshevT(xs))) == BigFloat

end

2 comments on commit 687d788

@jverzani
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/51149

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.0.20 -m "<description of version>" 687d7886eda948bf23cc83f1f04283a614cfb413
git push origin v2.0.20

Please sign in to comment.