2
$\begingroup$

The following latex code :

J(\theta) = -1/m \left[ \sum\limits_{i=1}^m \sum\limits_{k=1}^K y_k ^(^i^) log (\:h\theta(x ^i))k  + (1 - y_k^(^i^)) \: log (1 - (h\theta(x ^i))k) \right]

+

\newline
\newline

\lambda / 2m \sum\limits_{l=1}^{L-1}  \sum\limits_{i=1}^{sl} \sum\limits_{j=1}^{sl+1} (\theta_{ji}^{(l)})^2

produces:

enter image description here

on http://www.sciweavers.org/free-online-latex-equation-editor

But on math stackexchange this formula is not rendered ? Should I escape some symbols?

Update :

$$ J(\theta) = -1/m \left[ \sum\limits_{i=1}^m \sum\limits_{k=1}^K y_k^{(i)} log (\:h\theta(x ^i))k + (1 - y_k^{(i)}) \: log (1 - (h\theta(x ^i))k) \right] \\ + \\ \lambda / 2m \sum\limits_{l=1}^{L-1} \sum\limits_{i=1}^{sl} \sum\limits_{j=1}^{sl+1} (\theta_{ji}^{(l)})^2 $$

$\endgroup$
  • 1
    $\begingroup$ 1. No empty lines in math environment. 2. \newline should be replaced with \\ . 3. y_k ^(^i^) is invalid, did you mean y_k^{(i)}? $\endgroup$ – Daniel Fischer Nov 17 '15 at 14:30
  • $\begingroup$ @Daniel Fischer thank you, that worked except I used \\ for new lines as your latex for new line did not render $\endgroup$ – blue-sky Nov 17 '15 at 14:40
  • $\begingroup$ That was a markdown failure. I typed backtick-backslash-backslash-backtick and didn't notice that Markdown interpreted one of the backslashes as an escape for the closing backtick. $\endgroup$ – Daniel Fischer Nov 17 '15 at 14:42

You must log in to answer this question.

Browse other questions tagged .