I defined a function with n
terms where n
is a variable:
LogLH[μ_, σ_] = n Log[a[σ]] - Sum[Log[y[[i]]] +
(Log[y[[i]]] - μ)^2 / (2 σ^2), {i, 1, n}]
In this function, the y[[i]]
are (assumed to represent) observations of a quantity - picked from a list of n
elements.
This statement multiply produces the error "The expression i cannot be used as a part specification". It seems however, that M. correctly evaluates the function. M. also computes the partial derivatives for μ and σ. But the above errors repeat and lateron, I can not apply the Solve command to the resulting system of equations. Hence my question: How can I define an open ended list of n elements in M.?
SetDelayed
(:=
) instead ofSet
(=
). Afterwards, once you provide a proper listy
and a value forn
, the sum will evaluate. E.g.,n = 10; y = Range@10; LogLH[m, s]
. The rest of your question is uncear: what is "M."? What inequalities? What system of equations? What about the derivatives of $\mu$ and $\sigma$? $\endgroup$