scipy.optimize.least_squares for more than one dimension?

Martin Schöön martin.schoon at gmail.com
Sat Jul 8 17:11:22 EDT 2023


Den 2023-06-30 skrev Martin Schöön <martin.schoon at gmail.com>:
> Yesterday I wanted to move from optimize.leastsq to 
> least_squares. I have data depending on four variables
> and want to fit a function in four variables to this
> data. This works with leastsq but not with least_squares.
>
> Am I trying to do something least_squares is not capable
> of?
>
> Disclaimer: I was burning midnight oil...
>
Problem solved.

Yes, least_squares can, of course, handle multi-dimensional situations.

Me burning midnight oil was the problem. I have been tinkering a
bit with scipy.optimize.least_squares tonight. All simple examples
I tried worked regardless of number of dimensions. I went back to
my old code and found a couple of basic mistakes. Done.

/Martin


More information about the Python-list mailing list