Skip to main content

All Questions

1 vote
0 answers
239 views

How to plot a function in Python when both variables cannot be isolated to one side

I am trying to graph variable "u" versus variable "T" for 1<T<1000 (integers). However, the function I have includes both of the variables within an integral so I cannot ...
Jonathan Locker's user avatar
0 votes
1 answer
536 views

Finding the parameters of a function via curve fit

I'm trying to estimate the parameters (v, n, k) defined in fit_func. I tried the default least squares fit but I couldn't find the parameters successfully. def fit_func(x, v, n, k): return v * x **...
Natasha's user avatar
  • 1,531
1 vote
1 answer
50 views

Creating multiple functions using a for loop

I am trying to create multiple constraint functions to feed scipy.minimize. The minimize function is: res1 = minimize(f, x0, args, method='SLSQP', bounds=bnds, constraints=cons, options={'disp': True})...
NickData's user avatar
0 votes
0 answers
115 views

Optimization and error "unsupported operand type(s) for -: 'generator' and 'generator'"

I am trying to do (from a math point of view), what is described in the following image (for presentation purpose) : In my code , i took mock values for the experimental and initial guess vector. How ...
Charles's user avatar
  • 25
-1 votes
1 answer
1k views

Find a function maximum with scipy.minimize

I´ve been asigned to find a given fuction´s maximum with scipy.minimize with the BFGS method using lambda. I´ve already figured out that in order to do that, I need to minimize the -(f) function, but ...
Andrés Ortega's user avatar
0 votes
2 answers
473 views

Struggling to minimize loss function

Im looking forward to minimize this function below to estimate the parameters of the normal distribution Function image My code looks like this: import numpy as np from scipy import stats from scipy....
James Shady's user avatar
1 vote
2 answers
1k views

How to define a proper objective function in python for the optimization solver

I need to define an optimization objective function for Scipy SLSQP slover. The difficulties is that the number of independent variables in my objective function is not fixed. I was trying to use the ...
Jian ZUO's user avatar
1 vote
0 answers
111 views

Find the optimal value from a Residual function

I have two functions, f(x), f(x,a) I can plot x-f(x) and x-f(x,a) for a family of a values. Now I want to know for which value of a does the residual becomes minimum, that f(x)~f(x,a) for a will be ...
Ayan Mitra's user avatar
0 votes
1 answer
14 views

Pull non-minimized values out of function being minimized with SciPy.optimize.minimize

I am having trouble pulling out values out of a function that I am trying to optimize. The code looks similar to what follows. I want to minimize c by changing x through scipy.optimize.minimize, but ...
astro_mario's user avatar