{
 "metadata":{},
 "nbformat":4,
 "nbformat_minor":4,
 "cells":[
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 02_18_testdoc.ipynb -->\n",
    "# The middle has `verbatim` word\n",
    "\n",
    "Some text.\n",
    "\n",
    "***Just emphasize*.** Some text.\n",
    "\n",
    "**`Just verbatim`.** Some text.\n",
    "\n",
    "***Emphasize* beginning.** Some text.\n",
    "\n",
    "**`Verbatim beginning`.** Some text.\n",
    "\n",
    "**Maybe *emphasize end*.** Some text.\n",
    "\n",
    "**Maybe `verbatim end`.** Some text.\n",
    "\n",
    "**The middle has *emphasize* word.** Some text.\n",
    "\n",
    "**The middle has `verbatim` word.** Some text.\n",
    "\n",
    "**Ampersand.**\n",
    "We can test Hennes & Mauritz, often abbreviated H&M, but written\n",
    "as `Hennes & Mauritz` and `H & M`.\n",
    "A sole `&` must also work.\n",
    "<!-- Note: substitutions must not occur inside verbatim, just in ordinary text. -->"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "        # Just to check that ampersand works in code blocks:\n",
    "        c = a & b\n"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "**Quotes.**\n",
    "Let us also add a test of quotes such as \"double quotes, with numbers\n",
    "like 3.14 and newline/comma and hyphen (as in double-quote)\"; written\n",
    "in the standard LaTeX-style that gives correct LaTeX formatting and\n",
    "ordinary double quotes for all non-LaTeX formats.  Here is another\n",
    "sentence that \"caused\" a bug in the past because double backtick\n",
    "quotes could imply verbatim text up to a verbatim word starting with\n",
    "period, like `.txt`.\n",
    "\n",
    "More quotes to be tested for spellcheck:\n",
    "(\"with parenthesis\"), \"with newline\"\n",
    "and \"with comma\", \"hyphen\"-wise, and \"period\"."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 02_19_testdoc.md -->\n",
    "# Bibliography test\n",
    "\n",
    "Here is an example: <a href=\"07_testdoc.html#Langtangen_Pedersen_2002\">[1]</a> discussed propagation of\n",
    "large destructive water waves, <a href=\"07_testdoc.html#Langtangen_et_al_2002\">[2]</a> gave\n",
    "an overview of numerical methods for solving the Navier - Stokes equations,\n",
    "while the use of Backward Kolmogorov equations for analyzing\n",
    "random vibrations was investigated in <a href=\"07_testdoc.html#Langtangen_1994a\">[3]</a>.\n",
    "The book chapter <a href=\"07_testdoc.html#Mardal_et_al_2003a\">[4]</a> contains information on\n",
    "C++ software tools for programming multigrid methods. A real retro\n",
    "reference is <a href=\"07_testdoc.html#Langtangen_1988d\">[5]</a> about a big FORTRAN package.\n",
    "Multiple references are also possible, e.g., see\n",
    "<a href=\"07_testdoc.html#Langtangen_Pedersen_2002\">[1]</a> <a href=\"07_testdoc.html#Mardal_et_al_2003a\">[4]</a>.\n",
    "\n",
    "We need to cite more than 10 papers to reproduce an old formatting\n",
    "problem with blanks in the keys in reST format:\n",
    "<a href=\"07_testdoc.html#Langtangen_1992c\">[6]</a> <a href=\"07_testdoc.html#Langtangen_1994a\">[3]</a> <a href=\"07_testdoc.html#Mortensen_et_al_2011\">[7]</a> <a href=\"07_testdoc.html#Langtangen_Pedersen_2002\">[1]</a>\n",
    "and\n",
    "<a href=\"07_testdoc.html#Langtangen_et_al_2002\">[2]</a> <a href=\"07_testdoc.html#Glimsdal_et_al_20006\">[8]</a> <a href=\"07_testdoc.html#Rahman_et_al_2006b\">[9]</a> <a href=\"07_testdoc.html#Haga_et_al_2011a\">[10]</a> <a href=\"07_testdoc.html#Langtangen_2003a\">[11]</a> <a href=\"07_testdoc.html#Langtangen_2008a\">[12]</a> <a href=\"07_testdoc.html#Langtangen:95\">[13]</a>\n",
    "and all the work of\n",
    "<a href=\"07_testdoc.html#Langtangen_2012\">[14]</a> <a href=\"07_testdoc.html#Mardal_et_al_2003a\">[4]</a> <a href=\"07_testdoc.html#Jeberg_et_al_2004\">[15]</a> as well as\n",
    "old work <a href=\"07_testdoc.html#Langtangen_1988d\">[5]</a> and <a href=\"07_testdoc.html#Langtangen_1989e\">[16]</a>, and the\n",
    "talk <a href=\"07_testdoc.html#Langtangen_talk_2007a\">[17]</a>.\n",
    "Langtangen also had two thesis <a href=\"07_testdoc.html#Langtangen:85\">[18]</a> <a href=\"07_testdoc.html#Langtangen_1989e\">[16]</a>\n",
    "back in the days.\n",
    "More retro citations are\n",
    "the old ME-IN323 book <a href=\"07_testdoc.html#Langtangen:91\">[19]</a> and the\n",
    "<a href=\"07_testdoc.html#Langtangen:94b\">[20]</a> OONSKI '94 paper."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 02_20_testdoc.md -->\n",
    "# Example: Examples can be typeset as exercises\n",
    "\n",
    "<div id=\"Example\"></div>\n",
    "\n",
    "Examples can start with a subsection heading starting with `Example:`\n",
    "and then, with the command-line option `--examples_as_exercises` be\n",
    "typeset as exercises. This is useful if one has solution\n",
    "environments as part of the example.\n",
    "\n",
    "!bsubex\n",
    "State some problem.\n",
    "\n",
    "!bsol\n",
    "The answer to this subproblem can be written here.\n",
    "!esol\n",
    "!esubex\n",
    "\n",
    "!bsubex\n",
    "State some other problem.\n",
    "\n",
    "**Hint.**\n",
    "\n",
    "A hint can be given.\n",
    "\n",
    "\n",
    "\n",
    "**Hint.**\n",
    "\n",
    "Maybe even another hint?\n",
    "\n",
    "\n",
    "\n",
    "!bsol\n",
    "The answer to this other subproblem goes here,\n",
    "maybe over multiple doconce input lines.\n",
    "!esol\n",
    "!esubex"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 02_21_testdoc.ipynb -->\n",
    "# User-defined environments\n",
    "\n",
    "The example in the section [Example 1: A test function](ex:test:1p1.html#ex:test:1p1) demonstrates how to write a test function.\n",
    "That is, a special test function for a function `add` appears in\n",
    "the example in the section [Example 1: A test function](ex:test:1p1.html#ex:test:1p1).\n",
    "\n",
    "## Example 1: A test function\n",
    "<div id=\"ex:test:1p1\"></div>\n",
    "\n",
    "Suppose we want to write a test function for checking the\n",
    "implementation of a Python function for addition."
   ]
  },
  {
   "cell_type":"code",
   "execution_count":8,
   "metadata":{
    "collapsed":false,
    "editable":true
   },
   "outputs":[],
   "source":[
    "def add(a, b):\n",
    "    return a + b\n",
    "\n",
    "def test_add():\n",
    "    a = 1; b = 1\n",
    "    expected = a + b\n",
    "    computed = add(a, b)\n",
    "    assert expected == computed"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "## Example 2: Addition\n",
    "<div id=\"ex:math:1p1\"></div>\n",
    "\n",
    "We have"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "$$\n",
    "1 + 1 = 2\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "or in tabular form:\n",
    "\n",
    "<table border=\"1\">\n",
    "<thead>\n",
    "<tr><th align=\"center\">Problem</th> <th align=\"center\">Result</th> </tr>\n",
    "</thead>\n",
    "<tbody>\n",
    "<tr><td align=\"center\">   $1+1$      </td> <td align=\"center\">   $2$       </td> </tr>\n",
    "</tbody>\n",
    "</table>\n",
    "**Highlight box!**\n",
    "\n",
    "This environment is used to highlight something:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "$$\n",
    "E = mc^2\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 02_22_testdoc.md -->\n",
    "# URLs\n",
    "\n",
    "<div id=\"subsubsec:ex\"></div>\n",
    "\n",
    "Testing of URLs: hpl's home page [hpl](https://folk.uio.no/hpl), or\n",
    "the entire URL if desired, <https://folk.uio.no/hpl>.  Here is a\n",
    "plain file link <testdoc.do.txt>, or <testdoc.do.txt>, or\n",
    "<testdoc.do.txt> or <testdoc.do.txt> or [a link with\n",
    "newline](testdoc.do.txt). Can test spaces with the link with word\n",
    "too: [hpl](https://folk.uio.no/hpl) or [hpl](https://folk.uio.no/hpl). Also `file:///` works: [link to a\n",
    "file](file:///home/hpl/vc/doconce/doc/demos/manual/manual.html) is\n",
    "fine to have. Moreover, \"loose\" URLs work, i.e., no quotes, just\n",
    "the plain URL as in <https://folk.uio.no/hpl>, if followed by space, comma,\n",
    "colon, semi-colon, question mark, exclamation mark, but not a period\n",
    "(which gets confused with the periods inside the URL).\n",
    "\n",
    "Mail addresses can also be used: [`hpl@simula.no`](mailto:hpl@simula.no), or just a [mail link](mailto:hpl@simula.no), or a raw <mailto:hpl@simula.no>.\n",
    "\n",
    "Here are some tough tests of URLs, especially for the `latex` format:\n",
    "[Newton-Cotes](https://en.wikipedia.org/wiki/Newton%E2%80%93Cotes_formulas) formulas\n",
    "and a [good book](https://www.springer.com/mathematics/computational+science+%26+engineering/book/978-3-642-23098-1). Need to test\n",
    "Newton-Cotes with percentage in URL too:\n",
    "<https://en.wikipedia.org/wiki/Newton%E2%80%93Cotes_formulas>\n",
    "and <https://en.wikipedia.org/wiki/Newton-Cotes#Open_Newton.E2.80.93Cotes_formulae> which has a shebang.\n",
    "\n",
    "For the `--device=paper` option it is important to test that URLs with\n",
    "monospace font link text get a footnote\n",
    "(unless the `--latex_no_program_footnotelink`\n",
    "is used), as in this reference to\n",
    "[`decay_mod`](https://github.com/hplgit/INF5620/tree/gh-pages/src/decay/experiments/decay_mod.py), [`ball1.py`](https://tinyurl.com/pwyasaa/formulas.ball1.py),\n",
    "and [`ball2.py`](https://tinyurl.com/pwyasaa/formulas.ball2.py).\n",
    "\n",
    "<!-- Comments should be inserted outside paragraphs (because in the rst -->\n",
    "<!-- format extra blanks make a paragraph break). -->\n",
    "\n",
    "<!-- Note that when there is no https: or file:, it can be a file link -->\n",
    "<!-- if the link name is URL, url, \"URL\", or \"url\". Such files should, -->\n",
    "<!-- if rst output is desired, but placed in a `_static*` folder. -->\n",
    "\n",
    "More tough tests: repeated URLs whose footnotes when using the\n",
    "`--device=paper` option must be correct. We have\n",
    "[google](https://google.com), [google](https://google.com), and\n",
    "[google](https://google.com), which should result in exactly three\n",
    "footnotes."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 03_testdoc.md -->\n",
    "# LaTeX Mathematics\n",
    "\n",
    "Here is an equation without label using backslash-bracket environment:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "$$\n",
    "a = b + c\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "or with number and label, as in ([6](my:eq1.html#my:eq1)), using the equation environment:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- Equation labels as ordinary links -->\n",
    "<div id=\"my:eq1\"></div>\n",
    "\n",
    "$$\n",
    "\\begin{equation}\n",
    "{\\partial u\\over\\partial t} = \\nabla^2 u \\label{my:eq1} \\tag{6}\n",
    "\\end{equation}\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "We can refer to this equation by ([6](my:eq1.html#my:eq1)).\n",
    "\n",
    "Here is a system without equation numbers, using the align-asterisk environment:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "$$\n",
    "\\begin{align*}\n",
    "\\pmb{a} &= \\pmb{q}\\times\\pmb{n} \\\\ \n",
    "b &= \\nabla^2 u + \\nabla^4 v\n",
    "\\end{align*}\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "And here is a system of equations with labels in an align environment:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- Equation labels as ordinary links -->\n",
    "<div id=\"eq1\"></div>\n",
    "\n",
    "$$\n",
    "\\begin{equation}\n",
    "a = q + 4 + 5+ 6 \\label{eq1} \\tag{7} \n",
    "\\end{equation}\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- Equation labels as ordinary links -->\n",
    "<div id=\"eq2\"></div>\n",
    "\n",
    "$$\n",
    "\\begin{equation}  \n",
    "b = \\nabla^2 u + \\nabla^4 x \\label{eq2} \\tag{8}\n",
    "\\end{equation}\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "We can refer to ([7](eq1.html#eq1))-([8](eq2.html#eq2)). They are a bit simpler than\n",
    "the Navier - Stokes equations. And test LaTeX hyphen in `CG-2`.\n",
    "Also test $a_{i-j}$ as well as $kx-wt$.\n",
    "\n",
    "Testing `alignat` environment:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- Equation labels as ordinary links -->\n",
    "<div id=\"eq1a\"></div>\n",
    "\n",
    "$$\n",
    "\\begin{equation}\n",
    "a = q + 4 + 5+ 6\\qquad  \\mbox{for } q\\geq 0 \\label{eq1a} \\tag{9} \n",
    "\\end{equation}\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- Equation labels as ordinary links -->\n",
    "<div id=\"eq2a\"></div>\n",
    "\n",
    "$$\n",
    "\\begin{equation}  \n",
    "b = \\nabla^2 u + \\nabla^4 x  x\\in\\Omega \\label{eq2a} \\tag{10}\n",
    "\\end{equation}\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "More mathematical typesetting is demonstrated in the coming exercises.\n",
    "\n",
    "Below, we have [Problem: Flip a Coin](demo:ex:1.html#demo:ex:1) and [demo:ex:2](04_04_testdoc.html#demo:ex:2),\n",
    "as well as [Project: Explore Distributions of Random Circles](proj:circle1.html#proj:circle1) and [Project: References to Project [demo:ex:2](04_04_testdoc.html#demo:ex:2) in a heading works for pandoc](#exer:you), and in\n",
    "between there we have [Exercise: Make references to projects and problems](06_01_testdoc.html#exer:some:formula)."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 04_testdoc.md -->\n",
    "# Exercises"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 04_01_testdoc.ipynb -->\n",
    "# Problem: Flip a Coin\n",
    "\n",
    "<div id=\"demo:ex:1\"></div>\n",
    "files = flip_coin.py, flip_coin.pdf\n",
    "solutions = mysol.txt, mysol_flip_coin.py\n",
    "keywords = random numbers; Monte Carlo simulation; ipynb\n",
    "\n",
    "<!-- Torture tests -->\n",
    "file=myfile_should_be_a_part_of_the_text\n",
    "solutions = mysol.txt, mysol_flip_coin.py, yet_another.file\n",
    "\n",
    "!bsubex\n",
    "Make a program that simulates flipping a coin $N$ times.\n",
    "Print out \"tail\" or \"head\" for each flip and\n",
    "let the program count the number of heads.\n",
    "\n",
    "**Hint.**\n",
    "\n",
    "Use `r = random.random()` and define head as `r <= 0.5`.\n",
    "\n",
    "\n",
    "\n",
    "**Hint.**\n",
    "\n",
    "Draw an integer among $\\{1,2\\}$ with\n",
    "`r = random.randint(1,2)` and define head when `r` is 1.\n",
    "\n",
    "\n",
    "\n",
    "!bans\n",
    "If the `random.random()` function returns a number $<1/2$, let it be\n",
    "head, otherwise tail. Repeat this $N$ number of times.\n",
    "!eans\n",
    "\n",
    "!bsol"
   ]
  },
  {
   "cell_type":"code",
   "execution_count":9,
   "metadata":{
    "collapsed":false,
    "editable":true
   },
   "outputs":[],
   "source":[
    "import sys, random\n",
    "N = int(sys.argv[1])\n",
    "heads = 0\n",
    "for i in range(N):\n",
    "    r = random.random()\n",
    "    if r <= 0.5:\n",
    "        heads += 1\n",
    "print('Flipping a coin %d times gave %d heads' % (N, heads))"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "!esol\n",
    "!esubex\n",
    "\n",
    "!bsubex\n",
    "Vectorize the code in a) using boolean indexing.\n",
    "!esubex\n",
    "\n",
    "Vectorized code can be written in many ways.\n",
    "Sometimes the code is less intuitive, sometimes not.\n",
    "At least there is not much to find in the section [Section 1](02_testdoc.html#sec1).\n",
    "\n",
    "!bsubex\n",
    "Vectorize the code in a) using `numpy.sum`.\n",
    "\n",
    "!bans\n",
    "`np.sum(np.where(r <= 0.5, 1, 0))` or `np.sum(r <= 0.5)`.\n",
    "!eans\n",
    "!esubex\n",
    "\n",
    "In this latter subexercise, we have an\n",
    "example where the code is easy to read.\n",
    "\n",
    "**Remarks.**\n",
    "\n",
    "These are the exercise remarks, appearing at the very end.\n",
    "\n",
    "\n",
    "\n",
    "### My remarks\n",
    "\n",
    "Remarks with such a subsubsection is treated as more text\n",
    "after the last subexercise. Test a list too:\n",
    "\n",
    "1. Mark 1.\n",
    "\n",
    "2. Mark 2."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 04_02_testdoc.md -->\n",
    "# Not an exercise\n",
    "\n",
    "Should be possible to stick a normal section in the middle of many\n",
    "exercises."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 04_03_testdoc.md -->\n",
    "# Exercise: Test of plain text exercise\n",
    "\n",
    "<div id=\"my:exer1\"></div>\n",
    "file=myexer1\n",
    "\n",
    "Very short exercise. What is the capital\n",
    "of Norway?"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 04_04_testdoc.md -->\n",
    "# Project: Compute a Probability\n",
    "\n",
    "<!-- Minimalistic exercise -->\n",
    "\n",
    "<div id=\"demo:ex:2\"></div>\n",
    "\n",
    "What is the probability of getting a number between 0.5 and 0.6 when\n",
    "drawing uniformly distributed random numbers from the interval $[0,1)$?\n",
    "\n",
    "**Hint.**\n",
    "\n",
    "To answer this question empirically, let a program\n",
    "draw $N$ such random numbers using Python's standard `random` module,\n",
    "count how many of them, $M$, that fall in the interval $(0.5,0.6)$, and\n",
    "compute the probability as $M/N$.\n",
    "\n",
    "\n",
    "\n",
    "At the end we have a list because that caused problems in LaTeX\n",
    "in previous DocOnce versions:\n",
    "\n",
    "1. item1\n",
    "\n",
    "2. item2"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 04_05_testdoc.ipynb -->\n",
    "# Project: Explore Distributions of Random Circles\n",
    "\n",
    "<div id=\"proj:circle1\"></div>\n",
    "file=circles\n",
    "kw=ipynb\n",
    "\n",
    "The formula for a circle is given by"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- Equation labels as ordinary links -->\n",
    "<div id=\"circle:x\"></div>\n",
    "\n",
    "$$\n",
    "\\begin{equation}\n",
    "x = x_0 + R\\cos 2\\pi t,\n",
    "\\label{circle:x} \\tag{11}\n",
    "\\end{equation}\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- Equation labels as ordinary links -->\n",
    "<div id=\"circle:y\"></div>\n",
    "\n",
    "$$\n",
    "\\begin{equation}  \n",
    "y = y_0 + R\\sin 2\\pi t,\n",
    "\\label{circle:y} \\tag{12}\n",
    "\\end{equation}\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "where $R$ is the radius of the circle, $(x_0,y_0)$ is the\n",
    "center point, and $t$ is a parameter in the unit interval $[0,1]$.\n",
    "For any $t$, $(x,y)$ computed from ([11](circle:x.html#circle:x))-([12](circle:y.html#circle:y))\n",
    "is a point on the circle.\n",
    "The formula can be used to generate `n` points on a circle:"
   ]
  },
  {
   "cell_type":"code",
   "execution_count":10,
   "metadata":{
    "collapsed":false,
    "editable":true
   },
   "outputs":[],
   "source":[
    "import numpy as np\n",
    "\n",
    "def circle(R, x0, y0, n=501):\n",
    "    t = np.linspace(0, 1, n)\n",
    "    x = x0 + R*np.cos(2*np.pi*t)\n",
    "    y = y0 + R*np.sin(2*np.pi*t)\n",
    "    return x, y\n",
    "\n",
    "x, y = circle(2.0, 0, 0)"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- Often in an exercise we have some comments about the solution -->\n",
    "<!-- which we normally want to keep where they are. -->\n",
    "\n",
    "The goal of this project is to draw $N$ circles with random\n",
    "center and radius. Plot each circle using the `circle` function\n",
    "above.\n",
    "\n",
    "!bsubex\n",
    "Let $R$ be normally distributed and $(x_0,y_0)$ uniformly distributed.\n",
    "\n",
    "!bans\n",
    "Here goes the short answer to part a).\n",
    "!eans\n",
    "\n",
    "!bsol\n",
    "Here goes a full solution to part a).\n",
    "!esol\n",
    "\n",
    "**Hint.**\n",
    "\n",
    "Use the `numpy.random` module to draw the\n",
    "$x_0$, $y_0$, and $R$ quantities.\n",
    "\n",
    "\n",
    "\n",
    "!esubex\n",
    "\n",
    "!bsubex\n",
    "Let $R$ be uniformly distributed and $(x_0,y_0)$ normally distributed.\n",
    "\n",
    "file=norm  # test local filename for subexercise\n",
    "!esubex\n",
    "\n",
    "!bsubex\n",
    "Let $R$ and $(x_0,y_0)$ be normally distributed.\n",
    "!esubex\n",
    "\n",
    "**Remarks.**\n",
    "\n",
    "At the very end of the exercise it may be appropriate to summarize\n",
    "and give some perspectives."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 04_06_testdoc.ipynb -->\n",
    "# Exercise: Determine some Distance\n",
    "\n",
    "<div id=\"exer:dist\"></div>\n",
    "\n",
    "Intro to this exercise. Questions are in subexercises below.\n",
    "\n",
    "!bsubex\n",
    "Subexercises are numbered a), b), etc.\n",
    "\n",
    "file=subexer_a.pdf\n",
    "\n",
    "!bans\n",
    "Short answer to subexercise a).\n",
    "With math in answer: $a=b$.\n",
    "!eans\n",
    "\n",
    "**Hint.**\n",
    "\n",
    "First hint to subexercise a).\n",
    "With math $a=b$ in hint:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "$$\n",
    "a=b.\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "And with code (in plain verbatim) returning $x+1$ in hint:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "        def func(x):\n",
    "            return x + 1  # with code in hint\n"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "**Hint.**\n",
    "\n",
    "Second hint to subexercise a).\n",
    "\n",
    "Test list in hint:\n",
    "\n",
    "1. item1\n",
    "\n",
    "2. item2\n",
    "\n",
    "\n",
    "!esubex\n",
    "\n",
    "!bsubex\n",
    "Here goes the text for subexercise b).\n",
    "\n",
    "file=subexer_b.pdf\n",
    "\n",
    "Some math $\\cos^2 x + \\sin^2 x = 1$ written one a single line:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "$$\n",
    "\\cos^2 x + \\sin^2 x = 1 \\thinspace .\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "**Hint.**\n",
    "\n",
    "A hint for this subexercise.\n",
    "\n",
    "\n",
    "\n",
    "!bsol\n",
    "Here goes the solution of this subexercise.\n",
    "!esol\n",
    "!esubex\n",
    "\n",
    "**Remarks.**\n",
    "\n",
    "Some final closing remarks, e.g., summarizing the main findings\n",
    "and their implications in other problems can be made. These\n",
    "remarks will appear at the end of the typeset exercise.\n",
    "\n",
    "\n",
    "\n",
    "!bsol\n",
    "Here goes a full solution of the whole exercise.\n",
    "With some math $a=b$ in this solution:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "$$\n",
    "\\hbox{math in solution: } a = b\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "And code `a=b` in this solution:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "        a = b  # code in solution\n"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "End of solution is here.\n",
    "!esol\n",
    "\n",
    "<!-- No meaning in this weired test example: -->\n",
    "The text here belongs to the main (intro) part of the exercise. Need\n",
    "closing remarks to have text after subexercises.\n",
    "\n",
    "Test list in exercise:\n",
    "\n",
    "1. item1\n",
    "\n",
    "2. item2"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 04_07_testdoc.ipynb -->\n",
    "# {Exercise}: Some exercise without the \"Exercise:\" prefix\n",
    "\n",
    "<!-- Another minimalistic exercise -->\n",
    "\n",
    "Just some text. And some math saying that $e^0=1$ on a single line,\n",
    "to test that math block insertion is correct:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "$$\n",
    "\\exp{(0)} = 1\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "And a test that the code `lambda x: x+2` is correctly placed here:"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "        lambda x: x+2\n"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- Have some comments at the end of the exercise to see that -->\n",
    "<!-- the Filename: ... is written correctly. -->"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 04_08_testdoc.ipynb -->\n",
    "# Exercise: Solution of differential equation\n",
    "\n",
    "<div id=\"sec:this:exer:de\"></div>\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "**Question:** Given"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "$$\n",
    "\\frac{dy}{dx} = -y(x),\\quad y(0)=1\n",
    "$$"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "What is the solution of this equation?\n",
    "\n",
    "**Choice A:**\n",
    " $y=e^{-y}$\n",
    "\n",
    "**Choice B:**\n",
    " $y=e^{y}$\n",
    "\n",
    "**Choice C:**"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "from math import exp\n",
    "def f(x):\n",
    "    return exp(x)\n"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "**Choice D:**\n",
    " The solution cannot be found because there is a derivative in the equation.\n",
    "\n",
    "**Choice E:**\n",
    " The equation is meaningless: an equation must be an equation\n",
    "for $x$ or $y$, not a function $y(x)$."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 04_09_testdoc.md -->\n",
    "# Example: Just an example\n",
    "\n",
    "<!-- This example needs the --examples_as_exercises option, otherwise -->\n",
    "<!-- it is just typeset as it is written. -->\n",
    "\n",
    "!bsubex\n",
    "What is the capital of Norway?\n",
    "\n",
    "!bans\n",
    "Oslo.\n",
    "!eans\n",
    "!esubex"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 05_testdoc.md -->\n",
    "# Here goes another section\n",
    "\n",
    "With some text, before we continue with exercises."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 06_testdoc.md -->\n",
    "# More Exercises"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 06_01_testdoc.md -->\n",
    "# Exercise: Make references to projects and problems\n",
    "\n",
    "<div id=\"exer:some:formula\"></div>\n",
    "file=verify_formula.py\n",
    "\n",
    "<!-- Test comments not at the end only -->\n",
    "Pick a statement from [Project: Explore Distributions of Random Circles](proj:circle1.html#proj:circle1) or [Problem: Flip a Coin](demo:ex:1.html#demo:ex:1)\n",
    "and verify it.\n",
    "\n",
    "Test list at the end of an exercise without other elements (like subexercise,\n",
    "hint, etc.):\n",
    "\n",
    "1. item1\n",
    "\n",
    "2. item2"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 06_02_testdoc.md -->\n",
    "# Project: References to [demo:ex:2](04_04_testdoc.html#demo:ex:2) in a heading works for pandoc\n",
    "\n",
    "<div id=\"exer:you\"></div>\n",
    "file=selc_composed.pdf\n",
    "\n",
    "Refer to the previous exercise as [Exercise: Make references to projects and problems](06_01_testdoc.html#exer:some:formula),\n",
    "the two before that as [demo:ex:2](04_04_testdoc.html#demo:ex:2) and [Project: Explore Distributions of Random Circles](proj:circle1.html#proj:circle1),\n",
    "and this one as [Project: References to Project [demo:ex:2](04_04_testdoc.html#demo:ex:2) in a heading works for pandoc](#exer:you)."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 07_testdoc.md -->\n",
    "# References\n",
    "\n",
    "<!-- begin bibliography -->\n",
    "1. <a name=\"Langtangen_Pedersen_2002\"></a> **H. P. Langtangen and G. Pedersen**. \n",
    "    Propagation of Large Destructive Waves,\n",
    "    *International Journal of Applied Mechanics and Engineering*,\n",
    "    7(1),\n",
    "    pp. 187-204,\n",
    "    2002.\n",
    "\n",
    "2. <a name=\"Langtangen_et_al_2002\"></a> **H. P. Langtangen, K.-A. Mardal and R. Winther**. \n",
    "    Numerical Methods for Incompressible Viscous Flow,\n",
    "    *Advances in Water Resources*,\n",
    "    25,\n",
    "    pp. 1125-1146,\n",
    "    2002.\n",
    "\n",
    "3. <a name=\"Langtangen_1994a\"></a> **H. P. Langtangen**. \n",
    "    Numerical Solution of First Passage Problems in Random Vibrations,\n",
    "    *SIAM Journal of Scientific and Statistical Computing*,\n",
    "    15,\n",
    "    pp. 997-996,\n",
    "    1994.\n",
    "\n",
    "4. <a name=\"Mardal_et_al_2003a\"></a> **K.-A. Mardal, G. W. Zumbusch and H. P. Langtangen**. \n",
    "    Software Tools for Multigrid Methods,\n",
    "    *Advanced Topics in Computational Partial Differential Equations - Numerical Methods and Diffpack Programming*,\n",
    "    edited by **H. P. Langtangen and A. Tveito**,\n",
    "    Springer,\n",
    "    2003,\n",
    "    Edited book,\n",
    "    <http://some.where.org>.\n",
    "\n",
    "5. <a name=\"Langtangen_1988d\"></a> **H. P. Langtangen**. \n",
    "    The FEMDEQS Program System,\n",
    "    *Department of Mathematics, University of Oslo*,\n",
    "    1989,\n",
    "    <http://www.math.uio.no/old/days/hpl/femdeqs.pdf>.\n",
    "\n",
    "6. <a name=\"Langtangen_1992c\"></a> **H. P. Langtangen**. \n",
    "    Stochastic Breakthrough Time Analysis of an Enhanced Oil Recovery Process,\n",
    "    *SIAM Journal on Scientific Computing*,\n",
    "    13,\n",
    "    pp. 1394-1417,\n",
    "    1992.\n",
    "\n",
    "7. <a name=\"Mortensen_et_al_2011\"></a> **M. Mortensen, H. P. Langtangen and G. N. Wells**. \n",
    "    A FEniCS-Based Programming Framework for Modeling Turbulent Flow by the Reynolds-Averaged Navier-Stokes Equations,\n",
    "    *Advances in Water Resources*,\n",
    "    34(9),\n",
    "    [doi: 10.1016/j.advwatres.2011.02.013](https://dx.doi.org/10.1016/j.advwatres.2011.02.013),\n",
    "    2011.\n",
    "\n",
    "8. <a name=\"Glimsdal_et_al_20006\"></a> **S. Glimsdal, G. Pedersen, K. Atakan, C. B. Harbitz, H. P. Langtangen and F. L\\ovholt**. \n",
    "    Propagation of the Dec. 26, 2004 Indian Ocean Tsunami: Effects of Dispersion and Source Characteristics,\n",
    "    *International Journal of Fluid Mechanics Research*,\n",
    "    33(1),\n",
    "    pp. 15-43,\n",
    "    2006.\n",
    "\n",
    "9. <a name=\"Rahman_et_al_2006b\"></a> **S. Rahman, J. Gorman, C. H. W. Barnes, D. A. Williams and H. P. Langtangen**. \n",
    "    Numerical Investigation of a Piezoelectric Surface Acoustic Wave Interaction With a One-Dimensional Channel,\n",
    "    *Physical Review B: Condensed Matter and Materials Physics*,\n",
    "    74,\n",
    "    2006,\n",
    "    035308.\n",
    "\n",
    "10. <a name=\"Haga_et_al_2011a\"></a> **J. B. Haga, H. Osnes and H. P. Langtangen**. \n",
    "    On the Causes of Pressure Oscillations in Low-Permeable and Low-Compressible Porous Media,\n",
    "    *International Journal of Analytical and Numerical Methods in Geomechanics*,\n",
    "    [doi: 10.1002/nag.1062](https://dx.doi.org/10.1002/nag.1062),\n",
    "    2011,\n",
    "    <http://onlinelibrary.wiley.com/doi/10.1002/nag.1062/abstract>.\n",
    "\n",
    "11. <a name=\"Langtangen_2003a\"></a> **H. P. Langtangen**. \n",
    "    *Computational Partial Differential Equations - Numerical Methods and Diffpack Programming*,\n",
    "    second edition,\n",
    "    *Texts in Computational Science and Engineering*,\n",
    "    Springer,\n",
    "    2003.\n",
    "\n",
    "12. <a name=\"Langtangen_2008a\"></a> **H. P. Langtangen**. \n",
    "    *Python Scripting for Computational Science*,\n",
    "    third edition,\n",
    "    *Texts in Computational Science and Engineering*,\n",
    "    Springer,\n",
    "    2008.\n",
    "\n",
    "13. <a name=\"Langtangen:95\"></a> **H. P. Langtangen and G. Pedersen**. \n",
    "    Finite Elements for the Boussinesq Wave Equations,\n",
    "    Waves and Non-linear Processes in Hydrodynamics,\n",
    "    edited by **J. Grue, B. Gjevik and J. E. Weber**,\n",
    "    Kluwer Academic Publishers,\n",
    "    pp. pp. 117-126,\n",
    "    1995,\n",
    "    <http://www.amazon.ca/Waves-Nonlinear-Processes-Hydrodynamics-John/dp/0792340310>.\n",
    "\n",
    "14. <a name=\"Langtangen_2012\"></a> **H. P. Langtangen**. \n",
    "    *A Primer on Scientific Programming With Python*,\n",
    "    third edition,\n",
    "    *Texts in Computational Science and Engineering*,\n",
    "    Springer,\n",
    "    2012.\n",
    "\n",
    "15. <a name=\"Jeberg_et_al_2004\"></a> **P. V. Jeberg, H. P. Langtangen and C. B. Terp**. \n",
    "    Optimization With Diffpack: Practical Example From Welding,\n",
    "    *Simula Research Laboratory*,\n",
    "    2004,\n",
    "    Internal report.\n",
    "\n",
    "16. <a name=\"Langtangen_1989e\"></a> **H. P. Langtangen**. \n",
    "    Computational Methods for Two-Phase Flow in Oil Reservoirs,\n",
    "    Ph.D. Thesis,\n",
    "    Mechanics Division, Department of Mathematics, University of Oslo,\n",
    "    1989,\n",
    "    Dr. Scient. thesis..\n",
    "\n",
    "17. <a name=\"Langtangen_talk_2007a\"></a> **H. P. Langtangen**. \n",
    "    Computational Modeling of Huge Tsunamis From Asteroid Impacts,\n",
    "    2007,\n",
    "    Invited keynote lecture at the \\emphInternational conference on Computational Science 2007 (ICCS'07), Beijing, China.\n",
    "\n",
    "18. <a name=\"Langtangen:85\"></a> **H. P. Langtangen**. \n",
    "    Solution of the Navier-Stokes Equations With the Finite Element Method in Two and Three Dimensions,\n",
    "    M.Sc. Thesis,\n",
    "    Mechanics Division, Department of Mathematics, University of Oslo,\n",
    "    1985,\n",
    "    Cand.Scient. thesis.\n",
    "\n",
    "19. <a name=\"Langtangen:91\"></a> **H. P. Langtangen and A. Tveito**. \n",
    "    Numerical Methods in Continuum Mechanics,\n",
    "    *Center for Industrial Research*,\n",
    "    1991,\n",
    "    Lecture notes for a course (ME-IN 324). 286 pages..\n",
    "\n",
    "20. <a name=\"Langtangen:94b\"></a> **H. P. Langtangen**. \n",
    "    Diffpack: Software for Partial Differential Equations,\n",
    "    *Proceedings of the Second Annual Object-Oriented Numerics Conference (OON-SKI'94), Sunriver, Oregon, USA*,\n",
    "    edited by **A. Vermeulen**,\n",
    "    1994.\n",
    "\n",
    "<!-- end bibliography -->"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 08_testdoc.md -->\n",
    "# Appendix: Just for testing; part I\n",
    "\n",
    "<div id=\"app1\"></div>\n",
    "\n",
    "This is the first appendix."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 08_01_testdoc.md -->\n",
    "# A subsection within an appendix\n",
    "\n",
    "Some text."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 09_testdoc.md -->\n",
    "# Appendix: Just for testing; part II\n",
    "\n",
    "<div id=\"app2\"></div>\n",
    "\n",
    "This is more stuff for an appendix."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 09_01_testdoc.md -->\n",
    "# Appendix: Testing identical titles\n",
    "\n",
    "Without label."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 09_02_testdoc.md -->\n",
    "# Appendix: Testing identical titles\n",
    "\n",
    "<div id=\"test:title:id1\"></div>\n",
    "\n",
    "With label."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 09_03_testdoc.md -->\n",
    "# Appendix: Testing identical titles\n",
    "\n",
    "<div id=\"test:title:id2\"></div>\n",
    "\n",
    "What about inserting a quiz?\n",
    "\n",
    "\n",
    "\n",
    "## Test of quizzes\n",
    "\n",
    "\n",
    "**Fundamental test:** What is the capital of Norway?\n",
    "\n",
    "**Answer 1:**\n",
    " Stockholm\n",
    "\n",
    "**Answer 2:**\n",
    " London\n",
    "\n",
    "**Answer 3:**\n",
    " Oslo\n",
    "\n",
    "**Choice D:**\n",
    " Bergen"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 09_04_testdoc.md -->\n",
    "# Appendix: Testing identical titles\n",
    "\n",
    "Without label.\n",
    "\n",
    "**Tip.**\n",
    "\n",
    "Here is a tip or hint box, typeset as a notice box.\n",
    "\n",
    "\n",
    "\n",
    "Need a lot of text to surround the summary box.\n",
    "Version control systems allow you to record the history of files\n",
    "and share files among several computers and collaborators in a\n",
    "professional way. File changes on one computer are updated or\n",
    "merged with changes on another computer. Especially when working\n",
    "with programs or technical reports it is essential\n",
    "to have changes documented and to\n",
    "ensure that every computer and person involved in the project\n",
    "have the latest updates of the files.\n",
    "Greg Wilson' excellent [Script for Introduction to Version Control](https://software-carpentry.org/2010/07/script-for-introduction-to-version-control/) provides a more detailed motivation why you will benefit greatly\n",
    "from using version control systems.\n",
    "\n",
    "**Summary.**\n",
    "\n",
    "**Bold remark:** Make some text with this summary.\n",
    "Much testing in this document, otherwise stupid content.\n",
    "Much testing in this document, otherwise stupid content.\n",
    "Much testing in this document, otherwise stupid content.\n",
    "Much testing in this document, otherwise stupid content.\n",
    "Much testing in this document, otherwise stupid content.\n",
    "Much testing in this document, otherwise stupid content.\n",
    "Much testing in this document, otherwise stupid content.\n",
    "Much testing in this document, otherwise stupid content.\n",
    "Much testing in this document, otherwise stupid content.\n",
    "\n",
    "\n",
    "\n",
    "Projects that you want to share among several computers or project\n",
    "workers are today most conveniently stored at some web site \"in the\n",
    "cloud\" and updated through communication with that site. I strongly\n",
    "recommend you to use such sites for all serious programming and\n",
    "scientific writing work - and all other important files.\n",
    "\n",
    "The simplest services for hosting project files are [Dropbox](https://dropbox.com) and [Google Drive](https://drive.google.com).\n",
    "It is very easy to get started with these systems, and they allow you\n",
    "to share files among laptops and mobile units with as many users as\n",
    "you want. The systems offer a kind of version control in that the\n",
    "files are stored frequently (several times per minute), and you can go\n",
    "back to previous versions for the last 30 days. However, it is\n",
    "challenging  to find the right version from the past when there are\n",
    "so many of them.\n",
    "\n",
    "More seriously, when several people may edit files simultaneously, it\n",
    "can be difficult detect who did what when, roll back to previous\n",
    "versions, and to manually merge the edits when these are\n",
    "incompatible. Then one needs more sophisticated tools than Dropbox or\n",
    "Google Drive: project hosting services with true version control\n",
    "systems.  The following text aims at providing you with the minimum\n",
    "information to started with such systems. Numerous other tutorials\n",
    "contain more comprehensive material and in-depth explanations of the\n",
    "concepts and tools.\n",
    "\n",
    "The idea with project hosting services is that you have the files\n",
    "associated with a project in the cloud. Many people may share these\n",
    "files.  Every time you want to work on the project you explicitly\n",
    "update your version of the files, edit the files as you like, and\n",
    "synchronize the files with the \"master version\" at the site where the\n",
    "project is hosted.  If you at some point need to go back to a\n",
    "version of the files at some particular point in the past,\n",
    "this is an easy operation. You can also use tools to see\n",
    "what various people have done with the files in the various versions.\n",
    "\n",
    "All these services are very similar. Below we describe how you get\n",
    "started with Bitbucket, GitHub, and Googlecode. Launchpad works very\n",
    "similarly to the latter three. All the project hosting services have\n",
    "excellent introductions available at their web sites, but the recipes\n",
    "below are much shorter and aim at getting you started as quickly as\n",
    "possible by concentrating on the most important need-to-know steps.\n",
    "The Git tutorials we refer to later in this document contain more\n",
    "detailed information and constitute of course very valuable readings\n",
    "when you use version control systems every day. The point now is\n",
    "to get started."
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 09_05_testdoc.md -->\n",
    "# Appendix: Testing inline comments\n",
    "\n",
    "<!-- Names can be [ A-Za-z0-9_'+-]+ -->\n",
    "\n",
    "Projects that you want to share among several computers or project\n",
    "workers are today most conveniently stored at some web site \"in the\n",
    "cloud\" and updated through communication with that\n",
    "site. [hpl's semi opinion 1: not sure if in the cloud is\n",
    "understood by\n",
    "all.] I strongly recommend you to use such sites for all serious\n",
    "programming and scientific writing work - and all other important\n",
    "files.\n",
    "\n",
    "The simplest services for hosting project files is Dropbox. [mp 2: Simply go to <https://dropbox.com> and watch the video. It explains\n",
    "how files, like `myfile.py`, perhaps containing much math, like\n",
    "$\\partial u/\\partial t$, are easily communicated between machines.] It\n",
    "is very easy to get started with Dropbox, and it allows you to share\n",
    "files among [hpl 3: laptops and mobile units -> computers, tablets,\n",
    "and phones].\n",
    "\n",
    "<!-- Test horizontal rule -->\n",
    "\n",
    "------\n",
    "\n",
    "<!-- Coments for editing -->\n",
    "\n",
    "First[add 4: ,] consider a quantity $Q$. [edit 5: To this end, -> We note that]\n",
    "$Q>0$, because [del 6: a] negative [edit 7: quantity is -> quantities\n",
    "are] [del 8: just] negative. [add 9: This comes as no surprise.]\n",
    "\n",
    "<!-- Test tailored latex figure references with page number -->\n",
    "Let us refer to [Figure 1](02_02_testdoc.html#fig:impact) again.\n",
    "\n",
    "Test references in a list:\n",
    "\n",
    " * [Section 1](02_testdoc.html#sec1)\n",
    "\n",
    " * [Subsection 1](subsec1.html#subsec1)\n",
    "\n",
    " * [fig:impact](02_02_testdoc.html#fig:impact)"
   ]
  },
  {
   "cell_type":"markdown",
   "metadata":{
    "editable":true
   },
   "source":[
    "<!-- jupyter-book 09_06_testdoc.md -->\n",
    "# Appendix: Testing headings ending with `verbatim inline`\n",
    "\n",
    "The point here is to test 1) `verbatim` code in headings, and 2)\n",
    "ending a heading with verbatim code as this triggers a special\n",
    "case in LaTeX.\n",
    "\n",
    "We also test mdash---used as alternative to hyphen without spaces around,\n",
    "or in quotes:\n",
    "\n",
    "> *Fun is fun*.---Unknown.\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "The ndash should also be tested - as in the Hanson - Nilson equations\n",
    "on page 277 - 278.\n",
    "\n",
    "And finally, what about admons, quotes, and boxes? They are tested\n",
    "in a separate document: `admon.do.txt`.\n",
    "\n",
    "[^example-of-the-third-footnote]: Not much to add here, but the footnote\n",
    "is at the end with only one newline."
   ]
  }
 ]
}