From 723eb34e40bb997be0a338b22c235333297294b3 Mon Sep 17 00:00:00 2001 From: osmarks Date: Wed, 23 Nov 2022 17:03:26 +0000 Subject: [PATCH] Add some web things --- political_opinion_calendar.html | 107 +++++++++++++++++++++++++ square-law gravity - physics test.html | 5 +- wfc.html | 104 ++++++++++++++++++++++++ 3 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 political_opinion_calendar.html create mode 100644 wfc.html diff --git a/political_opinion_calendar.html b/political_opinion_calendar.html new file mode 100644 index 0000000..94cb85c --- /dev/null +++ b/political_opinion_calendar.html @@ -0,0 +1,107 @@ + + + + + +
+ +
+ \ No newline at end of file diff --git a/square-law gravity - physics test.html b/square-law gravity - physics test.html index 2a07853..211ab2f 100644 --- a/square-law gravity - physics test.html +++ b/square-law gravity - physics test.html @@ -56,7 +56,10 @@ i++ } - info.innerText = "Total E_k is " + objects.map(x => 1/2 * x.m * vmag(x.v) ** 2).reduce((a, b) => a + b).toString() + const E_k = objects.map(x => 1/2 * x.m * vmag(x.v) ** 2).reduce((a, b) => a + b) + // extra division by 2 due to double-counting + const E_p = objects.map(o1 => objects.filter(o2 => o2 !== o1).map(o2 => 1/6 * o1.m * o2.m * G * (vmag(vsub(o1.x, o2.x)) ** 3)).reduce((a, b) => a + b)).reduce((a, b) => a + b) + info.innerHTML = `Ek=${E_k.toFixed(2)}
Ep=${E_p.toFixed(2)}
sum=${E_k+E_p}` requestAnimationFrame(step) } diff --git a/wfc.html b/wfc.html new file mode 100644 index 0000000..33b726d --- /dev/null +++ b/wfc.html @@ -0,0 +1,104 @@ + + + +
+ + \ No newline at end of file