Skip to content Skip to sidebar Skip to footer

How To Insert List In A Ode:

I am trying to numerically solve the following ODE with boundary conditions y(x=0)=0;y(x=20)=1 Where f(x) is the solution of another ODE that I already solved numerically. I am t

Solution 1:

The best way is to solve the coupled system, that is to integrate the DE for f at the same time as the current DE. If this is a variant of your previous problem on math.SE then this coupled approach is unavoidable.

As for the literal solution, use interpolation

deff(x): return numpy.interp(x, x_samples, f_samples)

and then call this function in the ODE function

defy_ODE(x,y): return [y[1], -0.5*f(x)*y[1]]

Post a Comment for "How To Insert List In A Ode:"