Skip to content

Commit

Permalink
Merge d9ef18b into b1697ac
Browse files Browse the repository at this point in the history
  • Loading branch information
lbenet authored Mar 13, 2024
2 parents b1697ac + d9ef18b commit 1c54e7a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 26 deletions.
7 changes: 5 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ TaylorSeries = "6aa5eb33-94cf-58f4-a9d0-e4b2c4fc25ea"
[compat]
IntervalArithmetic = "^0.20"
IntervalRootFinding = "0.5"
LinearAlgebra = "<0.0.1, 1"
Markdown = "<0.0.1, 1"
RecipesBase = "1"
Reexport = "1"
TaylorIntegration = "0.11"
TaylorSeries = "0.13, 0.14"
TaylorIntegration = "0.15"
TaylorSeries = "0.17"
Test = "<0.0.1, 1"
julia = "1"

[extras]
Expand Down
19 changes: 7 additions & 12 deletions src/validatedODEs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -809,14 +809,11 @@ function validated_integ(f!, X0, t0::T, tmax::T, orderQ::Int, orderT::Int, absto
parse_eqs, rv = TI._determine_parsing!( parse_eqs, f!, t, x, dx, params)
@assert parse_eqs == parse_eqsI

# Re-initialize the Taylor1 expansions
t = t0 + Taylor1( T, orderT )
tI = t0 + Taylor1(T, orderT+1)
initialize!(X0, orderQ, orderT, x, xI)
f!(dx, x, params, t)
f!(dxI, xI, params, tI)

if parse_eqs
# Re-initialize the Taylor1 expansions
t = t0 + Taylor1(T, orderT )
tI = t0 + Taylor1(T, orderT+1)
initialize!(X0, orderQ, orderT, x, xI)
return _validated_integ!(f!, t0, tmax, orderT, x, dx, rv, xI, dxI, rvI,
abstol, params, maxsteps, adaptive, minabstol, absorb, check_property)
else
Expand Down Expand Up @@ -1257,12 +1254,10 @@ function validated_integ2(f!, X0, t0::T, tmax::T, orderQ::Int, orderT::Int,
# Determine if specialized jetcoeffs! method exists (built by @taylorize)
parse_eqs, rv = TI._determine_parsing!(parse_eqs, f!, t, x, dx, params)

# Re-initialize the Taylor1 expansions
t = t0 + Taylor1( T, orderT )
initialize!(X0, orderQ, orderT, x)
f!(dx, x, params, t)

if parse_eqs
# Re-initialize the Taylor1 expansions
t = t0 + Taylor1( T, orderT )
initialize!(X0, orderQ, orderT, x)
return _validated_integ2!(f!, t0, tmax, orderT, x, dx, rv,
abstol, params, maxsteps, adaptive, minabstol, absorb,
validatesteps, ε, δ, absorb_steps)
Expand Down
9 changes: 4 additions & 5 deletions test/RTM1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const α_mid = TaylorModels.α_mid

setformat(:full)


function check_containment(ftest, tma::T) where {T<:Union{TaylorModel1, RTaylorModel1}}
x0 = expansion_point(tma)
xfp = diam(domain(tma))*(rand()-0.5) + mid(x0)
Expand Down Expand Up @@ -145,7 +144,7 @@ end
δq0 = IntervalBox(-0.1 .. 0.1, Val(1))
qaux = normalize_taylor(q0[1] + TaylorN(1, order=orderQ), δq0, true)
symIbox = IntervalBox(-1 .. 1, Val(1))
t = Taylor1([qaux, 1], orderT)
t = Taylor1([qaux, one(qaux)], orderT)
dom = -0.5 .. 0.5
x00 = mid(dom)

Expand All @@ -167,7 +166,7 @@ end
@test h(tt) fgTM1(dom-x00)(symIbox)
end

t = Taylor1([1, qaux], orderT)
t = Taylor1([one(qaux), qaux], orderT)
tm = RTaylorModel1(deepcopy(t), 0 .. 0, x00, dom)
fgTM1 = f(tm) / g(tm)
@test !isentire(remainder(fgTM1))
Expand All @@ -181,7 +180,7 @@ end
# Testing integration
@test integrate(tm, symIbox) == RTaylorModel1(integrate(t), 0..0, x00, dom)
@test integrate(f(tm), symIbox) == RTaylorModel1(integrate(f(t)), 0..0, x00, dom)
t = Taylor1([qaux,1], orderT)
t = Taylor1([qaux, one(qaux)], orderT)
tm = RTaylorModel1(deepcopy(t), -0.25 .. 0.25, x00, dom)
@test integrate(tm, symIbox) == RTaylorModel1(integrate(t),
remainder(tm)*(domain(tm)-expansion_point(tm))/(orderT+2), x00, dom)
Expand Down Expand Up @@ -334,7 +333,7 @@ end
symIbox = IntervalBox(-1 .. 1, 1)
δq0 = IntervalBox(-0.2 .. 0.2, 1)
qaux = normalize_taylor(TaylorN(1, order=orderQ) + q0[1], δq0, true)
xT = Taylor1([qaux, 1], orderT)
xT = Taylor1([qaux, one(qaux)], orderT)
tm = RTaylorModel1(deepcopy(xT), 0 .. 0, x00, dom)

f(x) = sin(x)
Expand Down
13 changes: 6 additions & 7 deletions test/TM1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const α_mid = TaylorModels.α_mid

setformat(:full)


function check_containment(ftest, tma::T) where {T<:Union{TaylorModel1, RTaylorModel1}}
x0 = expansion_point(tma)
xfp = diam(domain(tma))*(rand()-0.5) + mid(x0)
Expand Down Expand Up @@ -160,7 +159,7 @@ end
δq0 = IntervalBox(-0.1 .. 0.1, Val(1))
qaux = normalize_taylor(q0[1] + TaylorN(1, order=orderQ), δq0, true)
symIbox = IntervalBox(-1 .. 1, Val(1))
t = Taylor1([qaux, 1], orderT)
t = Taylor1([qaux, one(qaux)], orderT)
dom = 0 .. 1
x00 = mid(dom)

Expand All @@ -182,7 +181,7 @@ end
@test h(tt) fgTM1(dom-x00)(symIbox)
end

t = Taylor1([1, qaux], orderT)
t = Taylor1([one(qaux), qaux], orderT)
tm = TaylorModel1(deepcopy(t), 0 .. 0, x00, dom)
fgTM1 = f(tm) / g(tm)
@test !isentire(remainder(fgTM1))
Expand All @@ -196,15 +195,15 @@ end
# Testing integration
@test integrate(tm, symIbox) == TaylorModel1(integrate(t), 0..0, x00, dom)
@test integrate(f(tm), symIbox) == TaylorModel1(integrate(f(t)), 0..0, x00, dom)
t = Taylor1([qaux,1], orderT)
t = Taylor1([qaux,one(qaux)], orderT)
tm = TaylorModel1(deepcopy(t), -0.25 .. 0.25, x00, dom)
@test integrate(tm, symIbox) == TaylorModel1(integrate(t),
remainder(tm)*(domain(tm)-expansion_point(tm)), x00, dom)

# Changing order of a TM1 with TaylorN coeffs
t = Taylor1([qaux, 1], orderT)
t = Taylor1([qaux, one(qaux)], orderT)
tm = TaylorModel1(deepcopy(t), 0 .. 0, x00, dom) # order 4
t8 = Taylor1([qaux, 1], 2*orderT)
t8 = Taylor1([qaux, one(qaux)], 2*orderT)
tm8 = TaylorModel1(deepcopy(t8), 0 .. 0, x00, dom)
tm4, _ = TaylorSeries.fixorder(tm8, tm)
@test get_order(tm4) == get_order(tm)
Expand Down Expand Up @@ -364,7 +363,7 @@ end
symIbox = IntervalBox(-1 .. 1, 1)
δq0 = IntervalBox(-0.2 .. 0.2, 1)
qaux = normalize_taylor(TaylorN(1, order=orderQ) + q0[1], δq0, true)
xT = Taylor1([qaux, 1], orderT)
xT = Taylor1([qaux, one(qaux)], orderT)
tm = TaylorModel1(deepcopy(xT), 0 .. 0, x00, dom)

f(x) = sin(x)
Expand Down

0 comments on commit 1c54e7a

Please sign in to comment.