Skip to main content

I'm trying to get the log-likelihood of a Gaussian in the form

$\qquad p(\textbf{x}|u,\sigma^2)=\prod_{n=1}^{N}\mathcal{N}(x_n|\mu,\sigma^2) \quad (1)$$$ p(\textbf{x}|u,\sigma^2)=\prod_{n=1}^{N}\mathcal{N}(x_n|\mu,\sigma^2) \quad (1) $$

$\qquad ln\ p(\textbf{x}|\mu,\sigma^2)=-\frac{1}{2\sigma^2}\sum_{n=1}^N{(x_n-\mu)^2}-\frac{N}{2}ln\ \sigma^2-\frac{N}{2}ln\ (2\pi) \quad (2)$$$ \ln\ p(\textbf{x}|\mu,\sigma^2)=-\frac{1}{2\sigma^2}\sum_{n=1}^N{(x_n-\mu)^2}-\frac{N}{2}\ln\ \sigma^2-\frac{N}{2}\ln\ (2\pi) \quad (2) $$

I've have

Log[Product[PDF[NormalDistribution[μ, σ], Subscript[x, n]], {n, 1, bigN}]] 

which outputs

$\qquad Log(\prod_{n=1}^{bigN}\frac{e^{\frac{(-\mu+x_n)^2}{2\sigma^2}}}{\sqrt{2\pi}\sigma})$.$$ \ln(\prod_{n=1}^{bigN}\frac{\mathrm e^{\frac{(-\mu+x_n)^2}{2\sigma^2}}}{\sqrt{2\pi}\sigma}). $$

I tried Expand, ExpandAll, PowerExpand, but I can't seem to get it to display like in Equation (2 RHS).

From

Product[Log[PDF[NormalDistribution[μ, σ], Subscript[x, n]]], {n, 1, bigN}] // PowerExpand` 

I get closer with

$\qquad \prod_{n=1}^{bigN}(\frac{1}{2}(-Log[2]-Log[\pi])-Log[\sigma]-\frac{(-\mu+x_n)^2}{2\sigma^2}))$$$ \prod_{n=1}^{bigN}\left[\frac{1}{2}(-\ln 2-\ln\pi)-\ln\sigma-\frac{(-\mu+x_n)^2}{2\sigma^2}\right] $$

I'm trying to get the log-likelihood of a Gaussian in the form

$\qquad p(\textbf{x}|u,\sigma^2)=\prod_{n=1}^{N}\mathcal{N}(x_n|\mu,\sigma^2) \quad (1)$

$\qquad ln\ p(\textbf{x}|\mu,\sigma^2)=-\frac{1}{2\sigma^2}\sum_{n=1}^N{(x_n-\mu)^2}-\frac{N}{2}ln\ \sigma^2-\frac{N}{2}ln\ (2\pi) \quad (2)$

I've have

Log[Product[PDF[NormalDistribution[μ, σ], Subscript[x, n]], {n, 1, bigN}]] 

which outputs

$\qquad Log(\prod_{n=1}^{bigN}\frac{e^{\frac{(-\mu+x_n)^2}{2\sigma^2}}}{\sqrt{2\pi}\sigma})$.

I tried Expand, ExpandAll, PowerExpand, but I can't seem to get it to display like in Equation (2 RHS).

From

Product[Log[PDF[NormalDistribution[μ, σ], Subscript[x, n]]], {n, 1, bigN}] // PowerExpand` 

I get closer with

$\qquad \prod_{n=1}^{bigN}(\frac{1}{2}(-Log[2]-Log[\pi])-Log[\sigma]-\frac{(-\mu+x_n)^2}{2\sigma^2}))$

I'm trying to get the log-likelihood of a Gaussian in the form

$$ p(\textbf{x}|u,\sigma^2)=\prod_{n=1}^{N}\mathcal{N}(x_n|\mu,\sigma^2) \quad (1) $$

$$ \ln\ p(\textbf{x}|\mu,\sigma^2)=-\frac{1}{2\sigma^2}\sum_{n=1}^N{(x_n-\mu)^2}-\frac{N}{2}\ln\ \sigma^2-\frac{N}{2}\ln\ (2\pi) \quad (2) $$

I've have

Log[Product[PDF[NormalDistribution[μ, σ], Subscript[x, n]], {n, 1, bigN}]] 

which outputs

$$ \ln(\prod_{n=1}^{bigN}\frac{\mathrm e^{\frac{(-\mu+x_n)^2}{2\sigma^2}}}{\sqrt{2\pi}\sigma}). $$

I tried Expand, ExpandAll, PowerExpand, but I can't seem to get it to display like in Equation (2 RHS).

From

Product[Log[PDF[NormalDistribution[μ, σ], Subscript[x, n]]], {n, 1, bigN}] // PowerExpand` 

I get closer with

$$ \prod_{n=1}^{bigN}\left[\frac{1}{2}(-\ln 2-\ln\pi)-\ln\sigma-\frac{(-\mu+x_n)^2}{2\sigma^2}\right] $$

Improved formatting
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

Expanding Product[]Log[Product[...]]

I'm typingtrying to get the log-likelihood of a Gaussian in the form

$p(\textbf{x}|u,\sigma^2)=\prod_{n=1}^{N}\mathcal{N}(x_n|\mu,\sigma^2) \quad (1)$$\qquad p(\textbf{x}|u,\sigma^2)=\prod_{n=1}^{N}\mathcal{N}(x_n|\mu,\sigma^2) \quad (1)$

$ln\ p(\textbf{x}|\mu,\sigma^2)=-\frac{1}{2\sigma^2}\sum_{n=1}^N{(x_n-\mu)^2}-\frac{N}{2}ln\ \sigma^2-\frac{N}{2}ln\ (2\pi) \quad (2)$$\qquad ln\ p(\textbf{x}|\mu,\sigma^2)=-\frac{1}{2\sigma^2}\sum_{n=1}^N{(x_n-\mu)^2}-\frac{N}{2}ln\ \sigma^2-\frac{N}{2}ln\ (2\pi) \quad (2)$

I've have

Log[Product[PDF[NormalDistribution[μ, σ], Subscript[x, n]], {n, 1, bigN}]] 

Log[Product[PDF[NormalDistribution[\[Mu],\[Sigma]],x_n],{n,1,bigN}]] which which outputs $Log(\prod_{n=1}^{bigN}\frac{e^{\frac{(-\mu+x_n)^2}{2\sigma^2}}}{\sqrt{2\pi}\sigma})$

$\qquad Log(\prod_{n=1}^{bigN}\frac{e^{\frac{(-\mu+x_n)^2}{2\sigma^2}}}{\sqrt{2\pi}\sigma})$.

I tried Expand, ExpandAll, PowerExpand, but I can't seem to get it to display like in Equation (2 RHS).

From Product[Log[PDF[NormalDistribution[\[Mu], \[Sigma]], Subscript[x, n]]], {n, 1, bigN}] // PowerExpand

Product[Log[PDF[NormalDistribution[μ, σ], Subscript[x, n]]], {n, 1, bigN}] // PowerExpand` 

I get closer with $\prod_{n=1}^{bigN}(\frac{1}{2}(-Log[2]-Log[\pi])-Log[\sigma]-\frac{(-\mu+x_n)^2}{2\sigma^2}))$

$\qquad \prod_{n=1}^{bigN}(\frac{1}{2}(-Log[2]-Log[\pi])-Log[\sigma]-\frac{(-\mu+x_n)^2}{2\sigma^2}))$

Expanding Product[]

I'm typing to get the log-likelihood of a Gaussian in the form

$p(\textbf{x}|u,\sigma^2)=\prod_{n=1}^{N}\mathcal{N}(x_n|\mu,\sigma^2) \quad (1)$

$ln\ p(\textbf{x}|\mu,\sigma^2)=-\frac{1}{2\sigma^2}\sum_{n=1}^N{(x_n-\mu)^2}-\frac{N}{2}ln\ \sigma^2-\frac{N}{2}ln\ (2\pi) \quad (2)$

I've have

Log[Product[PDF[NormalDistribution[\[Mu],\[Sigma]],x_n],{n,1,bigN}]] which outputs $Log(\prod_{n=1}^{bigN}\frac{e^{\frac{(-\mu+x_n)^2}{2\sigma^2}}}{\sqrt{2\pi}\sigma})$.

I tried Expand, ExpandAll, PowerExpand but I can't seem to get it to display like in Equation (2 RHS).

From Product[Log[PDF[NormalDistribution[\[Mu], \[Sigma]], Subscript[x, n]]], {n, 1, bigN}] // PowerExpand I get closer with $\prod_{n=1}^{bigN}(\frac{1}{2}(-Log[2]-Log[\pi])-Log[\sigma]-\frac{(-\mu+x_n)^2}{2\sigma^2}))$

Expanding Log[Product[...]]

I'm trying to get the log-likelihood of a Gaussian in the form

$\qquad p(\textbf{x}|u,\sigma^2)=\prod_{n=1}^{N}\mathcal{N}(x_n|\mu,\sigma^2) \quad (1)$

$\qquad ln\ p(\textbf{x}|\mu,\sigma^2)=-\frac{1}{2\sigma^2}\sum_{n=1}^N{(x_n-\mu)^2}-\frac{N}{2}ln\ \sigma^2-\frac{N}{2}ln\ (2\pi) \quad (2)$

I've have

Log[Product[PDF[NormalDistribution[μ, σ], Subscript[x, n]], {n, 1, bigN}]] 

which outputs

$\qquad Log(\prod_{n=1}^{bigN}\frac{e^{\frac{(-\mu+x_n)^2}{2\sigma^2}}}{\sqrt{2\pi}\sigma})$.

I tried Expand, ExpandAll, PowerExpand, but I can't seem to get it to display like in Equation (2 RHS).

From

Product[Log[PDF[NormalDistribution[μ, σ], Subscript[x, n]]], {n, 1, bigN}] // PowerExpand` 

I get closer with

$\qquad \prod_{n=1}^{bigN}(\frac{1}{2}(-Log[2]-Log[\pi])-Log[\sigma]-\frac{(-\mu+x_n)^2}{2\sigma^2}))$

Source Link

Expanding Product[]

I'm typing to get the log-likelihood of a Gaussian in the form

$p(\textbf{x}|u,\sigma^2)=\prod_{n=1}^{N}\mathcal{N}(x_n|\mu,\sigma^2) \quad (1)$

$ln\ p(\textbf{x}|\mu,\sigma^2)=-\frac{1}{2\sigma^2}\sum_{n=1}^N{(x_n-\mu)^2}-\frac{N}{2}ln\ \sigma^2-\frac{N}{2}ln\ (2\pi) \quad (2)$

I've have

Log[Product[PDF[NormalDistribution[\[Mu],\[Sigma]],x_n],{n,1,bigN}]] which outputs $Log(\prod_{n=1}^{bigN}\frac{e^{\frac{(-\mu+x_n)^2}{2\sigma^2}}}{\sqrt{2\pi}\sigma})$.

I tried Expand, ExpandAll, PowerExpand but I can't seem to get it to display like in Equation (2 RHS).

From Product[Log[PDF[NormalDistribution[\[Mu], \[Sigma]], Subscript[x, n]]], {n, 1, bigN}] // PowerExpand I get closer with $\prod_{n=1}^{bigN}(\frac{1}{2}(-Log[2]-Log[\pi])-Log[\sigma]-\frac{(-\mu+x_n)^2}{2\sigma^2}))$