@@ -52,7 +52,7 @@ function ps_matrix_inv(
52
52
power_series_ring = base_ring (parent (M))
53
53
result = map (a -> power_series_ring (a), Base. inv (const_term))
54
54
cur_prec = 1
55
- while cur_prec <= prec
55
+ while cur_prec < prec
56
56
result = _matrix_inv_newton_iteration (M, result)
57
57
cur_prec *= 2
58
58
end
@@ -161,7 +161,7 @@ function ps_matrix_homlinear_de(
161
161
(one (parent (A)) + gen (ps_ring) * truncate_matrix (A, cur_prec)) *
162
162
map (e -> truncate (ps_ring (e), cur_prec), Y0)
163
163
Z = map (e -> truncate (ps_ring (e), cur_prec), Base. inv (Y0))
164
- while cur_prec <= prec
164
+ while cur_prec < prec
165
165
matrix_set_precision! (Y, 2 * cur_prec)
166
166
matrix_set_precision! (Z, cur_prec)
167
167
Y, Z = _matrix_homlinear_de_newton_iteration (A, Y, Z, cur_prec)
@@ -239,8 +239,7 @@ function ps_ode_solution(
239
239
Svconst = AbstractAlgebra. matrix_space (base_ring (ring), n, 1 )
240
240
eqs = Sv (equations)
241
241
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)))
244
243
x_dot_vars = [str_to_var (var_to_str (x) * " _dot" , ring) for x in x_vars]
245
244
246
245
Jac_dots = S ([derivative (p, xd) for p in equations, xd in x_dot_vars])
@@ -260,14 +259,14 @@ function ps_ode_solution(
260
259
end
261
260
262
261
cur_prec = 1
263
- while cur_prec <= prec
262
+ while cur_prec < prec
264
263
@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)
266
265
for i in 1 : length (x_vars)
267
266
set_precision! (solution[x_vars[i]], new_prec)
268
267
set_precision! (solution[x_dot_vars[i]], new_prec)
269
268
end
270
- eval_point = [solution[v] for v in gens (ring)]
269
+ eval_point = [copy ( solution[v]) for v in gens (ring)]
271
270
map (ps -> set_precision! (ps, 2 * cur_prec), eval_point)
272
271
eqs_eval = map (p -> evaluate (p, eval_point), eqs)
273
272
J_eval = map (p -> evaluate (p, eval_point), Jac_xs)
0 commit comments