# BVProblem MethodError

Hi, I’m new to JULIA. I am trying to solve a system of differential equations, but I get the same error “MethodError: no method matching diffeq! (:: Vector {Float64}, :: Vector {Float64}, :: SciMLBase .NullParameters, :: Float64)”

this is the system of equations, and this is my code:

Blockquote

``````E = 200e9     # Pa
A = (0.01)^2  # m^2

L = (0.0,2)   # m   length beam
b = 1000      # N/m
P = 250       # N

EE(x) = E
AA(x) = A
bb(x) = b

function diffeq!(x,y)

dy = zeros(2,1)

dy[1] = y[2]/EE(x)*AA(x)
dy[2] = -bb(x)

return dy
end
``````

and the conditions are:

``````function bc2!(y1,y)

y1[1]     = 0
y[2]     = P

end

bvp2 = BVProblem(diffeq!, bc2!, [0,0,0,0], L)
sol1 = solve(bvp2, GeneralMIRK4(), dt=0.05)
``````

I need your help, what am I doing wrong ?, I come from MATLAB, and I used bvp4c.

Following the documentation at Boundary Value Problems · DifferentialEquations.jl your implementation should probably look like

``````using DifferentialEquations

E = 200e9     # Pa
A = (0.01)^2  # m^2

L = 2         # m   length beam
b = 1000      # N/m
P = 250       # N

EE(x) = E
AA(x) = A
bb(x) = b

function diffeq!(dy,y,p,x)
dy[1] = y[2]/(EE(x)*AA(x))
dy[2] = -bb(x)
end

function bc!(residual,y,p,x)
residual[1] = y[1][1] - 0
residual[2] = y[end][2] - L
end

bvp = BVProblem(diffeq!, bc!, [0,0], (0.0,L))
sol = solve(bvp, GeneralMIRK4(), dt=0.05)
``````
2 Likes

Thank you very much, it has been of great help

1 Like