The following are taken from official examples for now.
Markdown Basics
superscript2 / subscript2
verbatim code
Line Block
Spaces and newlines
are preserved
Here’s some raw inline HTML: html
- term
- a long long long long long definition
inline math: $E = mc^{2} \in \RR$
display math:
$$E = mc^{2} \in \RR$$Right | Left | Default | Center |
---|---|---|---|
12 | 12 | 12 | 12 |
123 | 123 | 123 | 123 |
1 | 1 | 1 | 1 |
1 + 1
run.py
1 + 1
library(tidyverse)
library(palmerpenguins)
penguins |>
mutate(
bill_ratio = bill_depth_mm / bill_length_mm,
bill_area = bill_depth_mm * bill_length_mm
)
- Line 3
- Take
penguins
, and then, - Lines 4-7
- add new columns for the bill ratio and bill area.
(TODO: Highlight conflicted, code annotation JS disabled)
Tip 1
Note that there are five types of callouts, including:
note
,tip
,warning
,caution
, andimportant
.
(TODO: Callouts are not working for hugo-md
, Bootstrap disabled too)
To print, press Shift-Ctrl-P
. To open an existing new project, press Shift-Ctrl-L
(linux), Shift-Command-O
(mac), Shift-Control-O
(windows).
(TODO: shortcuts are not working for hugo-md
, disabled)
Figures
Scholarly Writing
Citations
See (Baez, 2002).
(TODO: citation linking and hover requires link-citations: true
and extra hacking, see “PORTING NOTE” in layouts/partials/quarto.html
)
Footnotes
Here is a footnote reference,1 and another note with multiple blocks.2
This paragraph won’t be part of the note, because it isn’t indented.
Here is an inline note.3
Cross-References
For a demonstration of a line plot on a polar axis, see Figure 2.
For tips on callouts, see Tip 1. (TODO: Not working for hugo-md
)
Literate programming
Python
Code
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
plt.plot([1,23,2,4])
plt.show()
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
Figure 2: A line plot on a polar axis
The following example is based on 3DCGA: Intersections:
Code
from kingdon import Algebra
alg = Algebra(4, 1)
locals().update(alg.blades)
ni = e4 + e5
no = 0.5 * (e5 - e4)
nino = ni ^ no
up = lambda x: no + x + 0.5 * x * x * ni
p = up(0) # point
S = (p - 0.5 * ni).dual() # main dual sphere around point (interactive)
S2 = (up(-1.4*e1) - 0.125 * ni).dual() # left dual sphere
C = (up(1.4*e1) - 0.125 * ni).dual() & e3.dual() # right circle
L = up(0.9*e2) ^ up(0.9*e2 - 1*e1) ^ ni # top line
P = (1*e2 - 0.9*ni).dual() # bottom dual plane
P2 = (1*e1 + 1.7*ni).dual() # right dual plane
C1 = S & P
C2 = S & L
C3 = S & S2
C4 = S & C
C5 = C & P2
lp = up(nino.lc(P2 & (L ^ no)))
print("p=", p)
print("lp=", lp)
print("C1=", C1)
print("C2=", C2)
print("C3=", C3)
print("C4=", C4)
print("C5=", C5)
print("L=", L)
print("P=", P)
print("S=", S)
print("S2=", S2)
p= -0.5 𝐞₄ + 0.5 𝐞₅
lp= 0.9 𝐞₂ + -0.095 𝐞₄ + 0.905 𝐞₅
C1= -0.9 𝐞₁₂₃ + -1.0 𝐞₁₃₅
C2= 0.9 𝐞₁₂ + 1.0 𝐞₁₅ + -5.55e-17 𝐞₂₅
C3= 1.35 𝐞₁₂₃ + -1.4 𝐞₂₃₅
C4= -1.35 𝐞₁₂ + 1.4 𝐞₂₅
C5= 1.7 𝐞₁₂ + -1.02 𝐞₂₄ + -2.02 𝐞₂₅
L= 0.9 𝐞₁₂₄ + 0.9 𝐞₁₂₅ + -1.0 𝐞₁₄₅ + 5.55e-17 𝐞₂₄₅
P= -0.9 𝐞₁₂₃₄ + -0.9 𝐞₁₂₃₅ + 1 𝐞₁₃₄₅
S= -1.0 𝐞₁₂₃₅
S2= 1.35 𝐞₁₂₃₄ + 0.355 𝐞₁₂₃₅ + 1.4 𝐞₂₃₄₅
Code
alg.graph(
0x00FF0000, p, "s1", # point
0xFF00FF,lp,"l&p", # line intersect plane
0x0000FF,C1,"s&p", # sphere meet plane
0x888800,C2,"s&l", # sphere meet line
0x0088FF,C3,"s&s", # sphere meet sphere
0x008800,C4,"s&c", # sphere meet circle
0x880000,C5,"c&p", # circle meet sphere
0,L,0,C, # line and circle
0xE0008800, P, P2, # plane
0xE0FFFFFF, S, "s1", S2, # spheres
conformal=1,
grid=1,
gl=1,
)
The following example is based on Introduction to using GAlgebra:
Code
import sympy
from galgebra.ga import Ga
from galgebra.printer import latex
from IPython.display import Math
# tell sympy to use our printing by default
sympy.init_printing(latex_printer=latex, use_latex='mathjax')
xyz = (x, y, z) = sympy.symbols('x y z', real=True)
o3d = Ga('e_x e_y e_z', g=[1, 1, 1], coords=xyz)
grad = o3d.grad
a = o3d.mv('a','vector')
b = o3d.mv('b','vector')
Math(fr'''
\begin{{align}}
a &= {latex(a)} \\
b &= {latex(b)} \\
a+b &= {latex(a+b)} \\
a-b &= {latex(a-b)} \\
ab &= {latex(a*b)} \\
a\cdot b &= {latex(a|b)} \\
a \rfloor b &= {latex(a<b)} \\
a \lfloor b &= {latex(a>b)} \\
a\wedge b &= {latex(a^b)}
\end{{align}}
''')
$\displaystyle \begin{align} a &= a^{x} \boldsymbol{e}_{x} + a^{y} \boldsymbol{e}_{y} + a^{z} \boldsymbol{e}_{z} \\ b &= b^{x} \boldsymbol{e}_{x} + b^{y} \boldsymbol{e}_{y} + b^{z} \boldsymbol{e}_{z} \\ a+b &= \left ( a^{x} + b^{x}\right ) \boldsymbol{e}_{x} + \left ( a^{y} + b^{y}\right ) \boldsymbol{e}_{y} + \left ( a^{z} + b^{z}\right ) \boldsymbol{e}_{z} \\ a-b &= \left ( a^{x} - b^{x}\right ) \boldsymbol{e}_{x} + \left ( a^{y} - b^{y}\right ) \boldsymbol{e}_{y} + \left ( a^{z} - b^{z}\right ) \boldsymbol{e}_{z} \\ ab &= \left ( a^{x} b^{x} + a^{y} b^{y} + a^{z} b^{z}\right ) + \left ( a^{x} b^{y} - a^{y} b^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} + \left ( a^{x} b^{z} - a^{z} b^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + \left ( a^{y} b^{z} - a^{z} b^{y}\right ) \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \\ a\cdot b &= a^{x} b^{x} + a^{y} b^{y} + a^{z} b^{z} \\ a \rfloor b &= a^{x} b^{x} + a^{y} b^{y} + a^{z} b^{z} \\ a \lfloor b &= a^{x} b^{x} + a^{y} b^{y} + a^{z} b^{z} \\ a\wedge b &= \left ( a^{x} b^{y} - a^{y} b^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} + \left ( a^{x} b^{z} - a^{z} b^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + \left ( a^{y} b^{z} - a^{z} b^{y}\right ) \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \end{align}$
Code
B = o3d.mv('B','bivector')
Math(fr'''
\begin{{align}}
B &= {latex(B)} \\
BB &= {latex(B*B)} \\
a+B &= {latex(a+B)} \\
a-B &= {latex(a-B)} \\
aB &= {latex(a*B)} \\
a\cdot B &= {latex(a|B)} \\
a \rfloor B &= {latex(a<B)} \\
a \lfloor B &= {latex(a>B)} \\
a\wedge B &= {latex(a^B)} \\
\end{{align}}
''')
$\displaystyle \begin{align} B &= B^{xy} \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} + B^{xz} \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + B^{yz} \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \\ BB &= - {\left ( B^{xy} \right )}^{2} - {\left ( B^{xz} \right )}^{2} - {\left ( B^{yz} \right )}^{2} \\ a+B &= a^{x} \boldsymbol{e}_{x} + a^{y} \boldsymbol{e}_{y} + a^{z} \boldsymbol{e}_{z} + B^{xy} \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} + B^{xz} \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + B^{yz} \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \\ a-B &= a^{x} \boldsymbol{e}_{x} + a^{y} \boldsymbol{e}_{y} + a^{z} \boldsymbol{e}_{z} - B^{xy} \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} - B^{xz} \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} - B^{yz} \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \\ aB &= \left ( - B^{xy} a^{y} - B^{xz} a^{z}\right ) \boldsymbol{e}_{x} + \left ( B^{xy} a^{x} - B^{yz} a^{z}\right ) \boldsymbol{e}_{y} + \left ( B^{xz} a^{x} + B^{yz} a^{y}\right ) \boldsymbol{e}_{z} + \left ( B^{xy} a^{z} - B^{xz} a^{y} + B^{yz} a^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \\ a\cdot B &= \left ( - B^{xy} a^{y} - B^{xz} a^{z}\right ) \boldsymbol{e}_{x} + \left ( B^{xy} a^{x} - B^{yz} a^{z}\right ) \boldsymbol{e}_{y} + \left ( B^{xz} a^{x} + B^{yz} a^{y}\right ) \boldsymbol{e}_{z} \\ a \rfloor B &= \left ( - B^{xy} a^{y} - B^{xz} a^{z}\right ) \boldsymbol{e}_{x} + \left ( B^{xy} a^{x} - B^{yz} a^{z}\right ) \boldsymbol{e}_{y} + \left ( B^{xz} a^{x} + B^{yz} a^{y}\right ) \boldsymbol{e}_{z} \\ a \lfloor B &= 0 \\ a\wedge B &= \left ( B^{xy} a^{z} - B^{xz} a^{y} + B^{yz} a^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \\ \end{align}$
Observable JS
The following example is taken from Steven De Keninck’s Animated Orbits .
Code
Algebra = require('ganja.js@1.0.151')
Code
Algebra(3,0,1,()=>{
var t=1, E=Math.E, sin=Math.sin, cos=Math.cos, PI=Math.PI;
var f=(x,y)=> E**(x*PI*1e12)
*E**(.5e01+sin(t)*sin(x*PI*6)*.25e01)
*E**((x*2+y)*PI*1e13)
*E**(cos(t*1.31)*0.2e01+sin(t*1.31)*0.2e03);
f.dx=400; f.dy=5;
var camera=0e1+1, start=performance.now();
return (this.graph(()=>{
t=(performance.now()-start)/2234;
camera.set((1+1e03)* (Math.cos(t/4) + Math.sin(t/4)*1e13 ) );
f.va=undefined; // force re-evaluate of geometry ..
return [0xff0088,f];
},{camera,gl:1,animate:1,width:"100%",height:"600px"}));
})
The following example is taken from Steven De Keninck’s Klein Bottle:
Code
GAmphetamineModule = import('https://enki.ws/GAM/src/GAmphetamine.js')
Code
GAmphetamine = GAmphetamineModule.default
Code
kb = GAmphetamine(4,0,1,()=>{
const {E, sin, cos, PI} = Math;
const [n1,n2] = [16, 128];
const [r1,r2] = [0.15, 0.6];
var circle = r1=>[...Array(n1+1).keys()]
.map(x=>E**(x/n1 * PI * 1e12) * E**(r1*1e01) >>> !1e0)
.map((x,i,a)=>[x,a[i+1]||a[0]]);
var klein = [...Array(n2+1).keys()]
.map(x=>E**(x/n2 * PI * 1e13) * E**(r2*1e01) * E**(x/n2 * PI * 1.5e14) >>> circle(r1+0.1*sin(8*PI*x/n2)));
var edges = klein.map((t,ti)=>t.map((p,pi)=>[p[0],(klein[ti+1]||klein[0])[pi][0]])).slice(0,-1).flat()
klein = E**(-0.78e23) * E**((.5e14 + .0e24)) >>> [...klein.flat(), ...edges];
var SVG=this.graph([0x009977, ...klein], {arrowSize:0, h:0, p:-0.25});
return SVG;
})
Code
svg`${kb}`
References
Baez, J. (2002). The octonions. Bulletin of the American Mathematical Society, 39(2), 145–205. Retrieved from https://arxiv.org/pdf/math/0105155.pdf
Figueroa-O’Farrill, J. (2010). Spin geometry. Lecture Notes. University of Edinburgh. Retrieved from http://mat.uab.cat/~rubio/csa2017/SpinNotes.pdf
Reynoso, A. (2023). Probing clifford algebras through spin groups: A standard model perspective. arXiv Preprint arXiv:2312.10071. Retrieved from https://arxiv.org/pdf/2312.10071
Here is the footnote. ↩︎
Here’s one with multiple blocks.
Subsequent paragraphs are indented to show that they belong to the previous footnote.
{ some.code }
The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like multi-paragraph list items. ↩︎
Inlines notes are easier to write, since you don’t have to pick an identifier and move down to type the note. ↩︎