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 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Back
Top