forked from josdejong/mathjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
47 lines (40 loc) · 1.12 KB
/
Copy pathtest.html
File metadata and controls
47 lines (40 loc) · 1.12 KB
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
<!DOCTYPE html>
<html>
<head>
<title>mathjs test</title>
<script src="../dist/math.js" type="text/javascript"></script>
</head>
<body>
<p>
Use the mathjs library from the console...
</p>
<script>
function print (args) {
for (var i = 0; i < arguments.length; i++) {
document.write(arguments[i] + '');
}
document.write('<br>');
}
var complex1 = math.complex(3, -4);
print(complex1.toString());
print('sqrt(25) = ' + math.sqrt(25));
print('sqrt(' + complex1.toString() + ') = ' + math.sqrt(complex1));
print('sqrt(-4) = ' + math.sqrt(-4));
var parser = math.parser();
print(math.unit('0.01m').toString());
print(math.unit('1m').toString());
print(math.unit('10m').toString());
print(math.unit('100m').toString());
print(math.unit('500m').toString());
print(math.unit('800m').toString());
print(math.unit('1000m').toString());
print(math.unit('1100m').toString());
print(parser.eval('a=[1,2,3;4,5,6]'));
var a = parser.get('a');
//print(parser.eval('a(1,1)'));
print(parser.eval('a[1,0:2]'));
print(parser.eval('b=2.3'));
print(parser.eval('b + 2'));
</script>
</body>
</html>