[SciPy-User] scipy.integrate.solve_bvp with explicit dependence on independent variable?

Boyan Penkov boyan.penkov at gmail.com
Wed Oct 25 16:01:25 EDT 2017


Hello all,

I am trying to use scipy.integrate.solve_bvp to solve a boundary value
problem of a function in one variable -- $\phi(r)$ --  for a
cylindrical geometry.

The examples here are pretty good:
https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.integrate.solve_bvp.html

However, when casting into a ocupled first-order system, the issue
here is that I have explicit dependence on the independent variable
$r$.

When I write the equivalent of

>>> def fun(x, y):
...     return np.vstack((y[1], -np.exp(y[0])))

, the interpreter promptly replies "TypeError: only length-1 arrays
can be converted to Python scalars" -- this makes sense, since

So, can scipy.integrate.solve_bvp be used in problems where there's an
explicit dependence on $r$, for functions where the right-hand side is
F(dq/dx, q, r)?

Cheers!

-- 
Boyan Penkov


More information about the SciPy-User mailing list