Skip to content

Commit cd4d473

Browse files
committed
fixing mysterious power series bug
1 parent 6b89d4a commit cd4d473

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

src/ODE.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ end
241241
Input: ode is an ODE over QQ, p is a prime number
242242
Output: the reduction mod p, throws an exception if p divides one of the denominators
243243
"""
244-
function reduce_ode_mod_p(ode::ODE, p::Int)
244+
function reduce_ode_mod_p(ode::ODE{<:MPolyRingElem{Nemo.QQFieldElem}}, p::Int)
245245
new_ring, new_vars =
246246
Nemo.polynomial_ring(Nemo.Native.GF(p), map(var_to_str, gens(ode.poly_ring)))
247247
new_type = typeof(new_vars[1])

src/parametrizations.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,7 @@ $sat_string
218218
$tagged_mqs
219219
Monom ordering:
220220
$(ord)"""
221-
tagged_mqs_gb = groebner(
222-
tagged_mqs,
223-
ordering = ord,
224-
homogenize = :no,
225-
)
221+
tagged_mqs_gb = groebner(tagged_mqs, ordering = ord, homogenize = :no)
226222
# Relations between tags in K[T]
227223
relations_between_tags = filter(
228224
poly -> isempty(intersect(vars(poly), vcat(sat_var, orig_vars))),

src/power_series_utils.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function ps_matrix_inv(
5252
power_series_ring = base_ring(parent(M))
5353
result = map(a -> power_series_ring(a), Base.inv(const_term))
5454
cur_prec = 1
55-
while cur_prec <= prec
55+
while cur_prec < prec
5656
result = _matrix_inv_newton_iteration(M, result)
5757
cur_prec *= 2
5858
end
@@ -161,7 +161,7 @@ function ps_matrix_homlinear_de(
161161
(one(parent(A)) + gen(ps_ring) * truncate_matrix(A, cur_prec)) *
162162
map(e -> truncate(ps_ring(e), cur_prec), Y0)
163163
Z = map(e -> truncate(ps_ring(e), cur_prec), Base.inv(Y0))
164-
while cur_prec <= prec
164+
while cur_prec < prec
165165
matrix_set_precision!(Y, 2 * cur_prec)
166166
matrix_set_precision!(Z, cur_prec)
167167
Y, Z = _matrix_homlinear_de_newton_iteration(A, Y, Z, cur_prec)
@@ -239,8 +239,7 @@ function ps_ode_solution(
239239
Svconst = AbstractAlgebra.matrix_space(base_ring(ring), n, 1)
240240
eqs = Sv(equations)
241241

242-
x_vars = filter(v -> ("$(v)_dot" in map(string, gens(ring))), gens(ring))
243-
x_vars = [x for x in x_vars]
242+
x_vars = collect(filter(v -> ("$(v)_dot" in map(var_to_str, gens(ring))), gens(ring)))
244243
x_dot_vars = [str_to_var(var_to_str(x) * "_dot", ring) for x in x_vars]
245244

246245
Jac_dots = S([derivative(p, xd) for p in equations, xd in x_dot_vars])
@@ -260,14 +259,14 @@ function ps_ode_solution(
260259
end
261260

262261
cur_prec = 1
263-
while cur_prec <= prec
262+
while cur_prec < prec
264263
@debug "\t Computing power series solution, currently at precision $cur_prec"
265-
new_prec = min(prec + 1, 2 * cur_prec)
264+
new_prec = min(prec, 2 * cur_prec)
266265
for i in 1:length(x_vars)
267266
set_precision!(solution[x_vars[i]], new_prec)
268267
set_precision!(solution[x_dot_vars[i]], new_prec)
269268
end
270-
eval_point = [solution[v] for v in gens(ring)]
269+
eval_point = [copy(solution[v]) for v in gens(ring)]
271270
map(ps -> set_precision!(ps, 2 * cur_prec), eval_point)
272271
eqs_eval = map(p -> evaluate(p, eval_point), eqs)
273272
J_eval = map(p -> evaluate(p, eval_point), Jac_xs)

src/wronskian.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Computes the Wronskians of io_equations
237237

238238
@debug "Constructing Wronskians"
239239
result = []
240-
for (i, tlist) in enumerate(termlists)
240+
for tlist in termlists
241241
n = length(tlist)
242242
evaled = massive_eval(tlist, ps_ext)
243243
S = Nemo.matrix_space(F, n, n)

0 commit comments

Comments
 (0)