Mathematical Notation
Sage supports mathematical notation using
MathJax,
a cross-browser JavaScript library that
displays math notation in web browsers,
using MathML,
LaTeX,
and AsciiMath markup.
Use the [=] tag for AsciiMath notation…
[=]d^n/dx^n (x^n) = n![end]
The above produces…
~TAgbn4{d^n/dx^n (x^n) = n!}TAgbn4~
Read on for details about AsciiMath.
Note: {: and :} are invisible brackets, as shown above.
They often match with a visible bracket,
though when used together, they make an invisible element.
For example, {::}_(\ \ 92)^238U yields ~TAgbn4{{::}_(\ \ 92)^238U}TAgbn4~ .
~TAgbn4{d^n/dx^n (x^n) = n!}TAgbn4~
Code | Symbol |
---|---|
+ | |
- | |
* | |
** | |
*** | |
// | |
\\ | |
xx | |
-: | |
|>< | |
><| | |
|><| | |
@ | |
o+ | |
ox | |
o. | |
sum | ~TAgbn4{sum}TAgbn4~
|
prod | ~TAgbn4{prod}TAgbn4~
|
^^ | |
^^^ | ~TAgbn4{^^^}TAgbn4~
|
vv | |
vvv | ~TAgbn4{vvv}TAgbn4~
|
nn | |
nnn | ~TAgbn4{nnn}TAgbn4~
|
uu | |
uuu | ~TAgbn4{uuu}TAgbn4~
|
Code | Symbol |
---|---|
2/3 | |
2^3 | |
a_i | |
sqrt x | |
root(3)(x) | |
int | |
oint | |
del | |
grad | |
+- | |
O/ | |
oo | |
aleph | |
:. | |
:' | |
|...| | |
|cdots| | |
vdots | |
ddots | |
|\ | | |
|quad| | |
/_ | |
frown | |
/_\ | |
diamond | |
square | |
|__ | |
__| | |
|~ | |
~| | |
CC | |
NN | |
| |
RR | |
ZZ | |
"hello" | |
Code | Symbol |
---|---|
= | |
!= | |
< | |
> | |
<= | |
>= | |
mlt | |
< | |
m | |
-< | |
-<= | |
>- | |
>-= | |
in | |
!in | |
sub | |
sup | |
sube | |
supe | |
-= | |
~= | |
~~ | |
prop | |
Code | Symbol |
---|---|
and | |
or | |
not | |
=> | |
if | |
<=> | |
AA | |
EE | |
_|_ | |
TT | |
|-- | |
|== | |
Code | Symbol |
---|---|
( | |
) | |
[ | |
] | |
{ | |
} | |
(: | |
:) | |
<< | |
>> | |
{: x ) | |
( x :} | |
abs(x) | |
floor(x) | |
ceil(x) | |
norm(vecx) | |
For example, {::}_(\ \ 92)^238U yields ~TAgbn4{{::}_(\ \ 92)^238U}TAgbn4~ .
Code | Symbol |
---|---|
hat x | |
bar x | |
ul x | |
vec x | |
tilde x | |
dot x | |
ddot x | |
overset(x)(=) | |
underset(x)(=) | |
ubrace(1+2) | |
obrace(1+2) | |
overarc(AB) | |
color(red)(x) | |
cancel(x) | |
Code | Symbol |
---|---|
alpha | |
beta | |
gamma | |
Gamma | |
delta | |
Delta | |
epsilon | |
varepsilon | |
zeta | |
eta | |
theta | |
Theta | |
vartheta | |
iota | |
kappa | |
lambda | |
Lambda | |
mu | |
nu | |
xi | |
Xi | |
pi | |
Pi | |
rho | |
sigma | |
Sigma | |
tau | |
upsilon | |
phi | |
Phi | |
varphi | |
chi | |
psi | |
Psi | |
omega | |
Omega | |
Code | Symbol |
---|---|
bb "AaBbCc" | |
bbb "AaBbCc" | |
cc "AaBbCc" | |
tt "AaBbCc" | |
fr "AaBbCc" | |
sf "AaBbCc" | |
sin, cos, tan, sec, csc, cot, arcsin, arccos,
arctan, sinh, cosh, tanh, sech, csch, coth, exp,
log, ln, det, dim, mod, gcd, lcm, lub, glb,
min, max, f, g.
Matrices:
For more details on the AsciiMath notation,
visit https://asciimath.org/.
[[a,b],[c,d]] yields
~TAgbn4{[[a,b],[c,d]]}TAgbn4~
Column vectors:
((a),(b)) yields
~TAgbn4{((a),(b))}TAgbn4~
Augmented matrices:
[[a,b,|,c],[d,e,|,f]] yields
~TAgbn4{[[a,b,|,c],[d,e,|,f]]}TAgbn4~
Matrices can be used for layout:
{(2x,+,17y,=,23),(x,-,y,=,5):} yields
~TAgbn4{{(2x,+,17y,=,23),(x,-,y,=,5):}}TAgbn4~
Complex subscripts:
lim_(N->oo) sum_(i=0)^N yields
~TAgbn4{lim_(N->oo) sum_(i=0)^N}TAgbn4~
Subscripts must come before superscripts:
int_0^1 f(x)dx yields
~TAgbn4{int_0^1 f(x)dx}TAgbn4~
Derivatives:
f'(x) = dy/dx yields
~TAgbn4{f'(x) = dy/dx}TAgbn4~
For variables other than x, y, z, or t,
you will need grouping symbols:
(dq)/(dp) for
~TAgbn4{(dq)/(dp)}TAgbn4~
Underbraces:
ubrace(1+2+3+4)_("4 terms") yields
~TAgbn4{ubrace(1+2+3+4)_("4 terms")}TAgbn4~
Overbraces:
obrace(1+2+3+4)^("4 terms") yields
~TAgbn4{obrace(1+2+3+4)^("4 terms")}TAgbn4~
Prescripts:
{::}_(\ \ 92)^238U yields
~TAgbn4{{::}_(\ \ 92)^238U}TAgbn4~
Forced spaces:
\ (backslash followed by a space)
yields a non-breaking space.
Example: a\ b yields ~TAgbn4{a\ b}TAgbn4~ but a b yields ~TAgbn4{a b}TAgbn4~
Stacking: use stackrel to stack elements:Example: a\ b yields ~TAgbn4{a\ b}TAgbn4~ but a b yields ~TAgbn4{a b}TAgbn4~
stackrel"def"= yields
~TAgbn4{stackrel"def"=}TAgbn4~
Use the [mathi] and [mathd] tags
for LaTeX notation.
The [mathi] tag
is for inline notation…
Einstein's famous [mathi]E = mc^2[end] discovery.
The above produces…
Einstein's famous ~TAgbn4(E = mc^2)TAgbn4~ discovery.
In contrast, the [mathd] tag
is for "display" notation…
Einstein's famous [mathd]E = mc^2[end] discovery.
The above produces…
Einstein's famous ~TAgbn4[E = mc^2]TAgbn4~ discovery.
For details on the LaTeX notation,
visit https://www.latex-project.org/.
Einstein's famous ~TAgbn4(E = mc^2)TAgbn4~ discovery.
Einstein's famous ~TAgbn4[E = mc^2]TAgbn4~ discovery.
Use the [mathml] tag for MathML notation…
The area of a circle is
[mathml]
<mi>π</mi>
<mo>⁢</mo>
<msup>
<mi>r</mi>
<mn>2</mn>
</msup>
[end]
The above produces…
The area of a circle is
For details on the MathML notation,
visit https://www.w3.org/TR/MathML/
or https://www.iso.org/standard/58439.html.
The area of a circle is
⏱ Last Modified: 1/6 11:08:10 am