How to write piecewise function in jupyter notebook markdown?
Asked Answered
O

1

5

I'm trying to write a piecewise function in markdown on jupyter and jupyter is being spooky. Out of three functions, it only displays one properly (the $n_o$ one), even though they are all written in the same manner.

Is there a more elegant way to write this up?

$$ N(a)=  \left\{
\begin{array}{ll}
      n_o & A>A_{krit} \\
      n_o+2 & A=A_{krit} \\
      n_o+4 & A<A_{krit} \\
\end{array} 
\right, $$

gdje je: $$A=\frac{1}{|a|},$$ 

$$ A_{krit}(a)=  \left\{
\begin{array}{ll}
      \frac{\sin(2\pi*floor(\frac{|a|}{2*\pi})+\frac{\pi}{2})}{2\pi*floor(\frac{|a|}{2*\pi})+\frac{\pi}{2}} & a>0 \\
      \frac{\sin(2\pi*floor(\frac{|a|}{2*\pi})+\frac{3\pi}{2})}{2\pi*floor(\frac{|a|}{2*\pi})+\frac{3\pi}{2}} & a<0\\
\end{array} 
\right, $$ i

$$ n_o(a)=  \left\{
\begin{array}{ll}
      |floor(\frac{|a|}{2*\pi})-1| & a>2\pi \\
      |floor(\frac{|a|}{2*\pi})-1|-2 & 0<a<2\pi \land A\leq A_{krit} \\
      floor(\frac{|a|}{2*\pi})+1 & a<0 \\
\end{array} 
\right. $$ 
Oilbird answered 20/1, 2019 at 21:21 Comment(2)
That looks more like latex then python - why the python flag?Primordium
@PatrickArtner because I'm using the jupyter environment to add some explanation to my code and can't willy-nilly import latex packagesOilbird
M
10

It seems there is spacing issue in your latex code. I just modified little bit, it works:

    $$ N(a)=   \left\{
\begin{array}{ll}
      n_o & A>A_{krit} \\
      n_o+2 & A=A_{krit} \\
      n_o+4 & A<A_{krit} \\
\end{array} 
\right.  $$


gdje je: $$A=\frac{1}{|a|},$$ 

$$ A_{krit}(a)=   \left\{
\begin{array}{ll}
      \frac{\sin(2\pi*floor(\frac{|a|}{2*\pi})+\frac{\pi}{2})}{2\pi*floor(\frac{|a|}{2*\pi})+\frac{\pi}{2}} & a>0 \\
      \frac{\sin(2\pi*floor(\frac{|a|}{2*\pi})+\frac{3\pi}{2})}{2\pi*floor(\frac{|a|}{2*\pi})+\frac{3\pi}{2}} & a<0\\
\end{array} 
\right.  $$ i

$$ n_o(a)=  \left\{
\begin{array}{ll}
      |floor(\frac{|a|}{2*\pi})-1| & a>2\pi \\
      |floor(\frac{|a|}{2*\pi})-1|-2 & 0<a<2\pi \land A\leq A_{krit} \\
      floor(\frac{|a|}{2*\pi})+1 & a<0 \\
\end{array} 
\right. $$ 

Sample Demo

Marismarisa answered 21/1, 2019 at 10:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.