# Trying to understand reported error

I am trying to solve Temperature Variation problem on Project Lovelace.

The problem is given a list of numbers, find the mean and standard deviation. I have written the following code,

``````function temperature_statistics(T)
mean = sum(T)/length(T)
std  = sqrt(sum((T .- mean).^2)/length(T))
return mean, std
end
``````

The code appears correct to me, but the when I try to submit it I get the following error,

``````ERROR: LoadError: MethodError: no method matching Array{Float64,1}(::Array{Float64,2})

You might have used a 2d row vector where a 1d column vector was required.
Note the difference between 1d column vector [1,2,3] and 2d row vector [1 2 3].
You can convert to a column vector with the vec() function.
Closest candidates are:
Array{Float64,1}(::AbstractArray{S,N}) where {T, N, S} at array.jl:562
Array{Float64,1}() where T at boot.jl:425
Array{Float64,1}(!Matched::UndefInitializer, !Matched::Int64) where T at boot.jl:406
...
Stacktrace:
 convert(::Type{Array{Float64,1}}, ::Array{Float64,2}) at ./array.jl:554
 juliafy_json(::Array{Any,1}) at /root/88e8d876243adc5179c2a982d1750704acbbd495.jl:30
 iterate at ./generator.jl:47 [inlined]
 collect(::Base.Generator{Array{Any,1},typeof(juliafy_json)}) at ./array.jl:686
 top-level scope at /root/88e8d876243adc5179c2a982d1750704acbbd495.jl:39
 include(::Function, ::Module, ::String) at ./Base.jl:380
 include(::Module, ::String) at ./Base.jl:368
 exec_options(::Base.JLOptions) at ./client.jl:296
 _start() at ./client.jl:506
``````

Now, the thing that stands out to me is in this error is this part `no method matching Array{Float64,1}(::Array{Float64,2})`

Am I correct to assume that the auto test engine is expecting a function that takes a `Array{Float64,1}` and returns a `Array{Float64,2}`? If that’s true, then changing the return statement to `return [mean, std]` would solve the issue, right? But it didn’t.

Where do you guys think the problem is?

We probably need a full minimum working example to help with this, where we know what `T` is.

I checked with Temperature variations | Project Lovelace and get the same error (no matter what I do). So I suspect an error on the project system and expect that you can’t do anything.

You may try to send a note to the maintainer of project lovelace and make them aware of this issue.

2 Likes

Thanks, reported to the maintainer.

3 Likes