# Std() throwing a methodError

**URL:** https://discourse.julialang.org/t/std-throwing-a-methoderror/18407
**Category:** General Usage
**Tags:** question
**Created:** [December 7, 2018, 4:48am UTC](https://discourse.julialang.org/t/std-throwing-a-methoderror/18407 "2018-12-07T04:48:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Daniel.malonebuoy](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@Daniel.malonebuoy](https://discourse.julialang.org/u/Daniel.malonebuoy)
#### Post date: [December 7, 2018, 4:48am UTC](https://discourse.julialang.org/t/std-throwing-a-methoderror/18407/1 "2018-12-07T04:48:06Z")

</div>

I am trying to calculate the standard deviation of the array waiting\_Time. But, i get the error “MethodError: objects of type Float64 are not callable”. What am I doing wrong?

Here is my code:

```julia
using Distributions

function simulation(l, m, s, n)
    tables = 3n ### the total tables each waiter can serve
    departure = zeros(tables)
    waiting_Time = zeros(0)
    sigma = 1 ### the std of waiting_Time; updated in our while loop
    counter = 0.0

    while (counter <= (1.96(sigma/.01))^2) ### while our confidence in the mean waiting timem is below 95%
        counter = counter + 1
        u = rand(1)
        arrival = -(1/l)*log.(u[1]) ### generate our customer arrival
        dine = rand(Normal(m,s), 1) ### generate the dinning time of our arrived customer
        if (arrival >= minimum(departure))
            wait = 0.0
            departure[indmin(departure)] = arrival + dine[1]
            push!(waiting_Time,wait)
        else
            wait = minimum(departure) - arrival
            departure[indmin(departure)] = arrival + wait + dine[1]
            push!(waiting_Time,wait)
        end
        
        if (length(waiting_Time) > tables)
            println(waiting_Time)
            for i in 1:length(waiting_Time)
                println(typeof(waiting_Time[i]))
            end
            sigma = std(waiting_Time)
        end    
    
    end

    results = (mean(waiting_Time))
    return results
end

```

---

<div class="post-metadata">

### Author: ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)
#### Post date: [December 7, 2018, 4:53am UTC](https://discourse.julialang.org/t/std-throwing-a-methoderror/18407/2 "2018-12-07T04:53:00Z")

</div>

I suspect you’ve defined a global variable with the same name as a function (such as `std = 1.0`), as it runs fine for me (after replacing `indmax` with `argmax`).

---

<div class="post-metadata">

### Author: ![Daniel.malonebuoy](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@Daniel.malonebuoy](https://discourse.julialang.org/u/Daniel.malonebuoy)
#### Post date: [December 8, 2018, 9:27am UTC](https://discourse.julialang.org/t/std-throwing-a-methoderror/18407/3 "2018-12-08T09:27:00Z")

</div>

Thank you! I did indeed define a global variable and didn’t clear it.
