-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
67 lines (67 loc) · 1.47 KB
/
script.js
File metadata and controls
67 lines (67 loc) · 1.47 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
import * as float from './ftmath.js'
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function do_math(r,y,source){
var y = y
let y_vals = []
let iteration = []
for(let i = 0; i < 50; i++){
y_vals.push(y)
iteration.push(i)
y = float.multiply(float.multiply(r,y),(float.subtract(1,y)))
}
var data = [{
x: iteration,
y: y_vals,
mode: "lines",
type: "scatter"
}];
var layout = {
xaxis: {title: "Iteration"},
yaxis: {title: "Point value"},
title: "Iteration and point value"
};
Plotly.newPlot(source, data, layout);
}
function submit(){
let params = document.getElementById("params").split(':')
do_math(parseFloat(params[0]),parseFloat(params[1]))
}
function the_end(){
let num = 0.9
var data_x = []
var data_r = []
while (num != 4){
let y = 0.40
let final = []
for(let i = 0; i < 100; i++){
y = float.multiply(float.multiply(num,y),(float.subtract(1,y)))
if (i > 60){
data_x.push(y)
data_r.push(num)
}
}
num = float.add(num,0.0025);
}
var data = [{
x: data_r,
y: data_x,
mode: 'markers',
marker: {
size: 2
},
type: "scatter"
}];
var layout = {
xaxis: {title: "R - growth rate"},
yaxis: {title: "Point value"},
title: ""
}
Plotly.newPlot("final", data, layout);
}
do_math(2.6,0.40,'point_graph')
do_math(3.2,0.40,'point_graph1')
do_math(3.5,0.40,'point_graph12')
do_math(3.9,0.40,'point_graph2')
the_end()