Blog 1

Random Talk on Random Thoughts

Another Way of Writing Piecewise Functions

| Comments |

Background

I changed my way of writing block equations for RSS.1 However, in my old post about the Contraction Mapping Principles, there’s an inequality on the rate of convergence of a point in a complete metric space to the unique fixed point of the Lipschitz mapping with a Lipschitz constant strictly less than one.2

\[ \begin{aligned} d(x^*,x_n) =& d\left( \lim_{k \to \infty} x_k,x_n\right) \\\
=& \lim_{k \to \infty} d(x_k,x_n) \\\
\le& \lim_{k \to \infty} \frac{q^n}{1 - q} d(x_1,x_0) \\\
=& \frac{q^n}{1 - q} d(x_1,x_0) \end{aligned} \]

Source code of the above block equation
1
2
3
4
5
6
7
8
9
\\[
\begin{aligned}
d(x^\*,x\_n) =& d\left( \lim\_{k \to \infty} x\_k,x\_n\right) \\\\\\\\
=& \lim\_{k \to \infty} d(x\_k,x\_n) \\\\\\\\
\le& \lim\_{k \to \infty} \frac{q^n}{1 - q} d(x\_1,x\_0) \qquad
  \text{(by \eqref{eq:finite_err})} \\\\\\\\
=& \frac{q^n}{1 - q} d(x\_1,x\_0)
\end{aligned}
\\]

Starting from the second line in the above block equation, at the left of the binary relation symbols there’s a whitespace character.

Visual effects in a page for a single post

fig1

$\rm \LaTeX$ code as seen in an individual post
1
2
3
4
5
6
7
\begin{aligned}
d(x^*,x_n) =& d\left( \lim_{k \to \infty} x_k,x_n\right) \\\
=& \lim_{k \to \infty} d(x_k,x_n) \\\
\le& \lim_{k \to \infty} \frac{q^n}{1 - q} d(x_1,x_0) \qquad
  \text{(by \eqref{eq:finite_err})} \\\
=& \frac{q^n}{1 - q} d(x_1,x_0)
\end{aligned}

Visual effects in pages under “/posts/” or the index page

(Added on SEP 3RD, 2015)

Note that due to the development of Octopress, I now see three backslashes in the “MathJax Equation Source”.

fig2

$\rm \LaTeX$ code as seen under "/posts/" or the index page
1
2
3
4
5
6
7
\begin{aligned}
d(x^*,x_n) =& d\left( \lim_{k \to \infty} x_k,x_n\right) \\
=& \lim_{k \to \infty} d(x_k,x_n) \\
\le& \lim_{k \to \infty} \frac{q^n}{1 - q} d(x_1,x_0) \qquad
  \text{(by \eqref{eq:finite_err})} \\
=& \frac{q^n}{1 - q} d(x_1,x_0)
\end{aligned}

It doesn’t matter much in block equations.

Problem

However, it does matter if I have to define a piecewise function. Take one defined in one of my old posts as an example.3


(Added on DEC 12TH, 2014) (Revised on SEP 3RD, 2015)

Note: As you can see from the above piecewise function, the problem is now gone.


\[ f(x,y) = \begin{cases} 0 &\text{if } (x,y) \in \vect{I} \land y \ge x\\\
1 &\text{if } (x,y) \in \vect{I} \land y < x \end{cases} \]

Source code of the above block equation
1
2
3
4
5
6
7
\\[
f(x,y) =
  \begin{cases}
    0 &\text{if } (x,y) \in \vect{I} \land y \ge x\\\\\\\\
    1 &\text{if } (x,y) \in \vect{I} \land y < x
  \end{cases}
\\]

Visual effects in a page for a single post

fig3

$\rm \LaTeX$ code as seen in an individual post
1
2
3
4
5
f(x,y) =
  \begin{cases}
    0 &\text{if } (x,y) \in \vect{I} \land y \ge x\\\
    1 &\text{if } (x,y) \in \vect{I} \land y < x
  \end{cases}

Visual effects in pages under “/posts/” or the index page

(Added on SEP 3RD, 2015)

Note that due to the development of Octopress, I now see three backslashes in the “MathJax Equation Source”.

fig4

$\rm \LaTeX$ code as seen under "/posts/" or the index page
1
2
3
4
5
f(x,y) =
  \begin{cases}
    0 &\text{if } (x,y) \in \vect{I} \land y \ge x\\
    1 &\text{if } (x,y) \in \vect{I} \land y < x
  \end{cases}

Solution


(Added on SEP 3RD, 2015)

Now, I know how to tell kramdown to ignore MathJax code. This is much more convenient than the method described below.


After I observed that the two equations, which are aligned by the aligned environment, at the bottom of the post cited in footnote #3, I used the $\rm \LaTeX$ commands \left\\{ and \right. in the Markdown source file for posts to construct the left curly brace only.

\[ f(x,y) = \left\{ \begin{aligned} 0 &\text{ if } (x,y) \in \vect{I} \land y \ge x\\\
1 &\text{ if } (x,y) \in \vect{I} \land y < x, \end{aligned} \right. \]

Source code of the above block equation
1
2
3
4
5
6
7
8
\\[
f(x,y) = \left\\{
  \begin{aligned}
    0 &\text{ if } (x,y) \in \vect{I} \land y \ge x\\\\\\\\
    1 &\text{ if } (x,y) \in \vect{I} \land y < x,
  \end{aligned}
\right.
\\]

Visual effects in a page for a single post

fig5

$\rm \LaTeX$ code as seen in an individual post
1
2
3
4
5
6
f(x,y) = \left\{
  \begin{aligned}
    0 &\text{ if } (x,y) \in \vect{I} \land y \ge x\\\
    1 &\text{ if } (x,y) \in \vect{I} \land y < x,
  \end{aligned}
\right.

Visual effects in pages under “/posts/” or the index page

(Added on SEP 3RD, 2015)

Note that due to the development of Octopress, I now see three backslashes in the “MathJax Equation Source”.

fig6

$\rm \LaTeX$ code as seen under "/posts/" or the index page
1
2
3
4
5
6
f(x,y) = \left\{
  \begin{aligned}
    0 &\text{ if } (x,y) \in \vect{I} \land y \ge x\\
    1 &\text{ if } (x,y) \in \vect{I} \land y < x,
  \end{aligned}
\right.

‘0’ and ‘1’ in the above example are aligned. Though in pages for each individual posts, the whitespace character preceeding ‘1’ still exists, it isn’t visible unless it’s highlighted. I’m quite satified with this alternative method of typesetting piecewise functions.


  1. See MathJax and RSS in Blog 1 for details. 

  2. See Error Bound of the Fixed Point of Contraction Mappings in Blog 1 for details. 

  3. See Archimedean Sequence of Partitions of a Square in Blog 1 for details. 

Comments