1abs(x) Returns the absolute value of x
2acos(x) Returns the arccosine of x, in radians
3acosh(x) Returns the hyperbolic arccosine of x
4asin(x) Returns the arcsine of x, in radians
5asinh(x) Returns the hyperbolic arcsine of x
6atan(x) Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians
7atan2(y, x) Returns the arctangent of the quotient of its arguments
8atanh(x) Returns the hyperbolic arctangent of x
9cbrt(x) Returns the cubic root of x
10ceil(x) Returns x, rounded upwards to the nearest integer
11cos(x) Returns the cosine of x (x is in radians)
12cosh(x) Returns the hyperbolic cosine of x
13exp(x) Returns the value of Ex
14floor(x) Returns x, rounded downwards to the nearest integer
15log(x) Returns the natural logarithm (base E) of x
16max(x, y, z, ..., n) Returns the number with the highest value
17min(x, y, z, ..., n) Returns the number with the lowest value
18pow(x, y) Returns the value of x to the power of y
19random() Returns a random number between 0 and 1
20round(x) Rounds x to the nearest integer
21sin(x) Returns the sine of x (x is in radians)
22sinh(x) Returns the hyperbolic sine of x
23sqrt(x) Returns the square root of x
24tan(x) Returns the tangent of an angle
25tanh(x) Returns the hyperbolic tangent of a number
26trunc(x) Returns the integer part of a number (x)
1// functions and constants
2math.round(math.e, 3) // 2.718
3math.atan2(3, -3) / math.pi // 0.75
4math.log(10000, 10) // 4
5math.sqrt(-4) // 2i
6math.derivative('x^2 + x', 'x') // 2*x+1
7math.pow([[-1, 2], [3, 1]], 2)
8 // [[7, 0], [0, 7]]
9
10// expressions
11math.evaluate('1.2 * (2 + 4.5)') // 7.8
12math.evaluate('12.7 cm to inch') // 5 inch
13math.evaluate('sin(45 deg) ^ 2') // 0.5
14math.evaluate('9 / 3 + 2i') // 3 + 2i
15math.evaluate('det([-1, 2; 3, 1])') // -7
16
17// chaining
18math.chain(3)
19 .add(4)
20 .multiply(2)
21 .done() // 14
1The top-level element in MathML is <math>. Every valid MathML instance must be wrapped in <math> tags. In addition you must not nest a second <math> element in another, but you can have an arbitrary number of other child elements in it.
2
3Examples
4
5Theorem of Pythagoras
6
7HTML5 notation
8<!DOCTYPE html>
9<html>
10 <head>
11 <title>MathML in HTML5</title>
12 </head>
13 <body>
14
15 <math>
16 <mrow>
17 <mrow>
18 <msup>
19 <mi>a</mi>
20 <mn>2</mn>
21 </msup>
22 <mo>+</mo>
23 <msup>
24 <mi>b</mi>
25 <mn>2</mn>
26 </msup>
27 </mrow>
28 <mo>=</mo>
29 <msup>
30 <mi>c</mi>
31 <mn>2</mn>
32 </msup>
33 </mrow>
34 </math>
35
36 </body>
37</html>