-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmath-obj.html
68 lines (63 loc) · 2 KB
/
math-obj.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="math.js | basic usage">
<title>math.js | basic usage</title>
<script src="https://unpkg.com/mathjs/dist/math.min.js"></script>
</head>
<body>
<h3>Cálculos matemáticos usando a biblioteca math em JavaScript</h3>
https://unpkg.com/mathjs/dist/math.min.js<br><br><br>
<table border="1">
<tr>
<td>
math.round(math.e, 3); <br>
math.atan2(3, -3) / math.pi; <br>
math.log(10000, 10); <br>
math.sqrt(-4); <br>
math.pow([[-1, 2], [3, 1]], 2); <br>
math.derivative('x^2 + x', 'x'); <br>
math.eval('12 / (2.3 + 0.7)'); <br>
math.eval('12.7 cm to inch'); <br>
math.eval('9 / 3 + 2i'); <br>
math.eval('det([-1, 2; 3, 1])'); <br>
</td>
<td>
<br>
<script>
// basic usage of math.js
//
// website: http://mathjs.org
// docs: http://mathjs.org/docs
// examples: http://mathjs.org/examples
// functions and constants
print(math.round(math.e, 3)); // 2.718
print(math.atan2(3, -3) / math.pi); // 0.75
print(math.log(10000, 10)); // 4
print(math.sqrt(-4)); // 2i
print(math.pow([[-1, 2], [3, 1]], 2)); // [[7, 0], [0, 7]]
print(math.derivative('x^2 + x', 'x')); // 2 * x + 1
// expressions
print(math.eval('12 / (2.3 + 0.7)')); // 4
print(math.eval('12.7 cm to inch')); // 5 inch
print(math.eval('9 / 3 + 2i')); // 3 + 2i
print(math.eval('det([-1, 2; 3, 1])')); // -7
// chaining
var a = math.chain(3)
.add(4)
.multiply(2)
.done();
print(a); // 14
// helper function to output formatted results.
function print(value) {
var precision = 14;
document.write(math.format(value, precision) + '<br>');
}
</script>
</td>
</tr>
</table>
</body>
</html>