summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornavanchauhan <navanchauhan@gmail.com>2023-05-01 13:13:26 -0600
committernavanchauhan <navanchauhan@gmail.com>2023-05-01 13:13:26 -0600
commit11e531eaa4e6c348706096dc272b8a9d3ab45938 (patch)
treefd24f886caac1e190af8ce0928f006b4d2a2b35f
parent3d902334815db764d0cb6e4bbf6c553ff1fd6f2e (diff)
re-add 3body sim
-rw-r--r--Content/posts/2023-04-30-n-body-simulation.md5
-rw-r--r--Resources/assets/n-body/script.js4
-rw-r--r--docs/assets/n-body/script.js4
-rw-r--r--docs/feed.rss9
-rw-r--r--docs/posts/2023-04-30-n-body-simulation.html5
5 files changed, 23 insertions, 4 deletions
diff --git a/Content/posts/2023-04-30-n-body-simulation.md b/Content/posts/2023-04-30-n-body-simulation.md
index e3d6a9d..6d6cda6 100644
--- a/Content/posts/2023-04-30-n-body-simulation.md
+++ b/Content/posts/2023-04-30-n-body-simulation.md
@@ -650,6 +650,11 @@ The simulations require JavaScript to be viewed properly :(
<input type="range" min="1" max="20" value="10" id="speedControl">
<label for="nBodies">Number of Bodies for n-Body Simulation (5-500)</label>
<input type="range" min="5" max="500" value="256" id="nBodies">
+<label for="distanceAU">Position Range for Random 3-Body Simulations (1-55)</label>
+<input type="number" min="1" max="55" value="10" id="distanceAU">
+<label for="vRange">Velocity Range for Random 3-Body Simulation (1-10e4)<label>
+<input type="number" min="1" max="10000" value="7e3" id="vRange">
+
</div>
<button type="button" id="startSim1" onclick="plotEarthSun()">Sun-Earth Orbit</button>
<button type="button" id="startSim2" onclick="plotClassic3BodyProblem()">Classic 3-Body Problem</button>
diff --git a/Resources/assets/n-body/script.js b/Resources/assets/n-body/script.js
index 6042e27..cd8b8b0 100644
--- a/Resources/assets/n-body/script.js
+++ b/Resources/assets/n-body/script.js
@@ -290,7 +290,9 @@ function initCondGen(nBodies, vRange = [-7e3, 7e3], posRange = [-35, 35]) {
}
function random3BodySimSolver(tStop, nTPts, nBodiesStop=2, G=6.674e-11) {
- let initConditions = initCondGen(3,[-7e3, 7e3],[-5, 5]);
+ let userInputPositionValue = parseInt(document.getElementById("distanceAU").value);
+ let userInputVelocityValue = Number(document.getElementById("vRange").value);
+ let initConditions = initCondGen(3,[-userInputVelocityValue, userInputVelocityValue],[-userInputPositionValue, userInputPositionValue]);
let myMasses = initConditions.m;
let myCoords = initConditions.coords;
diff --git a/docs/assets/n-body/script.js b/docs/assets/n-body/script.js
index 6042e27..cd8b8b0 100644
--- a/docs/assets/n-body/script.js
+++ b/docs/assets/n-body/script.js
@@ -290,7 +290,9 @@ function initCondGen(nBodies, vRange = [-7e3, 7e3], posRange = [-35, 35]) {
}
function random3BodySimSolver(tStop, nTPts, nBodiesStop=2, G=6.674e-11) {
- let initConditions = initCondGen(3,[-7e3, 7e3],[-5, 5]);
+ let userInputPositionValue = parseInt(document.getElementById("distanceAU").value);
+ let userInputVelocityValue = Number(document.getElementById("vRange").value);
+ let initConditions = initCondGen(3,[-userInputVelocityValue, userInputVelocityValue],[-userInputPositionValue, userInputPositionValue]);
let myMasses = initConditions.m;
let myCoords = initConditions.coords;
diff --git a/docs/feed.rss b/docs/feed.rss
index 23f6a2f..c85bde3 100644
--- a/docs/feed.rss
+++ b/docs/feed.rss
@@ -4,8 +4,8 @@
<title>Navan's Archive</title>
<description>Rare Tips, Tricks and Posts</description>
<link>https://web.navan.dev/</link><language>en</language>
- <lastBuildDate>Mon, 01 May 2023 12:58:21 -0000</lastBuildDate>
- <pubDate>Mon, 01 May 2023 12:58:21 -0000</pubDate>
+ <lastBuildDate>Mon, 01 May 2023 13:13:07 -0000</lastBuildDate>
+ <pubDate>Mon, 01 May 2023 13:13:07 -0000</pubDate>
<ttl>250</ttl>
<atom:link href="https://web.navan.dev/feed.rss" rel="self" type="application/rss+xml"/>
@@ -4783,6 +4783,11 @@ The simulations require JavaScript to be viewed properly :(
<input type="range" min="1" max="20" value="10" id="speedControl">
<label for="nBodies">Number of Bodies for n-Body Simulation (5-500)</label>
<input type="range" min="5" max="500" value="256" id="nBodies">
+<label for="distanceAU">Position Range for Random 3-Body Simulations (1-55)</label>
+<input type="number" min="1" max="55" value="10" id="distanceAU">
+<label for="vRange">Velocity Range for Random 3-Body Simulation (1-10e4)<label>
+<input type="number" min="1" max="10000" value="7e3" id="vRange">
+
</div>
<button type="button" id="startSim1" onclick="plotEarthSun()">Sun-Earth Orbit</button>
<button type="button" id="startSim2" onclick="plotClassic3BodyProblem()">Classic 3-Body Problem</button>
diff --git a/docs/posts/2023-04-30-n-body-simulation.html b/docs/posts/2023-04-30-n-body-simulation.html
index 7d8a710..cb0bf6c 100644
--- a/docs/posts/2023-04-30-n-body-simulation.html
+++ b/docs/posts/2023-04-30-n-body-simulation.html
@@ -699,6 +699,11 @@ The simulations require JavaScript to be viewed properly :(
<input type="range" min="1" max="20" value="10" id="speedControl">
<label for="nBodies">Number of Bodies for n-Body Simulation (5-500)</label>
<input type="range" min="5" max="500" value="256" id="nBodies">
+<label for="distanceAU">Position Range for Random 3-Body Simulations (1-55)</label>
+<input type="number" min="1" max="55" value="10" id="distanceAU">
+<label for="vRange">Velocity Range for Random 3-Body Simulation (1-10e4)<label>
+<input type="number" min="1" max="10000" value="7e3" id="vRange">
+
</div>
<button type="button" id="startSim1" onclick="plotEarthSun()">Sun-Earth Orbit</button>
<button type="button" id="startSim2" onclick="plotClassic3BodyProblem()">Classic 3-Body Problem</button>