# Method Error? objects of type Vector{Float64} are not callable Use square brackets \[\] for indexing an Array

**URL:** <https://discourse.julialang.org/t/method-error-objects-of-type-vector-float64-are-not-callable-use-square-brackets-for-indexing-an-array/95305>\
**Category:** General Usage\
**Created:** [February 28, 2023, 4:00am UTC](https://discourse.julialang.org/t/method-error-objects-of-type-vector-float64-are-not-callable-use-square-brackets-for-indexing-an-array/95305 "2023-02-28T04:00:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_S1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrew_s1/32/47284_2.png) [@Andrew\_S1](https://discourse.julialang.org/u/Andrew_S1)\
**Post date:** [February 28, 2023, 4:00am UTC](https://discourse.julialang.org/t/method-error-objects-of-type-vector-float64-are-not-callable-use-square-brackets-for-indexing-an-array/95305/1 "2023-02-28T04:00:15Z")

</div>

I am writing a function for the Runge-Kutta method (Rk4) and when I try to put values into the equation I get a method error.

function explicit\_rk4(f::Function, yo::Vector, t\_final::Real, N::Int)  
t=range(0, t\_final, N+1)  
y=zeros(length(yo),N+1)  
h=t[2]-t[1]  
y[:,1]=yo  
for k = 1:N

```
k₁=f(y[:,k],t[k])

k₂=f(y[:,k] +k₁*(h/2), t[k] + h/2)

k₃=f(y[:,k] + k₂(h/2),t[k] + h/2)

k₄=f(y[:,k]+k₃*h,t[k]+h)

y[:,k+1]= y[:,k]+(k₁ + 2*k₂ + 2*k₃ + k₄)*(h/6)
end 

return t,y

```

end

for k=1:i  
exp\_rk4\_t, exp\_rk4\_y =explicit\_rk4( (y,t)-\>[y[2];-y[1]],[1;0],4\*pi,i)  
end

MethodError: objects of type Vector{Float64} are not callable  
Use square brackets for indexing an Array.

If anyone knows whats up please let me know?

---

<div class="post-metadata">

**Author:** ![uniment](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uniment/32/24532_2.png) [@uniment](https://discourse.julialang.org/u/uniment)\
**Post date:** [February 28, 2023, 4:03am UTC](https://discourse.julialang.org/t/method-error-objects-of-type-vector-float64-are-not-callable-use-square-brackets-for-indexing-an-array/95305/2 "2023-02-28T04:03:43Z")

</div>

Have you considered changing `k₂(h/2)` to `k₂*(h/2)`?
