Skip to content

Commit 91aa07b

Browse files
authored
to_python(n_evaluation=True)-> eval_N(...).to_python() (#640)
Following the comment #559 (comment) this is the part that is the not-polemic part of #559 <a href="https://gitpod.io/#https://github.com/Mathics3/mathics-core/pull/640"><img src="https://gitpod.io/button/open-in-gitpod.svg"/></a>
1 parent 89bcbee commit 91aa07b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

mathics/algorithm/optimizers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ def find_root_secant(f, x0, x, opts, evaluation) -> (Number, bool):
202202
return x0, False
203203
if not isinstance(f1, Number):
204204
return x0, False
205-
f0 = f0.to_python(n_evaluation=True)
206-
f1 = f1.to_python(n_evaluation=True)
205+
f0 = eval_N(f0, evaluation).to_python()
206+
f1 = eval_N(f1, evaluation).to_python()
207207
count = 0
208208
while count < maxit:
209209
if f0 == f1:
@@ -224,7 +224,7 @@ def find_root_secant(f, x0, x, opts, evaluation) -> (Number, bool):
224224
)
225225
if not isinstance(f1, Number):
226226
return x0, False
227-
f1 = f1.to_python(n_evaluation=True)
227+
f1 = eval_N(f1, evaluation).to_python()
228228
continue
229229

230230
inv_deltaf = from_python(1.0 / (f1 - f0))

0 commit comments

Comments
 (0)