As stated in the issue #26332:
My approach to solve this is:
NOTE: my approach would work only for solvers that already exist in solve_ivp like RK45 but for customer solvers passed to ‘method’ argument it will not work.
So, we can just take attributes from solver function in scipy/scipy/integrate/_ivp/ivp.py and store
it in variables
solver = method(fun, t0, y0, tf, vectorized=vectorized, **options)
rtol=solver.rtol
atol=solver.atol
and as for the solver method we can just take the string from the dictionary here:
if method in METHODS:
method = METHODS[method]
One more thing the method=‘LSODA’; did not have any attributes in its class corresponding to rtol and atol so for that we have to create two new attribute , so that we have rtol and atol values accessible on the LSODA solver instance too.
rtol, atol = validate_tol(rtol, atol, self.n)
self.rtol = rtol
self.atol = atol
This is my first time doing open-source contribution, so open to constructive criticism.