metanum 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -60
- package/format-metanum.js +972 -0
- package/metanum.js +1464 -1429
- package/package.json +1 -1
- package/test-interface.html +38 -0
- package/test_mixed.js +547 -187
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/metanum)
|
|
4
4
|
|
|
5
|
-
- MetaNum v1.
|
|
5
|
+
- MetaNum v1.3 by dlsdl
|
|
6
6
|
|
|
7
7
|
A huge number library holding up to X↑↑X&9e15.
|
|
8
8
|
|
|
@@ -10,9 +10,11 @@ This reaches level f<sub>ε₀</sub>, which is the limit of well-defined express
|
|
|
10
10
|
|
|
11
11
|
MetaNum provides a robust implementation of hierarchical number representation based on the Hardy hierarchy (HH) and ordinal arithmetic. It can handle numbers far beyond standard JavaScript Number limits, using a sophisticated multi-dimensional array structure to represent ordinal numbers up to ε₀ (ω^ω^ω^……with ω floors). Internally, each MetaNum instance is represented as:
|
|
12
12
|
|
|
13
|
-
- **sign**: 1 (positive)
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
13
|
+
- **sign**: 1 (positive), -1 (negative), 2 (reciprocal positive), -2 (reciprocal negative)
|
|
14
|
+
- **array**: 2-dimensional array `[[r0, e, f, g, ...], [acount, a1, a2, ...], [bcount, b1, b2, ...], ...]` where the first row holds the base value and finite hyper-operation exponents(represents the value of ...g 10^^^'s f 10^^'s e 10^'s r0), and subsequent rows hold ordinal terms(bcount times hyperoperation with ordinal level ...ω^2*b3+ω^*b2+b1 and acount times hyperoperation with ordinal level ...ω^2*a3+ω^*a2+a1, etc.), ordinal terms are sorted by levels from small to big
|
|
15
|
+
- **layer**: Non-negative integer representing the ω exponent tower height of hyperoperation level(ω^ω^……(ω polynomial) with layer ω^'s)
|
|
16
|
+
|
|
17
|
+
A metanum number is nearly f_ω^ω^…(layer-1 ω^'s)…(…+ω^(…+ω^2*b3+ω^*b2+b1)*bcount+ω^(…+ω^2*a3+ω^*a2+a1)*acount)[…g 10^^^'s f 10^^'s e 10^'s r0](layer>=1) or f…[f^bcount_(…ω^2*b3+ω^*b2+b1)[f^acount_(…ω^2*a3+ω^*a2+a1)[…g 10^^^'s f 10^^'s e 10^'s r0]]…](layer=0) in Fast Growing Hierarchy
|
|
16
18
|
|
|
17
19
|
## Installation
|
|
18
20
|
|
|
@@ -29,7 +31,7 @@ const b = MetaNum.fromNumber(-3.14);
|
|
|
29
31
|
|
|
30
32
|
// From a string (supports scientific notation, hyper-operations, letter notation, brackets, etc.)
|
|
31
33
|
const c = new MetaNum("1.5e308");
|
|
32
|
-
const d = MetaNum.fromString("
|
|
34
|
+
const d = MetaNum.fromString("F5"); // tetration: 10^^5
|
|
33
35
|
const e = MetaNum.fromString("E100#2"); // Hyper-E: 10^10^100 (googolplex)
|
|
34
36
|
const f = MetaNum.fromString("GF^2 E^3 123"); // letter notation
|
|
35
37
|
const g = MetaNum.fromString("Aa100"); // letter notation
|
|
@@ -169,63 +171,114 @@ new MetaNum(10).layeradd(3); // add 3 layers of exponentiation
|
|
|
169
171
|
new MetaNum(10).layeradd10(3); // 10^^3 (explicit base 10)
|
|
170
172
|
```
|
|
171
173
|
|
|
172
|
-
##
|
|
174
|
+
## Hyper-Operations up to ε₀
|
|
173
175
|
|
|
174
|
-
These functions represent iterated diagonalizations at increasing ordinal levels
|
|
176
|
+
These functions represent iterated diagonalizations at increasing ordinal levels from ω to ε₀:
|
|
175
177
|
|
|
176
178
|
```javascript
|
|
177
179
|
const x = new MetaNum(10);
|
|
178
180
|
|
|
179
|
-
// Level
|
|
180
|
-
x.
|
|
181
|
+
// Level ω: diagonalize ω*y (→ a↑^a a)
|
|
182
|
+
x.aperiote(3); // aper(3) = h10
|
|
183
|
+
|
|
184
|
+
// Level ω+1: iterate aperiote
|
|
185
|
+
x.expande(3); // expa(3) = h11
|
|
186
|
+
|
|
187
|
+
// Level ω+2: iterate expande
|
|
188
|
+
x.multiexpande(3); // muea(3) = h12
|
|
189
|
+
|
|
190
|
+
// Level ω+3: iterate multiexpande
|
|
191
|
+
x.powerexpande(3); // poea(3) = h13
|
|
192
|
+
|
|
193
|
+
// Level ω*2: diagonalize ω+y
|
|
194
|
+
x.aperioexpande(3); // apea(3) = h20
|
|
195
|
+
|
|
196
|
+
// Level ω*2+1: iterate aperioexpande
|
|
197
|
+
x.explode(3); // expl(3) = h21
|
|
198
|
+
|
|
199
|
+
// Level ω*2+2: iterate explode
|
|
200
|
+
x.multiexplode(3); // muel(3) = h22
|
|
201
|
+
|
|
202
|
+
// Level ω*3: diagonalize ω*2+y
|
|
203
|
+
x.aperioexplode(3); // apel(3) = h30
|
|
204
|
+
|
|
205
|
+
// Level ω*3+1: iterate aperioexplode
|
|
206
|
+
x.detonate(3); // deto(3) = h31
|
|
207
|
+
|
|
208
|
+
// Level ω*4: diagonalize ω*3+y
|
|
209
|
+
x.aperiodetonate(3); // apdt(3) = h40
|
|
210
|
+
|
|
211
|
+
// Level ω^2: diagonalize ω*y
|
|
212
|
+
x.aperionate(3); // apeo(3) = h100
|
|
213
|
+
|
|
214
|
+
// Level ω^2+1: iterate aperionate
|
|
215
|
+
x.megote(3); // mego(3) = h101
|
|
181
216
|
|
|
182
|
-
// Level
|
|
183
|
-
x.
|
|
217
|
+
// Level ω^2+2: iterate megote
|
|
218
|
+
x.multimegote(3); // mume(3) = h102
|
|
184
219
|
|
|
185
|
-
// Level
|
|
186
|
-
x.
|
|
220
|
+
// Level ω^2+ω: diagonalize ω^2+y
|
|
221
|
+
x.aperimegote(3); // apmg(3) = h110
|
|
187
222
|
|
|
188
|
-
// Level
|
|
189
|
-
x.
|
|
223
|
+
// Level ω^2+ω+1: iterate aperimegote
|
|
224
|
+
x.megoexpande(3); // mgea(3) = h111
|
|
190
225
|
|
|
191
|
-
// Level
|
|
192
|
-
x.
|
|
226
|
+
// Level ω^2+ω*2: diagonalize ω^2+ω+y
|
|
227
|
+
x.aperimegoexpande(3); // apme(3) = h120
|
|
193
228
|
|
|
194
|
-
// Level
|
|
195
|
-
x.
|
|
229
|
+
// Level ω^2*2: diagonalize ω^2+ω*y
|
|
230
|
+
x.megoaperionation(3); // mgao(3) = h200
|
|
196
231
|
|
|
197
|
-
// Level ω^
|
|
198
|
-
x.
|
|
232
|
+
// Level ω^2*2+1: iterate megoaperionation
|
|
233
|
+
x.gigote(3); // gigo(3) = h201
|
|
199
234
|
|
|
200
|
-
// Level ω^
|
|
201
|
-
x.
|
|
235
|
+
// Level ω^2*2+ω: diagonalize ω^2*2+y
|
|
236
|
+
x.aperigigote(3); // apgg(3) = h210
|
|
202
237
|
|
|
203
|
-
// Level ω^
|
|
204
|
-
x.
|
|
238
|
+
// Level ω^2*3: diagonalize ω^2*2+ω*y
|
|
239
|
+
x.gigoaperionate(3); // ggap(3) = h300
|
|
205
240
|
|
|
206
|
-
// Level ω^
|
|
207
|
-
x.
|
|
241
|
+
// Level ω^3: diagonalize ω^2*y
|
|
242
|
+
x.aperiatotion(3); // apat(3) = h1000
|
|
208
243
|
|
|
209
|
-
// Level ω^
|
|
210
|
-
x.
|
|
244
|
+
// Level ω^3+1: iterate aperiatotion
|
|
245
|
+
x.powiainate(3); // pwan(3) = h1001
|
|
211
246
|
|
|
212
|
-
// Level ω^
|
|
213
|
-
x.
|
|
247
|
+
// Level ω^3+ω: diagonalize ω^3+y
|
|
248
|
+
x.expandainate(3); // epan(3) = h1010
|
|
214
249
|
|
|
215
|
-
// Level ω^
|
|
216
|
-
x.
|
|
250
|
+
// Level ω^3+ω^2: diagonalize ω^3+ω*y
|
|
251
|
+
x.megodainate(3); // mgan(3) = h1100
|
|
217
252
|
|
|
218
|
-
// Level ω^
|
|
219
|
-
x.
|
|
253
|
+
// Level ω^3*2: diagonalize ω^3+ω^2*y
|
|
254
|
+
x.powiairate(3); // pwar(3) = h2000
|
|
220
255
|
|
|
221
|
-
// Level ω^
|
|
222
|
-
x.
|
|
256
|
+
// Level ω^4: diagonalize ω^3*y
|
|
257
|
+
x.aperioguate(3); // apgu(3) = h10000
|
|
223
258
|
|
|
224
|
-
// Level ω^(
|
|
225
|
-
x.
|
|
259
|
+
// Level ω^ω: diagonalize ω^x (layer 1 transition)
|
|
260
|
+
x.iter(3); // ite(3) = hww
|
|
226
261
|
|
|
227
|
-
// Level
|
|
228
|
-
x.
|
|
262
|
+
// Level ω^ω+1: iterate ω^ω level operations
|
|
263
|
+
x.itermult(3); // itmu(3) = hw01
|
|
264
|
+
|
|
265
|
+
// Level ω^ω*2: (ω^ω)*2 = ω^ω + ω^base
|
|
266
|
+
x.cuboiter(3); // cube(3) = hwx2
|
|
267
|
+
|
|
268
|
+
// Level ω^(ω+1): ω^(ω+1) = ω^ω*ω → ω^(ω*y)
|
|
269
|
+
x.expoiter(3); // expo(3) = hwa1
|
|
270
|
+
|
|
271
|
+
// Level ω^(ω*2): ω^(ω*2) = ω^(ω+base)
|
|
272
|
+
x.trioterate(3); // tria(3) = hwm2
|
|
273
|
+
|
|
274
|
+
// Level ω^(ω^2): diagonalize ω^(ω*y) (layer 2)
|
|
275
|
+
x.trixxate(3); // trix(3) = hwp2
|
|
276
|
+
|
|
277
|
+
// Level ω^(ω^ω): diagonalize ω^(ω^y) (layer 3)
|
|
278
|
+
x.aperixxate(3); // apix(3) = hwpw
|
|
279
|
+
|
|
280
|
+
// Level ε₀ = ω↑↑ω: diagonalize ω↑↑y (layer 4)
|
|
281
|
+
x.epsilonate(3); // epsl(3) = hepsl
|
|
229
282
|
```
|
|
230
283
|
|
|
231
284
|
## Inverse Operations
|
|
@@ -233,24 +286,68 @@ x.iter(3); // iter(x, 3)
|
|
|
233
286
|
Each expansion operation has a corresponding inverse for decrementing ordinal structure:
|
|
234
287
|
|
|
235
288
|
```javascript
|
|
236
|
-
x.i_aper(z) // inverse of
|
|
237
|
-
x.i_expa(z) // inverse of expande
|
|
238
|
-
x.i_muea(z) // inverse of multiexpande
|
|
239
|
-
x.i_poea(z) // inverse of powerexpande
|
|
240
|
-
x.i_apea(z) // inverse of
|
|
241
|
-
x.i_expl(z) // inverse of explode
|
|
242
|
-
x.i_muel(z) // inverse of multiexplode
|
|
243
|
-
x.i_apel(z) // inverse of aperioexplode
|
|
244
|
-
x.i_deto(z) // inverse of detonate
|
|
245
|
-
x.
|
|
246
|
-
x.
|
|
247
|
-
x.
|
|
248
|
-
x.
|
|
249
|
-
x.
|
|
250
|
-
x.
|
|
251
|
-
x.
|
|
252
|
-
x.
|
|
253
|
-
x.
|
|
289
|
+
x.i_aper(z) // i10 = inverse of aperiote
|
|
290
|
+
x.i_expa(z) // i11 = inverse of expande
|
|
291
|
+
x.i_muea(z) // i12 = inverse of multiexpande
|
|
292
|
+
x.i_poea(z) // i13 = inverse of powerexpande
|
|
293
|
+
x.i_apea(z) // i20 = inverse of aperioexpande
|
|
294
|
+
x.i_expl(z) // i21 = inverse of explode
|
|
295
|
+
x.i_muel(z) // i22 = inverse of multiexplode
|
|
296
|
+
x.i_apel(z) // i30 = inverse of aperioexplode
|
|
297
|
+
x.i_deto(z) // i31 = inverse of detonate
|
|
298
|
+
x.i_apdt(z) // i40 = inverse of aperiodetonate
|
|
299
|
+
x.i_apeo(z) // i100 = inverse of aperionate
|
|
300
|
+
x.i_mego(z) // i101 = inverse of megote
|
|
301
|
+
x.i_mume(z) // i102 = inverse of multimegote
|
|
302
|
+
x.i_apmg(z) // i110 = inverse of aperimegote
|
|
303
|
+
x.i_mgea(z) // i111 = inverse of megoexpande
|
|
304
|
+
x.i_apme(z) // i120 = inverse of aperimegoexpande
|
|
305
|
+
x.i_mgao(z) // i200 = inverse of megoaperionation
|
|
306
|
+
x.i_gigo(z) // i201 = inverse of gigote
|
|
307
|
+
x.i_apgg(z) // i210 = inverse of aperigigote
|
|
308
|
+
x.i_ggap(z) // i300 = inverse of gigoaperionate
|
|
309
|
+
x.i_apat(z) // i1000 = inverse of aperiatotion
|
|
310
|
+
x.i_pwan(z) // i1001 = inverse of powiainate
|
|
311
|
+
x.i_epan(z) // i1010 = inverse of expandainate
|
|
312
|
+
x.i_mgan(z) // i1100 = inverse of megodainate
|
|
313
|
+
x.i_pwar(z) // i2000 = inverse of powiairate
|
|
314
|
+
x.i_apgu(z) // i10000 = inverse of aperioguate
|
|
315
|
+
x.i_ite(z) // iww = inverse of iter
|
|
316
|
+
x.i_itmu(z) // iw01 = inverse of itermult
|
|
317
|
+
x.i_cube(z) // iwx2 = inverse of cuboiter
|
|
318
|
+
x.i_expo(z) // iwa1 = inverse of expoiter
|
|
319
|
+
x.i_tria(z) // iwm2 = inverse of trioterate
|
|
320
|
+
x.i_trix(z) // iwp2 = inverse of trixxate
|
|
321
|
+
x.i_apix(z) // iwpw = inverse of aperixxate
|
|
322
|
+
x.i_epsl(z) // iepsl = inverse of epsilonate
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## BEAF Operations
|
|
326
|
+
|
|
327
|
+
Bowers' Exploding Array Function (BEAF) is supported via ordinal arithmetic for 4+ arguments:
|
|
328
|
+
|
|
329
|
+
```javascript
|
|
330
|
+
// 3-entry: {a,b,c} = a↑^c b (standard up-arrow notation)
|
|
331
|
+
MetaNum.BEAF(3, 3, 2); // 3↑↑3 = 7625597484987
|
|
332
|
+
MetaNum.BEAF(3, 3, 3); // 3↑↑↑3 = tritri
|
|
333
|
+
|
|
334
|
+
// 4-entry: {a,b,c,d} = a(ω*(d-1)+(c-1) level operation)b
|
|
335
|
+
MetaNum.BEAF(2, 2, 1, 2); // = 4
|
|
336
|
+
MetaNum.BEAF(3, 3, 3, 3); // 3(ω*2+2 level operation)3
|
|
337
|
+
|
|
338
|
+
// 5+ entry: ordinal arithmetic
|
|
339
|
+
// BEAF(a,b,c,d,...,n) = a(ω^(n-3)*(arg_n-1)+...+ω*(d-1)+(c-1) level operation)b
|
|
340
|
+
MetaNum.BEAF(10, 2, 1, 1, 2); // = BEAF(10,10,10,10) (ω^2 level operation)
|
|
341
|
+
MetaNum.BEAF(3, 3, 3, 3, 2); // 3(ω^2+ω*2+2 level operation)3
|
|
342
|
+
|
|
343
|
+
// Parse BEAF string notation
|
|
344
|
+
MetaNum.fromBeaf("{3,3,3}"); // 3↑↑↑3
|
|
345
|
+
MetaNum.fromBeaf("{3,3,3,3}"); // 3(ω*2+2)3
|
|
346
|
+
MetaNum.fromBeaf("{10,2,1,1,2}"); // 10(ω^2)2
|
|
347
|
+
|
|
348
|
+
// Convert to BEAF string
|
|
349
|
+
new MetaNum(7625597484987).toBeaf(); // "{7625597484987}"
|
|
350
|
+
MetaNum.BEAF(3,3,3).toBeaf(); // "{3638334640023.7783}"
|
|
254
351
|
```
|
|
255
352
|
|
|
256
353
|
## Layer & Serialization
|
|
@@ -564,8 +661,10 @@ Then we can define (the β-th symbol or symbol combination)Aa = f\_ω^ω^...^ω(
|
|
|
564
661
|
|
|
565
662
|
#### Using dlsdl's letter notation, the biggest number we can define in Metanum is about ε1.797e308.
|
|
566
663
|
|
|
567
|
-
##
|
|
664
|
+
## Changelog
|
|
568
665
|
|
|
666
|
+
- 2026-7-31 v1.3 Add format-metanum.js, fix basic operations, hyper operations and BEAF bugs
|
|
667
|
+
- 2026-7-9 v1.2 Add more hyper operations up to ε₀, add BEAF operation and fix bugs
|
|
569
668
|
- 2026-6-3 v1.1 Add support for very small numbers ,add more hyper operations and fix bugs
|
|
570
669
|
- 2026-5-23 v1.0 Rewritten and add even more hyper operations
|
|
571
670
|
- 2026-2-24 v0.4 Add hyper operations and extend fromString
|