Hi, I am stuck with a code (solving an economic model) and would need some help. I am sorry if the mistake is obvious, but I am new to this and would really need some help there. I have the following code:

```
function bk_opti_decent(grid::Any,
β::AbstractFloat,
Re::AbstractFloat,
Rl::AbstractFloat,
u::Function,
u_prime::Function,
E::AbstractFloat)
function foc1(Sb::Number,
c_bar::Number,
Lb::Number,
K::Number,
Lf::Number,
Sf::Number,
θhigh::Number,
P_star::Number,
θlow::Number,
D::Number)
c1_ND = D * c_bar
c1_D = Lb + Lf
c21(θ) = (Lb - θ* c_bar * D) * Rl + Sb * Re + Lf * Rl + Sf * Re
c22(θ) = (Lb - θ* c_bar * D) * Re + Sb * Re + Lf * Rl + Sf * Re
c2_D(θ) = (Sb + Sf) * Re / (1 - θ)
E_UD = θhigh * u(Lb + Lf) + (1-θhigh) * u(Lb + Lf + Re*(Sb + Sf)/ (1-θhigh))
E_UND = θhigh * u(c1_ND) + (1-θhigh) * u( Re*(Sb + Sf)/ (1-θhigh))
Diff = E_UND - E_UD
val1(θ) = (Re - 1) * u_prime(c21(θ))
val2(θ) = (Re - Rl) * u_prime(c22(θ))
val3(θ) = (P_star-1) * θ * u_prime(c1_D) + ((P_star - 1)*(1- θ) + Re ) * u_prime(c2_D(θ))
val4 = Diff * (P_star - 1) * (Re / ( c_bar * D * (Re - P_star)))
return quadgk(val1, 0, θlow)[1] + quadgk(val2, θlow, θhigh)[1] + quadgk(val3, θhigh, 1)[1] + val4
end
Bk_policyfunc = Array{Real}(0,2) #solution matrix
for (i,D) in enumerate(grid)
function f!(F::Any ,x::Any)
F[1]= foc1(x[1], x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9], D)
F[2]= x[3] - D - x[1]
F[3]= x[4] - E - D
F[4]= x[5] - x[2] * (Rl/(Re-Rl))
F[5]= x[6] - x[4] + x[5]
F[6]= x[7] - x[5] / x[1]
F[7]= x[9] - x[3]/ (D * x[2])
F[8]= x[8] - (Re * x[3] - Re * x[1] * x[7] + x[2] * x[7] * D) / ( x[2] * D * (Re - x[7]))
end
initial_x = [0.5 0.5 0.5 0.5 0.5 0.5 0.8 0.3 0.3 ]
results1_bk = nlsolve(f!, initial_x)
Bk_policyfunc[1, i] = results.zero[1]
Bk_policyfunc[2, i] = results.zero[2]
Bk_policyfunc[3, i] = results.zero[3]
Bk_policyfunc[4, i] = results.zero[4]
Bk_policyfunc[5, i] = results.zero[5]
Bk_policyfunc[6, i] = results.zero[6]
Bk_policyfunc[7, i] = results.zero[7]
Bk_policyfunc[8, i] = results.zero[8]
return Bk_policyfunc
end
end
```

Then I create a structure for a model (m) with specific parameters and when i tried solving part of it with

```
bank = bk_opti_decent(m.grid,
m.β,
m.Re,
m.Rl,
m.u,
m.u_prime,
m.E)
```

I get the following error that I am not able to solve. I changed the types of my unknow to “Number”, but it did not solve the problem. Here is the error:

```
MethodError: no method matching //(::#c21#289{Float64,Float64,Float64,Float64,Float64,Float64,Float64,Float64}, ::Int32)
Closest candidates are:
//(::Integer, ::Integer) at rational.jl:40
//(::Rational, ::Integer) at rational.jl:43
//(::Complex, ::Real) at rational.jl:56
...
Stacktrace:
[1] evalrule(::#val1#292{#c21#289{Float64,Float64,Float64,Float64,Float64,Float64,Float64,Float64},Float64,##324#328}, ::Float64, ::Float64, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Base.LinAlg.#vecnorm) at C:\Users\arquie\.julia\v0.6\QuadGK\src\QuadGK.jl:66
[2] do_quadgk(::#val1#292{#c21#289{Float64,Float64,Float64,Float64,Float64,Float64,Float64,Float64},Float64,##324#328}, ::Array{Float64,1}, ::Int32, ::Type{Float64}, ::Float64, ::Float64, ::Int32, ::Base.LinAlg.#vecnorm) at C:\Users\arquie\.julia\v0.6\QuadGK\src\QuadGK.jl:131
[3] #quadgk#15(::Array{Any,1}, ::Function, ::Function, ::Int32, ::Float64) at C:\Users\arquie\.julia\v0.6\QuadGK\src\QuadGK.jl:241
[4] (::#foc1#288{Float64,Float64,##323#327,##324#328})(::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64) at .\In[38]:47
[5] f! at .\In[38]:93 [inlined]
[6] (::NLsolve.#fj!#1{#f!#302{Float64,Float64,Float64,#foc1#288{Float64,Float64,##323#327,##324#328},#foc2#295{Float64,Float64,##323#327,##324#328}}})(::Array{Float64,2}, ::Array{Float64,2}, ::Array{Float64,2}) at C:\Users\arquie\.julia\v0.6\NLsolve\src\objectives\autodiff.jl:5
[7] value_jacobian!!(::NLSolversBase.OnceDifferentiable{Array{Float64,2},Array{Float64,2},Array{Float64,2},Val{false}}, ::Array{Float64,2}, ::Array{Float64,2}, ::Array{Float64,2}) at C:\Users\arquie\.julia\v0.6\NLSolversBase\src\interface.jl:124
[8] trust_region_(::NLSolversBase.OnceDifferentiable{Array{Float64,2},Array{Float64,2},Array{Float64,2},Val{false}}, ::Array{Float64,2}, ::Float64, ::Float64, ::Int32, ::Bool, ::Bool, ::Bool, ::Float64, ::Bool, ::NLsolve.NewtonTrustRegionCache{Array{Float64,2}}) at C:\Users\arquie\.julia\v0.6\NLsolve\src\solvers\trust_region.jl:118
[9] #nlsolve#38(::Symbol, ::Float64, ::Float64, ::Int32, ::Bool, ::Bool, ::Bool, ::LineSearches.Static{Float64}, ::Float64, ::Bool, ::Int32, ::Float64, ::NLsolve.#nlsolve, ::NLSolversBase.OnceDifferentiable{Array{Float64,2},Array{Float64,2},Array{Float64,2},Val{false}}, ::Array{Float64,2}) at C:\Users\arquie\.julia\v0.6\NLsolve\src\nlsolve\nlsolve.jl:26
[10] (::NLsolve.#kw##nlsolve)(::Array{Any,1}, ::NLsolve.#nlsolve, ::NLSolversBase.OnceDifferentiable{Array{Float64,2},Array{Float64,2},Array{Float64,2},Val{false}}, ::Array{Float64,2}) at .\<missing>:0
[11] #nlsolve#39(::Symbol, ::Float64, ::Float64, ::Int32, ::Bool, ::Bool, ::Bool, ::LineSearches.Static{Float64}, ::Float64, ::Bool, ::Int32, ::Float64, ::Symbol, ::Bool, ::NLsolve.#nlsolve, ::#f!#302{Float64,Float64,Float64,#foc1#288{Float64,Float64,##323#327,##324#328},#foc2#295{Float64,Float64,##323#327,##324#328}}, ::Array{Float64,2}) at C:\Users\arquie\.julia\v0.6\NLsolve\src\nlsolve\nlsolve.jl:59
[12] bk_opti_decent(::Array{Float64,1}, ::Float64, ::Float64, ::Float64, ::##323#327, ::##324#328, ::Float64) at .\In[38]:106
```

Many thanks.