Skip to content

Commit 9bb0b11

Browse files
authored
Fix minor bugs (#399)
* Fix issues 397 and 398 * Add tests (iss 398) * Bump patch version
1 parent 437f2e0 commit 9bb0b11

4 files changed

Lines changed: 8 additions & 5 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "TaylorSeries"
22
uuid = "6aa5eb33-94cf-58f4-a9d0-e4b2c4fc25ea"
3-
version = "0.21.1"
3+
version = "0.21.2"
44
repo = "https://github.com/JuliaDiff/TaylorSeries.jl.git"
55

66
[deps]

src/other_functions.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ for T in (:Taylor1, :HomogeneousPolynomial, :TaylorN)
1010

1111
## real, imag, conj and ctranspose ##
1212
for f in (:real, :imag, :conj)
13-
@eval ($f)(a::$T) = $T($f(a.coeffs))
13+
@eval ($f)(a::$T) = $T($f(a.coeffs), get_order(a))
1414
end
1515

1616
@eval adjoint(a::$T) = conj(a)
@@ -29,7 +29,7 @@ for op in (:mod, :rem)
2929
function ($op)(a::$T{T}, x::T) where {T<:Real}
3030
coeffs = copy(a.coeffs)
3131
@inbounds coeffs[1] = ($op)(constant_term(a), x)
32-
return $T(coeffs)
32+
return $T(coeffs, get_order(a))
3333
end
3434

3535
function ($op)(a::$T{T}, x::S) where {T<:Real,S<:Real}
@@ -74,7 +74,7 @@ for T in (:Taylor1, :TaylorN)
7474
function mod2pi(a::$T{T}) where {T<:Real}
7575
coeffs = copy(a.coeffs)
7676
@inbounds coeffs[1] = mod2pi( constant_term(a) )
77-
return $T(coeffs)
77+
return $T(coeffs, get_order(a))
7878
end
7979

8080
function abs(a::$T{T}) where {T<:Real}

src/parameters.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function set_variables(::Type{R}, names::T; order=get_order(), numvars=-1) where
188188

189189
if length(variable_names) == 1 && numvars 1
190190
name = variable_names[1]
191-
variable_names = string.("x", TS.subscriptify.(1:numvars))
191+
variable_names = string.(name, TS.subscriptify.(1:numvars))
192192
end
193193

194194
return set_variables(R, variable_names, order=order)

test/manyvariables.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ using Test
3131
@test TS.index_table[2][1] == 3^65
3232
@test TS.pos_table[2][3^64] == 2
3333

34+
@test eltype(set_variables("a", order=1, numvars=2)) == TaylorN{Float64}
35+
@test TS._params_TaylorN_.variable_names[1] == "a₁"
36+
@test TS._params_TaylorN_.variable_symbols[2] == :a₂
3437
@test eltype(set_variables(Int, "x", numvars=2, order=6)) == TaylorN{Int}
3538
@test eltype(set_variables("x", numvars=2, order=6)) == TaylorN{Float64}
3639
@test eltype(set_variables(BigInt, "x y", order=6)) == TaylorN{BigInt}

0 commit comments

Comments
 (0)