19 April 2017

Testing html org export

\(\newcommand{\ket}[1]{|#1\rangle}\) \(\newcommand{\pqty}[1]{\left(#1\right)}\) \(\newcommand{\pmqty}[1]{\begin{pmatrix}#1\end{pmatrix}}\)

https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html

Org Markdown

  • code
  • italics
  • bold
  • underline
  • strikethrough

Table

Weekly report starting on: [2018-09-10 Mon]

Headline Time    
Total time 1d 13:58    
QuantumComp 12:00    
  Homeworks   9:00  
    hw1     9:00
  Lectures   3:00  
    lec3     1:30
    lec4     1:30
SpectralGraph 4:30    
  Lectures   4:30  
    lec3     1:30
    lec4     1:30
    lec5     1:30
Logic 8:55    
  Homeworks   8:55  
    hw2     8:55
Probability 10:53    
  Homeworks   9:03  
    hw1     9:03
  Notes   1:50  
    app-a and u00     1:20
    u01     0:07
    u02     0:23
Writing 1:40    
  project 1 draft   1:40  

TODO Equations

update mathjax to use commonhtml http://docs.mathjax.org/en/latest/output.html

The Hamiltonian for the ising model is

\begin{equation} H = E = -h\sigma \end{equation}

where \(\sigma \in \{-1,1\}\)

An EPR pair is the state \[\ket{\Phi} = \frac{1}{\sqrt{2}}\pqty{\ket{00}+\ket{11}}\]

The which can be obtained from a Haddamard and CNOT gate: \[H= \frac{1}{\sqrt{2}}\pmqty{1&1\\1&-1}\] \[CNOT= \pmqty{1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0}\] applied as such \(CNOT((H\ket{0})\otimes\ket{0}) = \ket{\Phi}\) 1

TODO Psuedocode

This won’t work due to https://tex.stackexchange.com/questions/61281/algorithmicx-crashes-standalone and “\\documentclass[preview]{standalone}” is hard-coded in ob-latex want the #+header: :headers ’(“\\documentclass[varwidth]{standalone}” )

latex code
\begin{algorithmic}[1]
  \Function {FLIP$_{1/3}$}{$\epsilon$}
    \State $n\gets \lceil \log(1-\epsilon)  \rceil$
    \State $F \gets 0$
    \For {$i \gets 1,...n$}
      \State $F[i] \gets $
      \State $F \gets F^($FLIP$_{1/2}<<i)$
    \EndFor
    \If {$F < \frac{n}{3}$}
      \State \textbf{return} 1
    \ElsIf {$F < 3\cdot\frac{n}{3}$}
      \State \textbf{return} 0
    \Else
      \State \textbf{return} FAIL
    \EndIf
  \EndFunction
\end{algorithmic}

Tikz

Requires

  • tex4ht
  • standalone
latex code
\newcommand{\lightenvalue}{45}
\begin{tikzpicture}[scale=0.7,
node/.style={black,fill=gray,radius=0.1},
lnode/.style={black!\lightenvalue,fill=gray!\lightenvalue,radius=0.1},
edge/.style={very thick}
]
\draw[dashed,black!\lightenvalue] (-12,-12) -- (-12,12) -- (12,12) -- (12,-12) -- cycle;
\draw[dashed,black!\lightenvalue] (-4,12) -- (-4,-12);
\draw[dashed,black!\lightenvalue] (4,12) -- (4,-12);
\draw[dashed,black!\lightenvalue] (-12,4) -- (12,4);
\draw[dashed,black!\lightenvalue] (-12,-4) -- (12,-4);
\draw[dashed] (-4,-4) -- (-4,4) -- (4,4) -- (4,-4) -- cycle;

\newcommand{\nodes}{a/0/0, b/1/2, c/2/0, d/1/-2, e/-1/2, f/-2/0, g/-1/-2}
\newcommand{\vnodes}{b1/1/4, b2/2.5/4, b3/4/4,
                     c1/4/2.3, c2/4/.7, c3/4/0,
                     d1/4/-.7, d2/1/-4, d3/0/-4,
                     e1/0/4, e2/-1/4, e3/-4/.7,
                     f1/-4/0, f2/-4/-.7, f3/-4/-2.3,
                     g1/-4/-4, g2/-2.5/-4, g3/-1/-4,
                     bf1/2.5/-4, bf2/4/-2.3,
                     gc1/-2.5/4, gc2/-4/2.3}
\newcommand{\edges}{a/b, a/c, a/d, a/e, a/f, a/g,
                    b/c, b/e, c/d, d/g, e/f, f/g}
% darkgray, lightgray, olive, orange, pink, purple, teal, violet and white
\newcommand{\cedges}{b/b1/red, b/b2/green, b/b3/blue,
                     c/c1/cyan, c/c2/magenta, c/c3/yellow,
                     d/d1/orange, d/d2/red, d/d3/brown,
                     e/e1/brown, e/e2/lime, e/e3/magenta,
                     f/f1/yellow, f/f2/orange, f/f3/green,
                     g/g1/blue, g/g2/cyan, g/g3/lime,
                     bf1/bf2/green, gc1/gc2/cyan}

\foreach \l/\x/\y in \nodes \coordinate (\l) at (\x,\y);
\foreach \l/\x/\y in \vnodes \coordinate (\l) at (\x,\y);
\foreach \u/\v in \edges \draw[edge] (\u) -- (\v);
\foreach \u/\v/\c in \cedges \draw[edge,\c] (\u) -- (\v);
\foreach \l/\x/\y in \nodes \draw[node] (\l) circle;

\foreach \d/\xo/\yo in {n/0/8, s/0/-8, e/8/0, w/-8/0,
                        nw/-8/8, sw/-8/-8, ne/8/8, se/8/-8} 
{
\foreach \l/\x\y in \nodes \coordinate (\d\l) at (\x+\xo,\y+\yo);
\foreach \l/\x/\y in \vnodes \coordinate (\d\l) at (\x+\xo,\y+\yo);
\foreach \u/\v in \edges \draw[edge,black!\lightenvalue] (\d\u) -- (\d\v);
\foreach \u/\v/\c in \cedges \draw[edge,\c!\lightenvalue] (\d\u) -- (\d\v);
\foreach \l/\x/\y in \nodes \draw[lnode] (\d\l) circle;
}

\end{tikzpicture}
Sorry, your browser does not support SVG.

ipython block

Printing

ipython code
print("hello world!") (sc)
hello world!

To print “hello world!” see sc

Long running block

ipython code
import time
time.sleep(20)
time.strftime("The time is %a, %d %b %Y %H:%M:%S", time.localtime())
# Out[9]:
: 'The time is Fri, 25 Jan 2019 22:44:17'

matplotlib

ipython code
%matplotlib inline
%config InlineBackend.figure_format = 'svg'
import numpy as np
import matplotlib.pyplot as plt

plt.plot(np.arange(10), np.random.rand(10), label='random data')
plt.xlabel(r'$\beta$')
plt.ylabel(r'$\chi$')
plt.legend()
plt.title(r'$\beta$ vs $\chi$ for random data')
Text(0.5,1,'$\\beta$ vs $\\chi$ for random data')
Sorry, your browser does not support SVG.

Footnotes:

Email: akira@akirakyle.com
GPG Public Key: 963C 2413 0BD3 BF1B 624C EF4C 8850 284C 20B8 078D