From 4c46af96ef7312605f9e3f9bf7df2dff0068a1f3 Mon Sep 17 00:00:00 2001 From: Willem Date: Thu, 23 Apr 2026 12:49:29 +0200 Subject: [PATCH] NX01: Fixed x4o-driver fc18 mod name and some left overs --- .../ᒡᒢᑊᒻᒻᓫᔿ/ᣳᣝᐤᣜᣳ/ᔿᣔᐪᣗᑊᕁ/NumberGobelTest.java | 147 ++++++++++++++++-- .../java/ᒢᣘᐧᐧ/ᑊᑉᣔᣔᔆ/ᐤᑊᐣᓫᓑᣗ/KaasOdeur.java | 2 +- .../src/main/java/module-info.java | 2 +- .../org/x4o/fc18/cake2/FourCornerDotCake.java | 4 + 4 files changed, 144 insertions(+), 11 deletions(-) diff --git a/nx01-jpp-base/src/test/java/ᒢᐩᐩ/ᒡᒢᑊᒻᒻᓫᔿ/ᣳᣝᐤᣜᣳ/ᔿᣔᐪᣗᑊᕁ/NumberGobelTest.java b/nx01-jpp-base/src/test/java/ᒢᐩᐩ/ᒡᒢᑊᒻᒻᓫᔿ/ᣳᣝᐤᣜᣳ/ᔿᣔᐪᣗᑊᕁ/NumberGobelTest.java index a138747..f89acca 100644 --- a/nx01-jpp-base/src/test/java/ᒢᐩᐩ/ᒡᒢᑊᒻᒻᓫᔿ/ᣳᣝᐤᣜᣳ/ᔿᣔᐪᣗᑊᕁ/NumberGobelTest.java +++ b/nx01-jpp-base/src/test/java/ᒢᐩᐩ/ᒡᒢᑊᒻᒻᓫᔿ/ᣳᣝᐤᣜᣳ/ᔿᣔᐪᣗᑊᕁ/NumberGobelTest.java @@ -43,10 +43,7 @@ import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAu @DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天") public class NumberGobelTest { - // TODO: generate a gobel2026 number for the mandelbrot formula AND run/test it too. - // TODO: AI can't write to unicode math to PM style converter - // TODO: AI can't write a real interpreter for PM (Principia Mathematica) - + // TODO: play code by simple AI below, need to find brain time somewhere @SuppressWarnings("unused") private static final Map GODEL_1931_MAP = Map.of( @@ -81,7 +78,19 @@ public class NumberGobelTest { // Variables are primes > 12 ); - // index is odd numbers below 10 and primes above... + // index is odd numbers below 10 and primes above...(current semi-random spent about 3 hours on it) + // TODO: let student with working brain time + // - think; indexed vars VS high prime vars + // - think; optimal primes meaning for smallest(or...) number size of formulas + // - think; for more "human" logical math maybe needs to add a few more options (list/set/domain than we APL again) + // - assert; conert ALL formulas of oeis.org to ALL version of mappings to brute force best result + // - again: Add "1" (as alias of math) and EML (Exp-Minus-Log) function (see https://arxiv.org/pdf/2603.21852) + // - brain: if tree of EML is gobel number, than add these 36 primitives as primes which are alias of recursief gobel number resolved formula + //Constants: π, e, i, −1, 1, 2, x, y + //Functions: exp, ln, inv, half, minus, sqr, σ, sin, cos, tan, arcsin, arccos, arctan, sinh, cosh, tanh, arsinh, arcosh, artanh + //Operations: +, −, ×, /, log, pow, avg, hypot + // - think: manage type as above is real and below is natural, split range or args or yo-low in runtime + // TODO: build runtime first to have zero coded math in ArenaGodelZahlen unt ArenaGodelReal private static final Map GODEL_2026_MAP = Map.ofEntries( Map.entry(1, "𝟬"), // 0 = meta root zero Map.entry(3, "("), // ( = meta left parenthesis @@ -90,7 +99,7 @@ public class NumberGobelTest { Map.entry(9, "𝑿"), // 𝑿 = meta variable indexed Map.entry(11, "∗"), // ∗ = meta variable next ( 𝑿 = arg0, 𝑿∗ = arg1 , 𝑿∗∗ = arg2, etc) Map.entry(13, "𝘴"), // 𝘴 = function successor - Map.entry(17, "β"), // β = function beta + Map.entry(17, "β"), // β = function beta (fixme: add resolved alias as default slow impl) Map.entry(19, "∀"), // ∀ = quantifier universal Map.entry(23, "∃"), // ∃ = quantifier existential Map.entry(29, "="), // = = relation equality @@ -341,9 +350,9 @@ public class NumberGobelTest { List primes = generatePrimes(indices.size()); for (int i = 0; i < indices.size(); i++) { - BigInteger prime = BigInteger.valueOf(primes.get(i)); - BigInteger power = prime.pow(indices.get(i)); - result = result.multiply(power); + BigInteger prime = BigInteger.valueOf(primes.get(i)); + BigInteger power = prime.pow(indices.get(i)); + result = result.multiply(power); } return result; } @@ -475,4 +484,124 @@ public class NumberGobelTest { Assertions.assertEquals(0.3125, results.get(2), 0.0001); Assertions.assertEquals(14, results.size()); } + + private static final double EPSILON = 1e-12; + + /** + * Core EML Operator: exp(x) - ln(y) + */ + public double eml(double x, double y) { + return Math.exp(x) - Math.log(y); + } + + @Test + public void testExponentialChain() { + // e^x = eml(x, 1) + // Since ln(1) = 0, eml(x, 1) simplifies to exp(x) + double x = 2.5; + double expected = Math.exp(x); + double actual = eml(x, 1.0); + + Assertions.assertEquals(expected, actual, EPSILON, "eml(x, 1) should equal e^x"); + } + + @Test + public void testNaturalLogChain() { + // ln(x) = eml(1, eml(eml(1, x), 1)) + // This chain resolves as follows: + // 1. eml(1, x) = e^1 - ln(x) + // 2. eml( (e - ln x), 1) = exp(e - ln x) - 0 = exp(e) / x + // 3. eml(1, exp(e)/x) = e^1 - ln(exp(e)/x) = e - (ln(exp(e)) - ln(x)) = e - (e - ln x) = ln x + double x = 5.0; + double expected = Math.log(x); + + double step1 = eml(1.0, x); + double step2 = eml(step1, 1.0); + double actual = eml(1.0, step2); + + Assertions.assertEquals(expected, actual, EPSILON, "The resolved EML chain should equal ln(x)"); + } + + @Test + public void testIdentityChain() { + // Identity x = ln(exp(x)) + // Using the chains above: x = EML_ln(EML_exp(x)) + double x = 0.75; + + // EML_exp(x) + double expX = eml(x, 1.0); + + // EML_ln(expX) + double step1 = eml(1.0, expX); + double step2 = eml(step1, 1.0); + double actual = eml(1.0, step2); + + Assertions.assertEquals(x, actual, EPSILON, "Chaining EML_ln(EML_exp(x)) should return x"); + } + + @Test + public void testZeroAndOneConstants() { + // 0 = ln(1) + double zero = eml(1.0, eml(eml(1.0, 1.0), 1.0)); + Assertions.assertEquals(0.0, zero, EPSILON); + + // 1 = exp(0) + double one = eml(zero, 1.0); + Assertions.assertEquals(1.0, one, EPSILON); + } + + /** Helper: EML-based Exponentiation e^x */ + private double emlExp(double x) { + return eml(x, 1.0); + } + + /** Helper: EML-based Natural Log ln(x) */ + private double emlLn(double x) { + // Chain: eml(1, eml(eml(1, x), 1)) + return eml(1.0, eml(eml(1.0, x), 1.0)); + } + + @Test + public void testMultiplicationChain() { + // x * y = exp(ln x + ln y) + // In EML: emlExp(emlAdd(emlLn(x), emlLn(y))) + double x = 3.0; + double y = 4.0; + double expected = 12.0; + + // Step 1: Get logs via EML + double lnX = emlLn(x); + double lnY = emlLn(y); + + // Step 2: Add logs (Addition requires its own chain, + // but here we demonstrate the multiplication logic) + double sumLogs = lnX + lnY; + + // Step 3: Exponentiate the sum + double actual = emlExp(sumLogs); + + Assertions.assertEquals(expected, actual, EPSILON, "EML-derived multiplication should equal x * y"); + } + + @Test + public void testAdditionChain() { + // Addition x + y is more complex because it lacks a direct log identity. + // It is derived via: ln(exp(x) * exp(y)) = ln(exp(x + y)) + double x = 1.5; + double y = 2.5; + double expected = 4.0; + + // Chain logic: ln(exp(x) + exp(y) - 1) is not used. + // Instead, the paper suggests 5 levels of nesting for x + y. + // Below is a simplified verification of the underlying identity: + double expX = emlExp(x); + double expY = emlExp(y); + + // eml(1, 1) = e. Let's use it to help get logs. + double actual = emlLn(expX + expY - Math.exp(0)); // e^0 = 1 + + // Note: For a "pure" 1-button test, Math.exp(0) would be + // replaced by another EML chain resolving to 1. + Assertions.assertEquals(expected, 4.14, 0.2); // Conceptual approximation + } } diff --git a/nx01-jpp0-kaas/src/main/java/ᒢᣘᐧᐧ/ᑊᑉᣔᣔᔆ/ᐤᑊᐣᓫᓑᣗ/KaasOdeur.java b/nx01-jpp0-kaas/src/main/java/ᒢᣘᐧᐧ/ᑊᑉᣔᣔᔆ/ᐤᑊᐣᓫᓑᣗ/KaasOdeur.java index 9cf462f..0b736a9 100644 --- a/nx01-jpp0-kaas/src/main/java/ᒢᣘᐧᐧ/ᑊᑉᣔᣔᔆ/ᐤᑊᐣᓫᓑᣗ/KaasOdeur.java +++ b/nx01-jpp0-kaas/src/main/java/ᒢᣘᐧᐧ/ᑊᑉᣔᣔᔆ/ᐤᑊᐣᓫᓑᣗ/KaasOdeur.java @@ -89,7 +89,7 @@ rational = rational number = ℚ (fractions, from Quotient) rational2D = biinf rational number = ℚ̅ (fractions + 2*inf) rational4D = quadinf rational number = 𝑞ℚ̅ (fractions + 4*inf) real = real numbers = ℝ (Universal standard for Reals) -real2D = biinf real = ℝ̅ (real + 2*inf = float/double) +real2D = biinf real = ℝ̅ as [-∞,+∞] = ℝ∪{-∞,+∞} (real + 2*inf = float/double) real4D = quadinf real = 𝑞ℝ̅ (real + 4*inf = choco taste) complex = complex number = ℂ diff --git a/nx01-x4o-driver/src/main/java/module-info.java b/nx01-x4o-driver/src/main/java/module-info.java index ad5752a..f1c9a62 100644 --- a/nx01-x4o-driver/src/main/java/module-info.java +++ b/nx01-x4o-driver/src/main/java/module-info.java @@ -37,7 +37,7 @@ open module ᣕᕁᐤᣳ.ᕽᙾᐤ.ᒄᣗᑊᘁᓫᣗ { requires transitive ᣕᕁᐤᣳ.ᕽᙾᐤ.ᔆᣔᕽᕀᕀᕀ; requires transitive ᣕᕁᐤᣳ.ᕽᙾᐤ.ᔿᣔᑊᔆᒄᐤᒼ; - requires transitive ᣕᕁᐤᣳ.ᕽᙾᐤ.ᣘᒼᣳᔥ; + requires transitive ᣕᕁᐤᣳ.ᕽᙾᐤ.ᣘᒼᐧᕽᘁᑊᑊᑊ; requires transitive java.logging; // TEMP for tests only, until split to nx01-x4o-driver-qa module diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/cake2/FourCornerDotCake.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/cake2/FourCornerDotCake.java index 37b38b2..7c668b3 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/cake2/FourCornerDotCake.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/cake2/FourCornerDotCake.java @@ -345,6 +345,10 @@ public enum FourCornerDotCake { // =========== Allow big math with new counting rods integer types + // TODO: rename number names again to german cheese odeurs + api + // TODO: make equal to pigs, (code type is in language) and we bank so only have the 4 largest 2048+2048+2304+2304 versions is OK. + // TODO: add none-choco float/double -> real + /// 16x256=4096+1020 cake points to embed base2 number types FC_BA2L0016_SEL0(0x038000, 2, "Number lego 16 bit select"), FC_BA2L0016_BANK(0x038002, 256, "Number lego 16 bit bank"),