Skip to content

Commit

Permalink
Add TaylorN constructor (#355)
Browse files Browse the repository at this point in the history
* Add TaylorN constructor

* Bump patch version

* Remove some tests added by mistake

* Add test suggested by @lbenet
  • Loading branch information
PerezHz committed Apr 17, 2024
1 parent 87116db commit 3a7360f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TaylorSeries"
uuid = "6aa5eb33-94cf-58f4-a9d0-e4b2c4fc25ea"
repo = "https://github.com/JuliaDiff/TaylorSeries.jl.git"
version = "0.17.4"
version = "0.17.5"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
3 changes: 2 additions & 1 deletion src/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,6 @@ const NumberNotSeries = Union{Real,Complex}
# A `Number` which is not `TaylorN` nor a `HomogeneousPolynomial`
const NumberNotSeriesN = Union{Real,Complex,Taylor1}

## Additional Taylor1 outer constructor ##
## Additional Taylor1 and TaylorN outer constructor ##
Taylor1{T}(x::S) where {T<:Number,S<:NumberNotSeries} = Taylor1([convert(T,x)], 0)
TaylorN{T}(x::S) where {T<:Number,S<:NumberNotSeries} = TaylorN(convert(T, x), TaylorSeries.get_order())
7 changes: 7 additions & 0 deletions test/manyvariables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ using Test
# using LinearAlgebra

@testset "Test hash tables" begin
a = TaylorN{Float64}(9//10)
a isa TaylorN{Float64}
@test constant_term(a) == Float64(9//10)
b = TaylorN{Complex{Float64}}(-4//7im)
@test b isa TaylorN{Complex{Float64}}
@test_throws MethodError TaylorN(-4//7im)
# Issue #85 is solved!
set_variables("x", numvars=66, order=1)
@test TS._params_TaylorN_.order == get_order() == 1
Expand Down Expand Up @@ -791,6 +797,7 @@ end
@test float(HomogeneousPolynomial{Complex{Int}}) == float(HomogeneousPolynomial{Complex{Float64}})
@test float(TaylorN{Complex{Rational}}) == float(TaylorN{Complex{Float64}})
end

end

@testset "Integrate for several variables" begin
Expand Down

2 comments on commit 3a7360f

@lbenet
Copy link
Member

@lbenet lbenet commented on 3a7360f Apr 23, 2024

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/105487

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

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 v0.17.5 -m "<description of version>" 3a7360f80fa83a8de723b87b7d437dd46f5484f0
git push origin v0.17.5

Please sign in to comment.