forked from benrbray/prosemirror-math
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
101 lines (82 loc) · 7.65 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!doctype html>
<html lang="en">
<head>
<title>prosemirror-math</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="/prosemirror-math.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<article>
<!-- Content -------------------------------------->
<div class="header"><div class="center">
<div class="header-title">
<h1><code>prosemirror-math</code></h1>
<div class="links">
(install via <a href="https://www.npmjs.com/package/@benrbray/prosemirror-math">npm</a> or read more on <a href="https://github.com/benrbray/prosemirror-math">github</a>)
</div>
</div>
<section>
<p>This package provides <a href="https://prosemirror.net/">ProseMirror</a> schema and plugins for comfortably writing mathematics in a WYSIWYG style. Written in TypeScript, with math rendering handled by <a href="https://katex.org/">KaTeX</a>.</p>
Basic Usage:
<ul>
<li>Inline math nodes are delimited with <kbd>$</kbd>. After typing the closing dollar sign in an expression like <code>$\int_a^b f(x) dx$</code>, a math node will appear.
<li>To start a block math node, press <kbd>Enter</kbd> to create a blank line, then type <kbd>$$</kbd> followed by <kbd>Space</kbd>. You can type multi-line math expressions, and the result will render in display style.</li>
<li>Math nodes behave like regular text when using arrow keys or <kbd>Backspace</kbd>. From within a math node, press <kbd>Ctrl-Backspace</kbd> to delete the entire node.
<li>You can select, copy, and paste math nodes just like regular text!
<li>See the KaTeX documentation for a list of <a href="https://katex.org/docs/supported.html">supported commands</a>. In the future, you will also be able to use alternative renderers like <a href="https://www.mathjax.org/">MathJax</a>.
<li>You can define your own commands with <code>\providecommand{\cmd}{...}</code>!
</ul>
<p>The text below this line is all editable, including the math! Go ahead, try it!</p>
</section>
</div></div>
<!-- Content -------------------------------------->
<div class="content"><div class="center">
<div id="editor" spellcheck="false"></div>
</div>
</article>
<div id="editor-content" style="display:none">
<p>The <strong>tensor product</strong> of two vector spaces <math-inline>V,W</math-inline> over <math-inline>\mathbb{F}</math-inline> is a vector space <math-inline>V \otimes W</math-inline> over <math-inline>\mathbb{F}</math-inline> together with a bilinear map <math-inline>V \times W \stackrel{\otimes}{\rightarrow} V \otimes W</math-inline> with the property that when­ever <math-inline>\mathcal{B}_V, \mathcal{B}_W</math-inline> are bases for <math-inline>V,W</math-inline> respectively, the set <math-inline>\{ v_i \otimes w_j \mid v_i \in \mathcal{B}_V, w_j \in \mathcal{B}_W \}</math-inline> gives a basis for <math-inline>V \otimes W</math-inline>.</p><p>The following theorem shows that the property in the definition need not be checked for all pairs of bases; just one pair is sufficient.</p>
<p><strong>Theorem:</strong> Let <math-inline>Y</math-inline> be a vector space and <math-inline>\phi : V \times W \rightarrow Y</math-inline> be bilinear. Suppose there are bases <math-inline>\mathcal{B}_V, \mathcal{B}_W</math-inline> for <math-inline>V,W</math-inline> respectively, such that <math-inline>\phi(v \times w)</math-inline> is a basis for <math-inline>Y</math-inline>. Then the same holds for <em>any</em> pair of bases.</p><p>Let <math-inline>V, W</math-inline> be vector spaces over <math-inline>\mathbb{F}</math-inline>. Following <a href="zakharevich2015:tensor-algebra-notes">(Zakharevich 2015)</a>, our goal is to construct a vector space <math-inline>V \otimes W</math-inline> such that for any vector space <math-inline>Z</math-inline>,</p>
<math-display>\mathcal{L}(V \otimes W, Z) \cong
\big\{ \substack{\text{bilinear maps}\\{V \times W \rightarrow Z}} \big\}</math-display>
<p>Let <math-inline>A = \mathrm{Free}(V \times W)</math-inline> be the free vector space over <math-inline>\mathbb{F}</math-inline> on the product <math-inline>V \times W</math-inline>. We will demonstrate that</p>
<math-display>\mathcal{L}(A,Z) \cong \big\{ \substack{\text{functions}\\{V \times W \rightarrow Z}} \big\}</math-display>
<p>For <math-inline>v \in V, w \in W</math-inline>, define the notation <math-inline>v \otimes w \equiv \mathbb{1}_{(v,w)} \in A</math-inline>. A typical vector has the form <math-inline>f = \sum_{k=1}^n \alpha_k (v_k \otimes w_k) \in A</math-inline>. By linearity, observe that each <math-inline>T \in \mathcal{L}(A,Z)</math-inline> is determined uniquely by its values on the standard basis, exposing a bijection between <math-inline>\mathcal{L}(A,Z)</math-inline> and (nonlinear) functions <math-inline>V \times W \rightarrow Z</math-inline>.</p>
<math-display>T f
= T \left( \sum_{k=1}^n \alpha_k (v_k \otimes w_k) \right)
= \sum_{k=1}^n \alpha_k T (v_k \otimes w_k)</math-display>
<p><strong>Step 2</strong>: Since <math-inline>\mathcal{L}(A,Z)</math-inline> represents arbitrary functions, we will construct <math-inline>V \oplus W</math-inline> by shrinking <math-inline>A</math-inline> so that <math-inline>\mathcal{L}(V \times W, Z)</math-inline> represents only the bilinear maps <math-inline>V \times W \rightarrow Z</math-inline>. For example, if <math-inline>T \in \mathcal{L}(V \otimes W, Z)</math-inline> is a linear map, the following proof of bilinearity in the first argument</p>
<math-display>\begin{aligned}
T( (v_1 + v_2) \otimes w )
&= T( (v_1 \otimes w) + (v_2 \otimes w) ) \\
&= T(v_1 \otimes w) + T(v_2 \otimes w)
\end{aligned}</math-display>
<p>requires that <math-inline>(v_1 + v_2) \otimes w</math-inline> and <math-inline>(v_1 \otimes w) + (v_2 \otimes w)</math-inline> refer to the same element in <math-inline>V \otimes W</math-inline>. Starting from <math-inline>A</math-inline>, we can enforce this equivalence implicitly by defining <math-inline>V \otimes W</math-inline> to be the quotient space <math-inline>A / A_0</math-inline>, where</p>
<math-display>A_0 = \mathrm{Span}\left\{
\begin{aligned}[c]
(v_1 + v_2) \otimes w - (v_1 \otimes w) - (v_2 \otimes w) \\
v \otimes (w_1 + w_2) - (v \otimes w_1) - (v \otimes w_2) \\
(\alpha v) \otimes w - \alpha (v \otimes w) \\
v \otimes (\alpha w) - \alpha (v \otimes w)
\end{aligned}
\;\middle\vert\;
\begin{array}{l}
\alpha \in F \\ v \in V, w \in W
\end{array}
\right\}</math-display>
<p>This choice was made so that each linear map <math-inline>T \in \mathcal{L}(V \otimes W, Z)</math-inline> will satisfy</p>
<math-display>\begin{aligned}
T( (v_1 + v_2) \otimes w) &= T(v_1 \otimes w) + T(v_2 \otimes w) \\
T( v \otimes (w_1 + w_2)) &= T(v \otimes w_1) + T(v \otimes w_2) \\
T( (\alpha v) \otimes w ) &= T( \alpha ( v \otimes w) ) \\
T( v \otimes (\alpha w) ) &= T( \alpha ( v \otimes w) )
\end{aligned}</math-display>
<p>
(Technically, <math-inline>(v \otimes w) \in V \otimes W</math-inline> stands for the equivalence class of <math-inline>v \otimes w = \mathbb{1}_{(v,w)} \in A</math-inline>.)
</p>
<p>As pointed out by <a href="purbhoo2012:tensor-product-notes">Purbhoo 2012</a>, since <math-inline>A = \mathrm{Free}(V \times W)</math-inline> is the space of formal linear combinations of <math-inline>(v,w)</math-inline> pairs, <math-inline>A_0</math-inline> is the space of those linear combinations that can be simplified to the zero vector using bilinearity. Accordingly, <math-inline>A / A_0</math-inline> reduces <math-inline>A</math-inline> to a space where two expressions are equal iff one can be simplified to the other using bilinearity.</p>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>