Skip to content

Commit f5587a7

Browse files
authored
Improve Taylor1{TaylorN{T}} mixtures (#333)
* Add tests for Taylor1{TaylorN{T}} * Add fixorder to Taylor1{TaylorN{T}} * Add methods for arithm opers for Taylor1{TaylorN{T}} * Add methods of ^, sqrt, pow!, sqr!, sqrt! for Taylor1{TaylorN{T} * Add specialized methods for most mutating functions for Taylor1{TaylorN{T}} * Implement suggestions by @PerezHz * Fix error in docs * Use TS * Improvements for evaluate * Clean up commented (old) code * Remove some superfluous methods in evaluate * More fixes * Fixes and clean-up of `evaluate` methods * Returning a zero Homogeneouspolynomial is of order 0 * Scattered fixes and clean up * Fix documentation * Remove evaluate methods for TaylorN with Varargs, and fix tests * Fix _evaluate for mixtures, and new tests * Methods of evaluate for Taylor1 involving TaylorN (fixing certain type instability) * Add tests for new evaluate methods * Bump minor version * Remove a `@show` left there
1 parent 36586d7 commit f5587a7

18 files changed

+1421
-500
lines changed

Project.toml

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

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

docs/src/api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ div!
7777
pow!
7878
square
7979
sqr!
80-
sqr!(::HomogeneousPolynomial{T}, ::HomogeneousPolynomial{T}) where {T<:NumberNotSeriesN}
80+
accsqr!
8181
sqrt!
8282
exp!
8383
log!
@@ -105,6 +105,5 @@ _populate_dicts!
105105

106106
```@index
107107
Pages = ["api.md"]
108-
Module = ["TaylorSeries"]
109108
Order = [:type, :function]
110109
```

ext/TaylorSeriesIAExt.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function ^(a::Taylor1{Interval{T}}, r::S) where {T<:Real, S<:Real}
4141
c_order = l0 == 0 ? a.order : min(a.order, trunc(Int,r*a.order))
4242
c = Taylor1(zero(aux), c_order)
4343
for k = 0:c_order
44-
TaylorSeries.pow!(c, aa, r, k)
44+
TS.pow!(c, aa, r, k)
4545
end
4646

4747
return c
@@ -66,7 +66,7 @@ function ^(a::TaylorN{Interval{T}}, r::S) where {T<:Real, S<:Real}
6666

6767
c = TaylorN( a0r, a.order)
6868
for ord in 1:a.order
69-
TaylorSeries.pow!(c, aa, r, ord)
69+
TS.pow!(c, aa, r, ord)
7070
end
7171

7272
return c
@@ -84,7 +84,7 @@ for T in (:Taylor1, :TaylorN)
8484
aa[0] = one(aux) * a0
8585
c = $T( aux, order )
8686
for k in eachindex(a)
87-
TaylorSeries.log!(c, aa, k)
87+
TS.log!(c, aa, k)
8888
end
8989
return c
9090
end
@@ -101,7 +101,7 @@ for T in (:Taylor1, :TaylorN)
101101
c = $T( aux, order )
102102
r = $T( sqrt(1 - a0^2), order )
103103
for k in eachindex(a)
104-
TaylorSeries.asin!(c, aa, r, k)
104+
TS.asin!(c, aa, r, k)
105105
end
106106
return c
107107
end
@@ -118,7 +118,7 @@ for T in (:Taylor1, :TaylorN)
118118
c = $T( aux, order )
119119
r = $T( sqrt(1 - a0^2), order )
120120
for k in eachindex(a)
121-
TaylorSeries.acos!(c, aa, r, k)
121+
TS.acos!(c, aa, r, k)
122122
end
123123
return c
124124
end
@@ -135,7 +135,7 @@ for T in (:Taylor1, :TaylorN)
135135
c = $T( aux, order )
136136
r = $T( sqrt(a0^2 - 1), order )
137137
for k in eachindex(a)
138-
TaylorSeries.acosh!(c, aa, r, k)
138+
TS.acosh!(c, aa, r, k)
139139
end
140140
return c
141141
end
@@ -152,14 +152,14 @@ for T in (:Taylor1, :TaylorN)
152152
"""Series expansion of atanh(x) diverges at x = ±1."""))
153153

154154
for k in eachindex(a)
155-
TaylorSeries.atanh!(c, aa, r, k)
155+
TS.atanh!(c, aa, r, k)
156156
end
157157
return c
158158
end
159159
end
160160

161161

162-
function evaluate(a::Taylor1, dx::Interval)
162+
function evaluate(a::Taylor1{T}, dx::Interval{S}) where {T<:Real, S<:Real}
163163
order = a.order
164164
uno = one(dx)
165165
dx2 = dx^2
@@ -201,7 +201,7 @@ end
201201
function _evaluate(a::HomogeneousPolynomial, dx::IntervalBox{N,T}, ::Val{true} ) where {T<:Real,N}
202202
a.order == 0 && return a[1] + Interval{T}(0, 0)
203203

204-
ct = TaylorSeries.coeff_table[a.order+1]
204+
ct = TS.coeff_table[a.order+1]
205205
@inbounds suma = a[1]*Interval{T}(0,0)
206206

207207
Ieven = Interval{T}(0,1)

0 commit comments

Comments
 (0)