Taking logarithm of sum and products $\newcommand{\cost}{\operatorname{cost}}$My cost-metric is in following form
\begin{equation}
\cost(x,y) = A(x,y_1) \times \sum_{i}b_i B_i(x,y_i)\tag{1}
\end{equation}
where $A$ and $B$'s follow normal distribution. For my computer implementation, I am thinking of taking $\log(\cdot)$ to avoid computing exponential. By taking log of (1), I get
\begin{equation}
\log(\cost(x,y)) = \log(A(x,y_1)) + \log\left(\sum_i b_i B_i(x,y_i)\right)
\end{equation}
which simplifies first term but second term remains unchanged. Can I bring $\log(\cdot)$ inside the summation?

No, you can't bring the logarithm inside the summation because that's equivalent to saying that the logarithm of a sum is the sum of logarithms.
