Discussion thread for Temperature variations.
When I try to solve this problem using Julia I get the following error,
Julia code
function temperature_statistics(T)
mean = sum(T)/length(T)
std = sqrt(sum((T .- mean).^2)/length(T))
return mean, std
end
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:
[1] convert(::Type{Array{Float64,1}}, ::Array{Float64,2}) at ./array.jl:554
[2] juliafy_json(::Array{Any,1}) at /root/88e8d876243adc5179c2a982d1750704acbbd495.jl:30
[3] iterate at ./generator.jl:47 [inlined]
[4] collect(::Base.Generator{Array{Any,1},typeof(juliafy_json)}) at ./array.jl:686
[5] top-level scope at /root/88e8d876243adc5179c2a982d1750704acbbd495.jl:39
[6] include(::Function, ::Module, ::String) at ./Base.jl:380
[7] include(::Module, ::String) at ./Base.jl:368
[8] exec_options(::Base.JLOptions) at ./client.jl:296
[9] _start() at ./client.jl:506
Other Julia users have tried alternate solution, but the error persists. More information here: Trying to understand reported error - Usage - JuliaLang