# BVProblem MethodError

**URL:** <https://discourse.julialang.org/t/bvproblem-methoderror/71038>\
**Category:** New to Julia\
**Tags:** question, diffeq, ode\
**Created:** [November 6, 2021, 4:48am UTC](https://discourse.julialang.org/t/bvproblem-methoderror/71038 "2021-11-06T04:48:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sbeltranj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sbeltranj/32/32827_2.png) [@Sbeltranj](https://discourse.julialang.org/u/Sbeltranj)\
**Post date:** [November 6, 2021, 4:48am UTC](https://discourse.julialang.org/t/bvproblem-methoderror/71038/1 "2021-11-06T04:48:51Z")

</div>

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)”

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/3/e3ce913f5ade8c79734fe67a332dfa416a9e1d9f.png)

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

> Blockquote

```julia
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:

```julia
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.

---

<div class="post-metadata">

**Author:** ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)\
**Post date:** [November 6, 2021, 7:16am UTC](https://discourse.julialang.org/t/bvproblem-methoderror/71038/2 "2021-11-06T07:16:44Z")

</div>

Following the documentation at [Boundary Value Problems · DifferentialEquations.jl](https://diffeq.sciml.ai/stable/tutorials/bvp_example/) your implementation should probably look like

```julia
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)

```

---

<div class="post-metadata">

**Author:** ![Sbeltranj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sbeltranj/32/32827_2.png) [@Sbeltranj](https://discourse.julialang.org/u/Sbeltranj)\
**Post date:** [November 6, 2021, 9:52pm UTC](https://discourse.julialang.org/t/bvproblem-methoderror/71038/3 "2021-11-06T21:52:12Z")

</div>

Thank you very much, it has been of great help
