The function that I am using for solve_ivp is defined as:
def ydot(t,y,kappa4,kappa16):
Upon using solve_ivp as below:
sol=solve_ivp(ydot,[0,10],initial_condition(),args=(50,100))
I get the following error:
ydot() missing 2 required positional arguments: 'kappa4' and 'kappa16'
I am not able debug the code even though I have defined the function ydot the way scipy documentation for solve_ivp defines (https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.html)
There's even an example in the end of the documentation that demonstrates the passing of arguments implemented in the same way as I have done.
I believe the problem is somewhere in the two above pieces of the code I have provided from an otherwise long code.
I was able to replicate the error with scipy 1.1.0 .
Upgrading scipy to the latest version via cmd (pip install scipy==1.4.1) solved that error message for me.
Then the minimal reproducible example gave another error:
TypeError: ydot() argument after * must be an iterable, not int
Which was solved by the solution given by Tejas. The full working minimal script is hence:
from scipy.integrate import solve_ivp
def ydot(t,y,a): return -a*y
sol=solve_ivp(ydot,[0,10],[5],args=(8,))
print(sol.y)
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