Skip to content

Commit 72b8557

Browse files
authored
Merge pull request AllenDowney#16 from Bogidon/bogdan/fsolve-array
Update fsolve to work with arrays
2 parents a490985 + 5541863 commit 72b8557

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

code/modsim.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ def fsolve(func, x0, *args, **kwargs):
347347
returns: solution as an array
348348
"""
349349
# make sure we can run the given function with x0
350+
x0 = np.asarray(x0).flatten()
351+
350352
try:
351353
func(x0, *args)
352354
except Exception as e:

0 commit comments

Comments
 (0)