Sage
Welcome to Sage
Volume (65%) Hide Volume
Topics
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.

AsciiMath

Use the [=] tag for AsciiMath notation…

[=]d^n/dx^n (x^n) = n![end]

The above produces…


~E5_g@f{d^n/dx^n (x^n) = n!}E5_g@f~


Read on for details about AsciiMath.

Operation Symbols

Code Symbol
+

~E5_g@f{+}E5_g@f~

 
-

~E5_g@f{-}E5_g@f~

 
*

~E5_g@f{*}E5_g@f~

 
**

~E5_g@f{**}E5_g@f~

 
***

~E5_g@f{***}E5_g@f~

 
//

~E5_g@f{//}E5_g@f~

 
\\

~E5_g@f{\\}E5_g@f~

 
xx

~E5_g@f{xx}E5_g@f~

 
-:

~E5_g@f{-:}E5_g@f~

 
|><

~E5_g@f{|><}E5_g@f~

 
><|

~E5_g@f{><|}E5_g@f~

 
|><|

~E5_g@f{|><|}E5_g@f~

 
@

~E5_g@f{@}E5_g@f~

 
o+

~E5_g@f{o+}E5_g@f~

 
ox

~E5_g@f{ox}E5_g@f~

 
o.

~E5_g@f{o.}E5_g@f~

 
sum

~E5_g@f{sum}E5_g@f~

 
prod

~E5_g@f{prod}E5_g@f~

 
^^

~E5_g@f{^^}E5_g@f~

 
^^^

~E5_g@f{^^^}E5_g@f~

 
vv

~E5_g@f{vv}E5_g@f~

 
vvv

~E5_g@f{vvv}E5_g@f~

 
nn

~E5_g@f{nn}E5_g@f~

 
nnn

~E5_g@f{nnn}E5_g@f~

 
uu

~E5_g@f{uu}E5_g@f~

 
uuu

~E5_g@f{uuu}E5_g@f~

 

Miscellaneous Symbols

Code Symbol
2/3

~E5_g@f{2/3}E5_g@f~

 
2^3

~E5_g@f{2^3}E5_g@f~

 
a_i

~E5_g@f{a_i}E5_g@f~

 
sqrt x

~E5_g@f{sqrt x}E5_g@f~

 
root(3)(x)

~E5_g@f{root(3)(x)}E5_g@f~

 
int

~E5_g@f{int}E5_g@f~

 
oint

~E5_g@f{oint}E5_g@f~

 
del

~E5_g@f{del}E5_g@f~

 
grad

~E5_g@f{grad}E5_g@f~

 
+-

~E5_g@f{+-}E5_g@f~

 
O/

~E5_g@f{O/}E5_g@f~

 
oo

~E5_g@f{oo}E5_g@f~

 
aleph

~E5_g@f{aleph}E5_g@f~

 
:.

~E5_g@f{:.}E5_g@f~

 
:'

~E5_g@f{:'}E5_g@f~

 
|...|

~E5_g@f{|...|}E5_g@f~

 
|cdots|

~E5_g@f{|cdots|}E5_g@f~

 
vdots

~E5_g@f{vdots}E5_g@f~

 
ddots

~E5_g@f{ddots}E5_g@f~

 
|\ |

~E5_g@f{|\ |}E5_g@f~

 
|quad|

~E5_g@f{|quad|}E5_g@f~

 
/_

~E5_g@f{/_}E5_g@f~

 
frown

~E5_g@f{frown}E5_g@f~

 
/_\

~E5_g@f{/_\}E5_g@f~

 
diamond

~E5_g@f{diamond}E5_g@f~

 
square

~E5_g@f{square}E5_g@f~

 
|__

~E5_g@f{|__}E5_g@f~

 
__|

~E5_g@f{__|}E5_g@f~

 
|~

~E5_g@f{|~}E5_g@f~

 
~|

~E5_g@f{~|}E5_g@f~

 
CC

~E5_g@f{CC}E5_g@f~

 
NN

~E5_g@f{NN}E5_g@f~

 
QQ

~E5_g@f{QQ}E5_g@f~

 
RR

~E5_g@f{RR}E5_g@f~

 
ZZ

~E5_g@f{ZZ}E5_g@f~

 
"hello"

~E5_g@f{"hello"}E5_g@f~

 

Relation Symbols

Code Symbol
=

~E5_g@f{=}E5_g@f~

 
!=

~E5_g@f{!=}E5_g@f~

 
<

~E5_g@f{<}E5_g@f~

 
>

~E5_g@f{>}E5_g@f~

 
<=

~E5_g@f{<=}E5_g@f~

 
>=

~E5_g@f{>=}E5_g@f~

 
mlt

~E5_g@f{mlt}E5_g@f~

 
<

~E5_g@f{<}E5_g@f~

 
m

~E5_g@f{m}E5_g@f~

 
-<

~E5_g@f{-<}E5_g@f~

 
-<=

~E5_g@f{-<=}E5_g@f~

 
>-

~E5_g@f{>-}E5_g@f~

 
>-=

~E5_g@f{>-=}E5_g@f~

 
in

~E5_g@f{in}E5_g@f~

 
!in

~E5_g@f{!in}E5_g@f~

 
sub

~E5_g@f{sub}E5_g@f~

 
sup

~E5_g@f{sup}E5_g@f~

 
sube

~E5_g@f{sube}E5_g@f~

 
supe

~E5_g@f{supe}E5_g@f~

 
-=

~E5_g@f{-=}E5_g@f~

 
~=

~E5_g@f{~=}E5_g@f~

 
~~

~E5_g@f{~~}E5_g@f~

 
prop

~E5_g@f{prop}E5_g@f~

 

Logical Symbols

Code Symbol
and

~E5_g@f{and}E5_g@f~

 
or

~E5_g@f{or}E5_g@f~

 
not

~E5_g@f{not}E5_g@f~

 
=>

~E5_g@f{=>}E5_g@f~

 
if

~E5_g@f{if}E5_g@f~

 
<=>

~E5_g@f{<=>}E5_g@f~

 
AA

~E5_g@f{AA}E5_g@f~

 
EE

~E5_g@f{EE}E5_g@f~

 
_|_

~E5_g@f{_|_}E5_g@f~

 
TT

~E5_g@f{TT}E5_g@f~

 
|--

~E5_g@f{|--}E5_g@f~

 
|==

~E5_g@f{|==}E5_g@f~

 

Grouping Brackets

Code Symbol
(

~E5_g@f{(}E5_g@f~

 
)

~E5_g@f{)}E5_g@f~

 
[

~E5_g@f{[}E5_g@f~

 
]

~E5_g@f{]}E5_g@f~

 
{

~E5_g@f{{}E5_g@f~

 
}

~E5_g@f{}}E5_g@f~

 
(:

~E5_g@f{(:}E5_g@f~

 
:)

~E5_g@f{:)}E5_g@f~

 
<<

~E5_g@f{<<}E5_g@f~

 
>>

~E5_g@f{>>}E5_g@f~

 
{: x )

~E5_g@f{{: x )}E5_g@f~

 
( x :}

~E5_g@f{( x :}}E5_g@f~

 
abs(x)

~E5_g@f{abs(x)}E5_g@f~

 
floor(x)

~E5_g@f{floor(x)}E5_g@f~

 
ceil(x)

~E5_g@f{ceil(x)}E5_g@f~

 
norm(vecx)

~E5_g@f{norm(vecx)}E5_g@f~

 

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 ~E5_g@f{{::}_(\ \ 92)^238U}E5_g@f~ .

Accents

Code Symbol
hat x

~E5_g@f{hat x}E5_g@f~

 
bar x

~E5_g@f{bar x}E5_g@f~

 
ul x

~E5_g@f{ul x}E5_g@f~

 
vec x

~E5_g@f{vec x}E5_g@f~

 
tilde x

~E5_g@f{tilde x}E5_g@f~

 
dot x

~E5_g@f{dot x}E5_g@f~

 
ddot x

~E5_g@f{ddot x}E5_g@f~

 
overset(x)(=)

~E5_g@f{overset(x)(=)}E5_g@f~

 
underset(x)(=)

~E5_g@f{underset(x)(=)}E5_g@f~

 
ubrace(1+2)

~E5_g@f{ubrace(1+2)}E5_g@f~

 
obrace(1+2)

~E5_g@f{obrace(1+2)}E5_g@f~

 
overarc(AB)

~E5_g@f{overarc(AB)}E5_g@f~

 
color(red)(x)

~E5_g@f{color(red)(x)}E5_g@f~

 
cancel(x)

~E5_g@f{cancel(x)}E5_g@f~

 

Greek Letters

Code Symbol
alpha

~E5_g@f{alpha}E5_g@f~

 
beta

~E5_g@f{beta}E5_g@f~

 
gamma

~E5_g@f{gamma}E5_g@f~

 
Gamma

~E5_g@f{Gamma}E5_g@f~

 
delta

~E5_g@f{delta}E5_g@f~

 
Delta

~E5_g@f{Delta}E5_g@f~

 
epsilon

~E5_g@f{epsilon}E5_g@f~

 
varepsilon

~E5_g@f{varepsilon}E5_g@f~

 
zeta

~E5_g@f{zeta}E5_g@f~

 
eta

~E5_g@f{eta}E5_g@f~

 
theta

~E5_g@f{theta}E5_g@f~

 
Theta

~E5_g@f{Theta}E5_g@f~

 
vartheta

~E5_g@f{vartheta}E5_g@f~

 
iota

~E5_g@f{iota}E5_g@f~

 
kappa

~E5_g@f{kappa}E5_g@f~

 
lambda

~E5_g@f{lambda}E5_g@f~

 
Lambda

~E5_g@f{Lambda}E5_g@f~

 
mu

~E5_g@f{mu}E5_g@f~

 
nu

~E5_g@f{nu}E5_g@f~

 
xi

~E5_g@f{xi}E5_g@f~

 
Xi

~E5_g@f{Xi}E5_g@f~

 
pi

~E5_g@f{pi}E5_g@f~

 
Pi

~E5_g@f{Pi}E5_g@f~

 
rho

~E5_g@f{rho}E5_g@f~

 
sigma

~E5_g@f{sigma}E5_g@f~

 
Sigma

~E5_g@f{Sigma}E5_g@f~

 
tau

~E5_g@f{tau}E5_g@f~

 
upsilon

~E5_g@f{upsilon}E5_g@f~

 
phi

~E5_g@f{phi}E5_g@f~

 
Phi

~E5_g@f{Phi}E5_g@f~

 
varphi

~E5_g@f{varphi}E5_g@f~

 
chi

~E5_g@f{chi}E5_g@f~

 
psi

~E5_g@f{psi}E5_g@f~

 
Psi

~E5_g@f{Psi}E5_g@f~

 
omega

~E5_g@f{omega}E5_g@f~

 
Omega

~E5_g@f{Omega}E5_g@f~

 

Font Commands

Code Symbol
bb "AaBbCc"

~E5_g@f{bb "AaBbCc"}E5_g@f~

 
bbb "AaBbCc"

~E5_g@f{bbb "AaBbCc"}E5_g@f~

 
cc "AaBbCc"

~E5_g@f{cc "AaBbCc"}E5_g@f~

 
tt "AaBbCc"

~E5_g@f{tt "AaBbCc"}E5_g@f~

 
fr "AaBbCc"

~E5_g@f{fr "AaBbCc"}E5_g@f~

 
sf "AaBbCc"

~E5_g@f{sf "AaBbCc"}E5_g@f~

 

Standard Functions

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.

Special Cases

Matrices:
[[a,b],[c,d]] yields ~E5_g@f{[[a,b],[c,d]]}E5_g@f~

Column vectors:
((a),(b)) yields ~E5_g@f{((a),(b))}E5_g@f~

Augmented matrices:
[[a,b,|,c],[d,e,|,f]] yields ~E5_g@f{[[a,b,|,c],[d,e,|,f]]}E5_g@f~

Matrices can be used for layout:
{(2x,+,17y,=,23),(x,-,y,=,5):} yields ~E5_g@f{{(2x,+,17y,=,23),(x,-,y,=,5):}}E5_g@f~

Complex subscripts:
lim_(N->oo) sum_(i=0)^N yields ~E5_g@f{lim_(N->oo) sum_(i=0)^N}E5_g@f~

Subscripts must come before superscripts:
int_0^1 f(x)dx yields ~E5_g@f{int_0^1 f(x)dx}E5_g@f~

Derivatives:
f'(x) = dy/dx yields ~E5_g@f{f'(x) = dy/dx}E5_g@f~

For variables other than x, y, z, or t, you will need grouping symbols:
(dq)/(dp) for ~E5_g@f{(dq)/(dp)}E5_g@f~

Underbraces:
ubrace(1+2+3+4)_("4 terms") yields ~E5_g@f{ubrace(1+2+3+4)_("4 terms")}E5_g@f~

Overbraces:
obrace(1+2+3+4)^("4 terms") yields ~E5_g@f{obrace(1+2+3+4)^("4 terms")}E5_g@f~

Prescripts:
{::}_(\ \ 92)^238U yields ~E5_g@f{{::}_(\ \ 92)^238U}E5_g@f~

Forced spaces:
(backslash followed by a space) yields a non-breaking space.
Example: a\ b yields ~E5_g@f{a\ b}E5_g@f~ but a b yields ~E5_g@f{a b}E5_g@f~

Stacking: use stackrel to stack elements:
stackrel"def"= yields ~E5_g@f{stackrel"def"=}E5_g@f~

Note - Angle Brackets

When using AsciiMath in Sage, there is no need to surround < and > characters with spaces, unlike when using AsciiMath in regular HTML pages. Sage automatically escapes the angle brackets.


For more details on the AsciiMath notation, visit https://asciimath.org/.

LaTeX

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 ~E5_g@f(E = mc^2)E5_g@f~ 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 ~E5_g@f[E = mc^2]E5_g@f~ discovery.


For details on the LaTeX notation, visit https://www.latex-project.org/.

MathML

Use the [mathml] tag for MathML notation…

The area of a circle is [mathml] <mi>&pi;</mi> <mo>&InvisibleTimes;</mo> <msup> <mi>r</mi> <mn>2</mn> </msup> [end]

The above produces…


The area of a circle is π r 2


For details on the MathML notation, visit https://www.w3.org/TR/MathML/ or https://www.iso.org/standard/58439.html.

Last Modified: 10/24 10:44:32 am
In this article (top)  View article's Sage markup
10/24 10:44:32 am