# Binomial maximum likelihood expressed as a sum

If I have a binomial maximum likelihood function

$$L(\theta | k) = \Pi_i^N p(\theta)^{k_i}(1-p(\theta))^{(n_i-k_i)}$$

I know that the index terms can be made into a sum, simplifying the expression for calculation purposes. I have a model which predicts the probability of success as a function of a variable (x) and a parameter. I have measured k (knowing n) for a number of values of x and now I want to find the best fit value for my parameter which I am trying to determine experimentally. Am I right in thinking my likelihood function is in this case

$$L(\theta | x, k) = \Pi_i^N p(\theta, x_i)^{k_i}(1-p(\theta, x_i))^{(n_i-k_i)}$$

Assuming this is the case (if not can someone correct me), is there anyway I can convert my product to a sum, or, do I have to keep it in product form?

$$\text{ln}( L(\theta | x, k)) = \text{ln}( \Pi_i^N (n_ip(\theta, x_i))^{k_i}\frac{e^{-n_ip(\theta, x_i)}}{k_i!})$$
Then you can omit the factorial since it doesn't depend on $p$ nor $x$
$$\text{ln}( L(\theta | x, k)) = \sum_i^N k_i\text{ln}(n_ip(\theta, x_i))^{}+\sum_i^Nn_ip(\theta, x_i)$$