Repository navigation
Expand file tree
/
Copy pathsampling.html
More file actions
134 lines (130 loc) · 3.06 KB
/
Copy pathsampling.html
File metadata and controls
134 lines (130 loc) · 3.06 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>sampling</title>
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
opacity: 0.1;
}
</style>
</head>
<body>
<span id="sample-1"></span>
<span id="sample-2"></span>
<span id="sample-3"></span>
<span id="sample-4"></span>
<script src="js/vendor/d3.js"></script>
<script src="js/bundle.js"></script>
<script>
functionPlot({
target: '#sample-1',
// xDomain: [-1, 1],
// yDomain: [-1.5, 1.5],
data: [{
// fn: 'x^2'
// fn: 'x^3'
// fn: 'sin(exp(x))'
// fn: 'sin(300 * x)'
// fn: 'sin(x) / x'
// fn: '(x * sqrt(x - 2 + 1 / x)) / (x - 1)'
// fn: 'x < 1 ? -sqrt(x) : sqrt(x)' // alternative
// fn: 'tan(x)'
// fn: '1 / x'
// fn: 'sin(1 / x)'
// fn: 'sqrt(x)'
fn: '1 + (x^2) + 0.0125 * log(abs(1 - 3 * (x - 1)))'
}]
});
// var a = functionPlot({
// target: '#sample-1',
// xDomain: [-0.5, 6],
// yDomain: [-1.5, 1.5],
// data: [{
// fn: function (x) {
// return Math.sin(Math.pow(Math.E, x)); // 1525 samples in google, 2953 full to the right
//// return Math.sin(1 / x);
//// return Math.sin(x);
//// return Math.tan(x);
//// return x * x;
//// return 1 / x;
// },
// sampling: {
//// initialSamples: 500,
//// depth: 25
//// eps: 0.01
// }
// ,graphOptions: {
//// type: 'scatter'
// }
// }]
// });
// var b = functionPlot({
// target: '#sample-2',
// xDomain: [-0.5, 6],
// yDomain: [-1.5, 1.5],
// data: [{
// fn: function (x) {
// return Math.sin(Math.pow(Math.E, x)); // 1525 samples in google, 2953 full to the right
//// return Math.sin(1 / x);
//// return Math.sin(x);
//// return Math.tan(x);
//// return x * x;
//// return 1 / x;
// },
// sampling: {
// initialSamples: 4000,
// depth: 0,
//// eps: 0.01
// }
//// ,graphOptions: {
//// type: 'scatter'
//// }
// }]
// });
//// a.addLink(b);
//// b.addLink(a);
//
// functionPlot({
// target: '#sample-3',
// data: [{
// fn: function (x) {
// return x * x;
// },
// sampling: {
// initialSamples: 100,
// depth: 25
// },
// graphOptions: {
// type: 'scatter'
// }
// }]
// });
//
// functionPlot({
// target: '#sample-4',
// data: [{
// fn: function (x) {
//// return Math.tan(x);
// var a = 0.001;
// return x + a * a / (a * a + x * x);
// },
// sampling: {
// initialSamples: 500,
// depth: 25
// },
// graphOptions: {
//// type: 'scatter'
// }
// }]
// });
</script>
</body>
</html>