I wanted to use odeint of scipy with a function
def func(y,t,a=123,b=456)
then use it as
odeint(func,y0,t)
If I want to change the values a and b using args
odeint(func,y0,t,args=(a=1,b=2))
It complains that arguments are not tuple. It may be a very elementary question, how can I pass keyword arguments as a tuple?
odeint(func,y0,t,args=...?)
You just need to remove the assignments to make a legit tuple:
odeint(func,y0,t,args=(123, 456))
There's another answer here with an example of calling odeint with arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With