Python Can Python scipy.optimize.fmin() Optimize More Than One Variable at Once?

  • Thread starter Thread starter dacruick
  • Start date Start date
  • Tags Tags
    Python
AI Thread Summary
The discussion centers on optimizing a function with multiple variables in Python, specifically using the SciPy library. The user encounters a TypeError indicating that the function's arguments must be a sequence. The function defined, `optimizefunction`, takes three parameters but is only provided with one when called. To resolve the error, it's essential to pass the additional variables correctly as a sequence, typically using a tuple. The correct usage of `scipy.optimize.fmin` requires ensuring that all parameters are included in the optimization call. This highlights the importance of understanding function argument handling in Python when performing multi-variable optimization.
dacruick
Messages
1,038
Reaction score
1
Hi All,

I am trying to optimize for more than 1 variable at the same time. is that possible?
 
Technology news on Phys.org
I am trying to use this properly but I keep getting the same error.

TypeError: optimizefunction() argument after * must be a sequence

def optimizefunction(x,y,z):
x=5

return abs(x-y*z)

print scipy.optimize.fmin(optimizefunction, 2, (y,z))
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
Back
Top