Skip to content

Commit a1d3aaf

Browse files
avoid problem with valuation(a,p) if 1st argument is zero
1 parent 3a58821 commit a1d3aaf

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/parametric_problems.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ function ParamRdeSpecialDenomExp(a::P, b::F, gs::Vector{F}, D::Derivation) where
6060
t = gen(parent(a))
6161
degree(gcd(t, a))==0 || error("gcd(a, t) must be == 1")
6262
p = t
63-
nb = valuation(b, p)
64-
nc = minimum([valuation(g, p) for g in gs])
63+
nb = iszero(b) ? typemax(Int) : valuation(b, p)
64+
nc = minimum([iszero(g) ? typemax(Int) : valuation(g, p) for g in gs])
6565
n = min(0, nc - min(0, nb))
6666
if nb==0
6767
α = constant_coefficient(Remainder(-b//a, p))
@@ -109,8 +109,8 @@ function ParamRdeSpecialDenomTan(a::P, b::F, gs::Vector{F}, D::Derivation) where
109109
t = gen(parent(a))
110110
p = t^2+1
111111
degree(gcd(a, p))==0 || error("gcd(a, t^2+1) must be == 1")
112-
nb = valuation(b, p)
113-
nc = minimum([valuation(g, p) for g in gs])
112+
nb = iszero(b) ? typemax(Int) : valuation(b, p)
113+
nc = minimum([iszero(g) ? typemax(Int) : valuation(g, p) for g in gs])
114114
n = min(0, nc - min(0, nb))
115115
if nb==0
116116
αI_plus_β = Remainder(-b//a, p)
@@ -997,7 +997,7 @@ function LimitedIntegrateReduce(f::F, ws::Vector{F}, D::Derivation) where
997997
hs = lcm(vcat(ds, [es for (en, es) in eness]))
998998
h = hn*hs # in Bronsteins's book, wrongly a = hn*hs
999999
b = -D(hn)-divexact(hn*D(hs),hs)
1000-
μ = min(valuation_infinity(f), minimum([valuation_infinity(w) for w in ws]))
1000+
μ = min(iszero(f) ? typemax(Int) : valuation_infinity(f), minimum([iszero(w) ? typemax(Int) : valuation_infinity(w) for w in ws]))
10011001
N = degree(hn) + degree(hs) + max(0, 1 - degree(D) - μ)
10021002
end
10031003
hhn = h*hn

src/risch_diffeq.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ function RdeSpecialDenomExp(a::P, b::F, c::F, D::Derivation) where
218218
t = gen(parent(a))
219219
degree(gcd(t, a))==0 || error("gcd(a, t) must be == 1")
220220
p = t
221-
nb = valuation(b, p)
222-
nc = valuation(c, p)
221+
nb = iszero(b) ? typemax(Int) : valuation(b, p)
222+
nc = iszero(c) ? typemax(Int) : valuation(c, p)
223223
n = min(0, nc - min(0, nb))
224224
if nb==0
225225
α = constant_coefficient(Remainder(-b//a, p))
@@ -264,8 +264,8 @@ function RdeSpecialDenomTan(a::P, b::F, c::F, D::Derivation) where
264264
t = gen(parent(a))
265265
p = t^2+1
266266
degree(gcd(a, p))==0 || error("gcd(a, t^2+1) must be == 1")
267-
nb = valuation(b, p)
268-
nc = valuation(c, p)
267+
nb = iszero(b) ? typemax(Int) : valuation(b, p)
268+
nc = iszero(c) ? typemax(Int) : valuation(c, p)
269269
n = min(0, nc - min(0, nb))
270270
if nb==0
271271
αI_plus_β = Remainder(-b//a, p)
@@ -322,8 +322,8 @@ function RdeSpecialDenomTanI(a::P, b::F, c::F, D::Derivation) where
322322
contains_I(parent(a)) || error("field k must contain I=sqrt(-1)")
323323
I = get_I(base_ring(parent(a)))
324324
p = t-I
325-
nb = valuation(b, p)
326-
nc = valuation(c, p)
325+
nb = iszero(b) ? typemax(Int) : valuation(b, p)
326+
nc = iszero(c) ? typemax(Int) : valuation(c, p)
327327
n = min(0, nc - min(0, nb))
328328
if nb==0
329329
α = constant_coefficient(Remainder(-b//a, p))

src/transcendental_functions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ function IntegrateHypertangentReduced(p::F, D::Derivation) where
329329
end
330330
t = gen(base_ring(parent(p)))
331331
Q = t^2+1
332-
m = -valuation(p, Q)
332+
m = -(iszero(p) ? typemax(Int) : valuation(p, Q))
333333
if m<=0
334334
return Z, 1
335335
end

0 commit comments

Comments
 (0)