Python Forum
SOLVED: scipy.optimize.least_squares problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SOLVED: scipy.optimize.least_squares problem
#2
The error message is clear. The 'least_squares' function expects 'system1' to return a 1-d array_like. Looking in the documentation, it is said that
Quote:The argument x passed to this function is an ndarray of shape (n,) (never a scalar, even for n=1). It must allocate and return a 1-D array_like of shape (m,) or a scalar.

I suggest that you check the shape of the value returned by system1() and raise an exception if it is not a tuple with one element like (m,) to understand the problem.
Reply


Messages In This Thread
RE: scipy.optimize.least_squares problem - by Gribouillis - Mar-06-2022, 10:09 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to optimize analog gauge reader? kadink 0 879 May-19-2023, 08:58 PM
Last Post: kadink
  Using scipy.optimize: curve_fit ju21878436312 0 1,063 Sep-24-2022, 01:15 PM
Last Post: ju21878436312
  Help with Scipy optimize for numerical problem Jbjbjb1 0 1,616 Jun-22-2021, 05:03 AM
Last Post: Jbjbjb1
  scipy.optimize.basinhopping generates unstable output bb19x11 0 1,741 Mar-09-2020, 04:07 PM
Last Post: bb19x11
  Solve a system of non-linear equations in Python (scipy.optimize.fsolve) drudox 7 23,111 Aug-18-2018, 02:27 AM
Last Post: scidam
  minimize with scipy.optimize tobenmoben 0 2,874 Feb-17-2018, 01:47 PM
Last Post: tobenmoben

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020