# ERROR: MethodError: no method matching ^(::Float64, ::Normal{Float64})

Hello,

Could anyone help me understand why Julia is upset with `h[i,j] = h0 * (log10BM[i]^ηpred) * (log10BM[j]^ηprey)` ?

I think it is unhappy with the `^` but I don’t understand why. Also, is there some manual or guideline on understanding error messages? I think Julia would be more beginner-friendly if something like this existed.

``````function create_h(NumTotalSpecies, log10BM, h0, ηpred, ηprey)
h = zeros(NumTotalSpecies, NumTotalSpecies)
for i = 1:NumTotalSpecies
for j = 1:NumTotalSpecies
h[i,j] = h0 * (log10BM[i]^ηpred) * (log10BM[j]^ηprey)
end
end
return(h)
end

h = create_h(NumTotalSpecies, log10BM, h0, ηpred, ηprey)

NumPlantSpecies = 8
NumAnimalSpecies = 12
NumTotalSpecies = NumPlantSpecies + NumAnimalSpecies

log10BM_P = sort(rand(Uniform(10^0, 10^6), NumPlantSpecies))
log10BM_A = sort(rand(Uniform(10^2, 10^12), NumAnimalSpecies))
log10BM = vcat(log10BM_P,log10BM_A)

ηpred = Normal(-0.48,0.03)
ηprey = Normal(-0.66,0.02)
h0 = 0.4
``````
1 Like

Because you are trying to raise a float to a normal distribution, which is undefined. It is probably

``````log10BM[i]^ηpred
``````

that is giving you the (first) error.

It is possible you meant to draw `ηpred` from that normal, eg

``````ηpred = rand(Normal(-0.48,0.03))
``````

Same applies to `ηprey`.

1 Like

Using `ηpred = rand(Normal(-0.48,0.03))` did fix the error.