-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.html
227 lines (225 loc) · 7.1 KB
/
map.html
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<meta charset="UTF-8">
<title>Quantities</title>
<link rel="manifest" href="map.json">
<style>
body {
margin: 0px;
padding: 0px;
overflow-x: hidden;
}
div {
position: absolute;
background-color: silver;
}
.h {
width: 100vw;
height: 1px;
}
.g {
width: 100vw;
height: 2px;
background-color: black;
}
.v {
position: fixed;
width: 1px;
height: 100%;
}
.label {
font-size: 1.25rem;
background-color: #eee;
}
</style>
<script src="algebraic.js"></script>
<script>
var delta
, _ = function (a, b) { return new Arch(a.log, b) }
, _c = _(299792458) // m s^{-1}
, _G = _(4 * Math.PI * 6.67408e-11) // kg^{-1} m^3 s^{-2}
//, _h = _(6.626070040e-34) // kg m^2 s^{-1}
, _h = _(6.62607015e-34) // kg m^2 s^{-1}
//, _Boltzmann = _(1.38064852e-23) // J K^{-1}
, _Boltzmann = _(1.380649e-23) // J K^{-1}
, _mu0 = _(4 * Math.PI * 1e-7) // N A^{-2}
/*
2014 CODATA recommended values
http://physics.nist.gov/constants
*/
, prefix = {}, unit = {}
, tau = _(2 * Math.PI, 0.25)
, one = _(1)
, two = _(2)
, half = two.inv
, Ki = _(1024)
, Mi = Ki.mul(Ki)
, Gi = Mi.mul(Ki)
, Ti = Gi.mul(Ki)
, Pi = Ti.mul(Ki)
, Ei = Pi.mul(Ki)
, Zi = Ei.mul(Ki)
, Yi = Zi.mul(Ki)
, b = two.log
, B = _(8).mul(b)
, KiB = Ki.mul(B)
, MiB = Mi.mul(B)
, GiB = Gi.mul(B)
, TiB = Ti.mul(B)
, PiB = Pi.mul(B)
, EiB = Ei.mul(B)
, ZiB = Zi.mul(B)
, YiB = Yi.mul(B)
, c_ = _c.inv, G_ = _G.inv, h_ = _h.inv
prefix[''] = new Arch
prefix.k = _(1000)
prefix.M = prefix.k.mul(prefix.k)
prefix.G = prefix.M.mul(prefix.k)
prefix.T = prefix.G.mul(prefix.k)
//prefix.P = prefix.T.mul(prefix.k)
//prefix.E = prefix.P.mul(prefix.k)
//prefix.Z = prefix.E.mul(prefix.k)
//prefix.Y = prefix.Z.mul(prefix.k)
prefix.m = prefix.k.inv
prefix.μ = prefix.m.mul(prefix.m)
prefix.n = prefix.μ.mul(prefix.m)
prefix.p = prefix.n.mul(prefix.m)
//prefix.f = prefix.p.mul(prefix.m)
//prefix.a = prefix.f.mul(prefix.m)
//prefix.z = prefix.a.mul(prefix.m)
//prefix.y = prefix.z.mul(prefix.m)
var kg = c_ .mul(_G).mul(h_).mul(tau).log.mul(half).exp
unit.m = _c.mul(_c).mul(_c).mul(G_).mul(h_).mul(tau).log.mul(half).exp
unit.s = unit.m.mul(_c)
kg.arg = unit.m.arg = unit.s.arg = 0.125
unit.g = prefix.m.mul(kg)
unit.Hz = unit.s.inv
unit.N = kg.mul(unit.m).mul(unit.Hz).mul(unit.Hz)
unit.J = unit.N.mul(unit.m)
unit.A = _mu0.mul(unit.N).log.mul(half).exp
unit.A.arg = 0
unit.K = _Boltzmann.mul(unit.J)
unit.C = unit.A.mul(unit.s)
unit.W = unit.J.mul(unit.Hz)
unit.V = unit.W.mul(unit.A.inv)
unit.Ω = unit.V.mul(unit.A.inv)
unit.Pa = unit.N.mul(unit.m.mul(unit.m).inv)
// unit.F = unit.C.mul(unit.V.inv)
// unit.S = unit.A.mul(unit.V.inv)
// unit.Wb = unit.V.mul(unit.s)
// unit.T = unit.Wb.mul(unit.m.mul(unit.m).inv)
// unit.H = unit.Wb.mul(unit.A.inv)
var atm = _(101325).mul(unit.Pa)
, km = prefix.k.mul(unit.m)
, min = _(60).mul(unit.s), hour = _(60).mul(min), day = _(24).mul(hour)
, week = _(7).mul(day), year = _(365.25).mul(day)
, _0dc = _(273.15).mul(unit.K), _100dc = _(273.15 + 100).mul(unit.K)
//, e = _(1.6021766208e-19).mul(unit.C)
, e = _(1.602176634e-19).mul(unit.C)
, eV = e.mul(unit.V)
, me = _(9.10938356e-31).mul(kg)
, mp = _(1.672621898e-27).mul(kg)
, vals = Object.keys(unit).reduce(function (prev, u) {
return prev.concat(Object.keys(prefix).map(function (p) {
return [prefix[p].mul(unit[u]), p + u]
}))
}, []).concat([
[eV, 'eV'], [atm, 'atm']
, [min, 'min'], [hour, 'hour'], [day, 'day'], [week, 'week'], [year, 'year']
, [prefix.k.mul(year), 'Thousand years']
, [prefix.M.mul(year), 'Million years']
, [prefix.G.mul(year), 'Billion years']
, [b, 'b' ], [B, 'B' ]
, [KiB, 'KiB'], [MiB, 'MiB'], [GiB, 'GiB'], [TiB, 'TiB']
, [PiB, 'PiB'], [EiB, 'EiB'], [ZiB, 'ZiB'], [YiB, 'YiB']
, [_0dc, '0 °C'], [_100dc, '100 °C']
, [_(1.65).mul(eV), 'IR'], [_(3.26).mul(eV), 'UV']
, [e, 'e']
, [unit.m.mul(unit.Hz), 'm/s']
, [prefix.k.mul(unit.m).mul(hour.inv), 'km/hour']
, [_(7.347673e22).mul(kg), 'mass Moon']
, [_(4*Math.PI * 4.9048695e12).mul(unit.m.pow(3)).mul(unit.s.pow(-2)), 'mass Moon']
, [_(4*Math.PI * 3.986004418e14).mul(unit.m.pow(3)).mul(unit.s.pow(-2)), 'mass Earth']
, [_(4*Math.PI * 3.7931187e16).mul(unit.m.pow(3)).mul(unit.s.pow(-2)), 'mass Saturn']
, [_(4*Math.PI * 1.26686534e17).mul(unit.m.pow(3)).mul(unit.s.pow(-2)), 'mass Jupiter']
, [_(4*Math.PI * 1.32712442099e20).mul(unit.m.pow(3)).mul(unit.s.pow(-2)), 'mass Sun']
, [_(3474.3).mul(km), 'radius Moon']
, [_(6378.137).mul(km), 'radius Earth']
, [_(695800).mul(km), 'radius Sun' ]
, [_(384400).mul(km), 'orbit Moon']
, [_(149597870700).mul(unit.m), 'au']
, [_(39.445 * 149600000).mul(km), 'orbit Plute']
, [_(13.799e9).mul(year), 'age Universe']
, [me, 'mass electron']
, [mp, 'mass proton']
, [_(12 * 1.660539040e-27).mul(kg), 'mass C12']
, [_(4.39).mul(year), 'distance α Centauri']
, [_(643).mul(year), 'distance Betelgeuse']
, [_(162.98e3).mul(year), 'distance Large Magellanic']
, [_(2.54e6).mul(year), 'distance Andromeda']
, [_(2.3e6).mul(eV), 'mass u']
, [_(1.275e9).mul(eV), 'mass c']
, [_(173.07e9).mul(eV), 'mass t']
, [_(80.4e9).mul(eV), 'mass W']
, [_(126e9).mul(eV), 'mass Higgs']
, [_(0.52917721067e-10).mul(unit.m), 'Bohr radius']
, [_(2.72548).mul(unit.K), 'CMB']
, [_(6.022140857e23), 'Avogadro constant']
, [new Arch, '4πG = c = ε₀ = μ₀ = k']
, [tau, 'h']
]).sort(function (a, b) {
return a[0].ord - b[0].ord
})
, lineh = function (ord, textContent, klass) {
var _ = document.createElement('div')
ord -= delta
ord *= 100; ord = Math.round(ord)
_.textContent = textContent
_.setAttribute('style', 'top: ' + ord.toString() + 'px;')
_.setAttribute('class', klass)
return _
}
, linev = function (arg, textContent, klass) {
var _ = document.createElement('div')
arg += 0.5; arg %= 1; arg *= 100
_.textContent = textContent
_.setAttribute('style', 'left: ' + arg.toString() + 'vw;')
_.setAttribute('class', klass)
return _
}
, label = function (z, textContent, klass) {
var _ = document.createElement('div')
, ord = z.ord, arg = z.arg
ord -= delta
ord *= 100; ord = Math.round(ord)
arg += 0.5; arg %= 1; arg *= 100
_.textContent = textContent
_.setAttribute('style', 'top: ' + ord.toString() + 'px; left: ' + arg.toString() + 'vw;')
_.setAttribute('class', 'label')
return _
}
Arch.precision = 6
onload = function () {
var append = document.body.appendChild.bind(document.body)
delta = vals[0][0].ord - 1
var i = Math.floor(vals[0][0].ord)
while (i < vals[vals.length - 1][0].ord + 1) {
append(lineh(i, i.toString(), 'h'))
i++
}
;[0, 0.125, 0.25, 0.375, 0.625, 0.75, 0.875].forEach(function (arg) {
append(linev(arg, '.' + arg.toFixed(3).split('.')[1], 'v'))
})
vals.forEach(function (item) {
append(lineh(item[0].ord, ' .' + item[0].ord.toFixed(3).split('.')[1], 'g'))
})
vals.forEach(function (item) {
append(label(item[0], item[1]))
})
}
</script>
</head>
<body></body>
</html>