Trying to resolve a BVProblem

Hello dear all,

I am currently trying to resolve a BVProblem. Thus I came back to an example given in the Boundary Value Problems section.
If I use the code as follows:

using BoundaryValueDiffEq
using OrdinaryDiffEq, Plots

const g = 9.81
L = 1.0
tspan = (0.0,pi/2)

function simplependulum(t,u,du)
    θ  = u[1]
    dθ = u[2]
    du[1] = dθ
    du[2] = -(g/L)*sin(θ)
end

function bc(residual, ua, ub)              # ua = beginning of time span, ub = end
    residual[1] = ua[1] + pi/2             # solution at the beginning of time span (-pi/2)
    residual[2] = ub[1] - pi/2             # solution at the end of time span should (pi/2)
end

bvp = TwoPointBVProblem(simplependulum, bc, [pi/2,pi/2], tspan)
sol = solve(bvp, MIRK4(), dt=0.05)        
plot(sol)

I obtain an error related to:

sol = solve(bvp, MIRK4(), dt=0.05)  
LoadError: MethodError: no method matching simplependulum(::Array{Float64,1}, ::Array{Float64,1}, ::DiffEqBase.NullParameters, ::Float64)

May I ask you some help?
Thank you in advance,

Thierry

You’re looking at old docs (v3.2, so about 3 years ago). Take a look at the latest: https://docs.sciml.ai/latest/tutorials/bvp_example/

1 Like

It is perfectly right. :wink:
Many thanks for this remark. On the right way now.
Have a good day.
Thierry