JPP: Added WIP test case for gobel number mapping
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 49s
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 49s
This commit is contained in:
parent
423b2b2fa9
commit
36a6929aee
2 changed files with 491 additions and 56 deletions
|
|
@ -0,0 +1,478 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᔿᣔᐪᣗᑊᕁ;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
|
||||
@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)
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final Map<Integer, String> GODEL_1931_MAP = Map.of(
|
||||
1, "0", // 0 = Zero
|
||||
3, "𝘴", // 𝘴 = Successor
|
||||
5, "¬", // ¬ = Negation (NOT)
|
||||
7, "∨", // ∨ = Disjunction (OR)
|
||||
9, "∀", // ∀ = Universal quantifier (For all)
|
||||
11, "(", // ( = Left parenthesis
|
||||
13, ")" // ) = Right parenthesis
|
||||
// Variables are primes > 12
|
||||
);
|
||||
|
||||
// see: https://math.stackexchange.com/questions/3559755/non-injective-g%C3%B6del-numbering-scheme-in-nagel-and-newman
|
||||
// page 69: "Gödel first showed that it is possible to assign a unique number to each elementary sign,
|
||||
// each formula (or sequence of signs), and each proof (or finite sequence of formulas)."
|
||||
@Deprecated // use odd numbers to avoid duplicates
|
||||
@SuppressWarnings("unused")
|
||||
private static final Map<Integer, String> NAGEL_NEWMAN_MAP = Map.ofEntries(
|
||||
Map.entry(1, "~"), // Negation (Not)
|
||||
Map.entry(2, "∨"), // Disjunction (Or)
|
||||
Map.entry(3, "⊃"), // Implication (If... then)
|
||||
Map.entry(4, "∃"), // Existential Quantifier (There exists)
|
||||
Map.entry(5, "="), // Identity (Equals)
|
||||
Map.entry(6, "0"), // Zero
|
||||
Map.entry(7, "s"), // Successor (f in Gödel's 1931)
|
||||
Map.entry(8, "("), // Left Parenthesis
|
||||
Map.entry(9, ")"), // Right Parenthesis
|
||||
Map.entry(10, ","), // Punctuation (Comma)
|
||||
Map.entry(11, "+"), // Addition
|
||||
Map.entry(12, "×") // Multiplication (Included in their expanded set)
|
||||
// Variables are primes > 12
|
||||
);
|
||||
|
||||
// index is odd numbers below 10 and primes above...
|
||||
private static final Map<Integer, String> GODEL_2026_MAP = Map.ofEntries(
|
||||
Map.entry(1, "𝟬"), // 0 = meta root zero
|
||||
Map.entry(3, "("), // ( = meta left parenthesis
|
||||
Map.entry(5, ")"), // ) = meta right parenthesis
|
||||
Map.entry(7, ","), // , = meta argument punctuation
|
||||
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(19, "∀"), // ∀ = quantifier universal
|
||||
Map.entry(23, "∃"), // ∃ = quantifier existential
|
||||
Map.entry(29, "="), // = = relation equality
|
||||
Map.entry(31, "<"), // < = relation less than
|
||||
Map.entry(37, "¬"), // ¬ = logical negation (NOT)
|
||||
Map.entry(41, "∨"), // ∨ = logical disjunction (OR)
|
||||
Map.entry(43, "∧"), // ∨ = logical conjunction (AND)
|
||||
Map.entry(47, "+"), // + = operation addition
|
||||
Map.entry(53, "×") // × = operation multiplication
|
||||
);
|
||||
|
||||
private static final Map<String, Integer> GODEL_2026_MAP_TEXT = GODEL_2026_MAP.entrySet()
|
||||
.stream().collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey));
|
||||
|
||||
@Test
|
||||
public void testDecodeGodelNumber() {
|
||||
// Example: Encoding (Z, n, +) where Z=17, n=19, +=15
|
||||
// G = 2^17 * 3^19 * 5^15
|
||||
BigInteger godelNumber = new BigInteger("4649045868000000000000000");
|
||||
|
||||
List<Integer> decodedSymbols = decodeGödel(godelNumber);
|
||||
|
||||
// Assert the exponents match the original sequence
|
||||
Assertions.assertEquals(List.of(17, 19, 15), decodedSymbols);
|
||||
|
||||
// test resolved mandelbrot;
|
||||
BigInteger mandelBrotNumber = new BigInteger("683505876359950041159216395292418218643723548897506786765531772046527226636478552969268654443353250389915930385563708788491517027407860457492594921188896142308121054502817356554744425581825883892148702715030604280860100517232762642163389221976134018668275595000517989293393564980042093763809452107500000000000000000");
|
||||
List<Integer> mandelBrotSymbols = decodeGödel(mandelBrotNumber);
|
||||
Assertions.assertEquals(List.of(17, 11, 19, 3, 13, 5, 11, 17, 19, 13, 17, 11, 17, 19, 13, 15, 23), mandelBrotSymbols);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a Gödel number by finding the exponent of each prime factor.
|
||||
*/
|
||||
private List<Integer> decodeGödel(BigInteger g) {
|
||||
List<Integer> symbols = new ArrayList<>();
|
||||
BigInteger prime = BigInteger.valueOf(2);
|
||||
|
||||
// Loop through primes until the remaining number is 1
|
||||
while (g.compareTo(BigInteger.ONE) > 0) {
|
||||
int exponent = 0;
|
||||
|
||||
// Count how many times the current prime divides the number
|
||||
while (g.remainder(prime).equals(BigInteger.ZERO)) {
|
||||
g = g.divide(prime);
|
||||
exponent++;
|
||||
}
|
||||
|
||||
if (exponent > 0) {
|
||||
symbols.add(exponent);
|
||||
}
|
||||
|
||||
// Move to the next prime
|
||||
prime = prime.nextProbablePrime();
|
||||
}
|
||||
return symbols;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gödel's Beta Function: beta(c, d, i) = c mod (1 + (i + 1) * d)
|
||||
*/
|
||||
public BigInteger beta(BigInteger c, BigInteger d, int i) {
|
||||
return c.remainder(BigInteger.ONE.add(BigInteger.valueOf(i + 1).multiply(d)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBetaFunctionDecoding() {
|
||||
// Example: Sequence [5, 2, 8]
|
||||
// These specific c and d values are calculated using the Chinese Remainder Theorem
|
||||
//BigInteger c = new BigInteger("1453");
|
||||
//BigInteger d = new BigInteger("120");
|
||||
/// AI math error must be c=196756326607711 d=40320;
|
||||
|
||||
int[] seq = {5, 2, 8};
|
||||
BigInteger d = calculateD(seq);
|
||||
BigInteger c = calculateC(seq, d);
|
||||
|
||||
// beta(c, d, 0) should be 5
|
||||
Assertions.assertEquals(BigInteger.valueOf(5), beta(c, d, 0), "Index 0 should be 5");
|
||||
|
||||
// beta(c, d, 1) should be 2
|
||||
Assertions.assertEquals(BigInteger.valueOf(2), beta(c, d, 1), "Index 1 should be 2");
|
||||
|
||||
// beta(c, d, 2) should be 8
|
||||
Assertions.assertEquals(BigInteger.valueOf(8), beta(c, d, 2), "Index 2 should be 8");
|
||||
|
||||
// beta(c, d, 3) should be 103333 == EOF
|
||||
//Assertions.assertEquals(BigInteger.valueOf(103333), beta(c, d, 3), "Index 3 should be 103333");
|
||||
}
|
||||
|
||||
// Chinese Remainder Theorem logic to find c
|
||||
public BigInteger calculateC(int[] sequence, BigInteger d) {
|
||||
BigInteger prod = BigInteger.ONE;
|
||||
BigInteger[] moduli = new BigInteger[sequence.length];
|
||||
|
||||
for (int i = 0; i < sequence.length; i++) {
|
||||
moduli[i] = BigInteger.ONE.add(BigInteger.valueOf(i + 1).multiply(d));
|
||||
prod = prod.multiply(moduli[i]);
|
||||
}
|
||||
|
||||
BigInteger c = BigInteger.ZERO;
|
||||
for (int i = 0; i < sequence.length; i++) {
|
||||
BigInteger m_i = moduli[i];
|
||||
BigInteger p = prod.divide(m_i);
|
||||
BigInteger inv = p.modInverse(m_i);
|
||||
c = c.add(BigInteger.valueOf(sequence[i]).multiply(inv).multiply(p));
|
||||
}
|
||||
return c.remainder(prod);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCalculateSequence0to9() {
|
||||
int[] seq = IntStream.range(0, 10).toArray();
|
||||
// d must be a multiple of n! (10!)
|
||||
BigInteger d = new BigInteger("3628800");
|
||||
BigInteger c = calculateC(seq, d);
|
||||
|
||||
for (int i = 0; i < seq.length; i++) {
|
||||
Assertions.assertEquals(BigInteger.valueOf(seq[i]), beta(c, d, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCalculateSequenceWithShift() {
|
||||
int[] originalSeq = {-1, 0, 1};
|
||||
int shift = 1; // Shift to make all values >= 0
|
||||
int[] shiftedSeq = {0, 1, 2};
|
||||
|
||||
BigInteger d = new BigInteger("6"); // 3!
|
||||
BigInteger c = calculateC(shiftedSeq, d);
|
||||
|
||||
for (int i = 0; i < originalSeq.length; i++) {
|
||||
Assertions.assertEquals(BigInteger.valueOf(originalSeq[i] + shift), beta(c, d, i));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates d: a multiple of the factorial of max(length, max_value).
|
||||
* Formally: d = [max(j, a_j)!]
|
||||
*/
|
||||
public BigInteger calculateD(int[] sequence) {
|
||||
int maxVal = Arrays.stream(sequence).max().getAsInt();
|
||||
int n = sequence.length;
|
||||
int limit = Math.max(maxVal, n);
|
||||
|
||||
BigInteger d = BigInteger.ONE;
|
||||
for (int i = 1; i <= limit; i++) {
|
||||
d = d.multiply(BigInteger.valueOf(i));
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFullSequenceEncoding() {
|
||||
int[] seq = {300, 299, 123, 12, 9, 512};
|
||||
|
||||
BigInteger d = calculateD(seq);
|
||||
BigInteger c = calculateC(seq, d);
|
||||
|
||||
for (int i = 0; i < seq.length; i++) {
|
||||
Assertions.assertEquals(BigInteger.valueOf(seq[i]), beta(c, d, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSequenceSizeEncoding() {
|
||||
int[] seq = {1, 3, 3, 7};
|
||||
int[] seqLen = { seq.length, seq[0], seq[1], seq[2], seq[3] };
|
||||
|
||||
BigInteger d = calculateD(seqLen);
|
||||
BigInteger c = calculateC(seqLen, d);
|
||||
|
||||
int len = beta(c, d, 0).intValue();
|
||||
|
||||
for (int i = 1; i <= len; i++) {
|
||||
Assertions.assertEquals(BigInteger.valueOf(seq[i-1]), beta(c, d, i));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses "z_{n+1} = z_n^2 + c" into PM symbols then encodes to integers.
|
||||
*/
|
||||
public static List<Integer> parseAndEncodeDummy(String input) {
|
||||
// Step 1: Formalize sequence variables
|
||||
// s (sequence) -> X | n (index) -> X* | c (constant) -> X**
|
||||
String s = "𝑿";
|
||||
//String n = "𝑿∗";
|
||||
//String c = "𝑿∗∗";
|
||||
|
||||
// Step 2: Construct the PM String based on the Mandelbrot recurrence
|
||||
// β(X, 𝘴(X*)) = (β(X, X*) × β(X, X*)) + X**
|
||||
List<String> pmSymbols = new ArrayList<>();
|
||||
|
||||
// Left Hand Side: z_{n+1}
|
||||
pmSymbols.addAll(List.of("β", "(", s, ",", "𝘴", "(", "𝑿", "∗", ")", ")"));
|
||||
|
||||
// Relation
|
||||
pmSymbols.add("=");
|
||||
|
||||
// Right Hand Side: z_n^2 + c
|
||||
pmSymbols.add("(");
|
||||
pmSymbols.addAll(List.of("β", "(", s, ",", "𝑿", "∗", ")"));
|
||||
pmSymbols.add("×");
|
||||
pmSymbols.addAll(List.of("β", "(", s, ",", "𝑿", "∗", ")"));
|
||||
pmSymbols.add(")");
|
||||
pmSymbols.add("+");
|
||||
pmSymbols.addAll(List.of("𝑿", "∗", "∗"));
|
||||
|
||||
// Step 3: Map to Integers
|
||||
return pmSymbols.stream()
|
||||
.map(sym -> GODEL_2026_MAP_TEXT.getOrDefault(sym, -1))
|
||||
.filter(i -> i != -1)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static String toPMString(List<Integer> godelList) {
|
||||
return godelList.stream().map(GODEL_2026_MAP::get).collect(Collectors.joining());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFullMandelbrotToGodel() {
|
||||
String input = "zₙ₊₁ = zₙ² + c";
|
||||
List<Integer> result = parseAndEncodeDummy(input);
|
||||
|
||||
// Expected integer sequence from the MAP
|
||||
List<Integer> expected = List.of(
|
||||
17, 3, 9, 7, 13, 3, 9, 11, 5, 5, // β(X,𝘴(X*))
|
||||
29, // =
|
||||
3, 17, 3, 9, 7, 9, 11, 5, // (β(X,X*)
|
||||
53, // ×
|
||||
17, 3, 9, 7, 9, 11, 5, 5, // β(X,X*))
|
||||
47, // +
|
||||
9, 11, 11 // X**
|
||||
);
|
||||
|
||||
Assertions.assertEquals(expected, result);
|
||||
System.out.println("Encoded List: " + result);
|
||||
System.out.println("PM Representation: " + toPMString(result));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the single Godel Number for a given list of indices.
|
||||
* Uses the prime power encoding: 2^x1 * 3^x2 * 5^x3 * ...
|
||||
*/
|
||||
public static BigInteger calculateGodelNumber(List<Integer> indices) {
|
||||
BigInteger result = BigInteger.ONE;
|
||||
List<Integer> 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);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static List<Integer> generatePrimes(int n) {
|
||||
List<Integer> primes = new ArrayList<>();
|
||||
int number = 2;
|
||||
while (primes.size() < n) {
|
||||
if (isPrime(number)) primes.add(number);
|
||||
number++;
|
||||
}
|
||||
return primes;
|
||||
}
|
||||
|
||||
private static boolean isPrime(int n) {
|
||||
if (n < 2) return false;
|
||||
for (int i = 2; i <= Math.sqrt(n); i++) {
|
||||
if (n % i == 0) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFullGodelPipeline() {
|
||||
String input = "zₙ₊₁ = zₙ² + c";
|
||||
List<Integer> indices = parseAndEncodeDummy(input);
|
||||
|
||||
BigInteger godelNumber = calculateGodelNumber(indices);
|
||||
|
||||
System.out.println("Godel Number (Partial): " + godelNumber.toString().substring(0, 50) + "...");
|
||||
System.out.println("Total Digits: " + godelNumber.toString().length());
|
||||
|
||||
// Verify the number of digits is approximately 615
|
||||
Assertions.assertTrue(godelNumber.toString().length() > 600);
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates the Mandelbrot recurrence for 13 iterations.
|
||||
* Formula: z_{n+1} = z_n^2 + c
|
||||
*/
|
||||
public static List<Double> runMandelbrot(double cReal, int iterations) {
|
||||
List<Double> results = new ArrayList<>();
|
||||
double z = 0; // z_0 = 0
|
||||
results.add(z);
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
z = (z * z) + cReal;
|
||||
results.add(z);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecoderAndMath() {
|
||||
// 1. Encode "z_{n+1} = z_n^2 + c" (simulated list for brevity)
|
||||
List<Integer> originalIndices = List.of(17, 3, 9, 7, 13, 3, 9, 11, 5, 5, 29, 3, 17, 3, 9, 7, 9, 11, 5, 53, 17, 3, 9, 7, 9, 11, 5, 5, 47, 9, 11, 11);
|
||||
BigInteger gNumber = calculateGodelNumber(originalIndices);
|
||||
|
||||
// 2. Test Decoder
|
||||
List<Integer> decodedSymbols = decodeGödel(gNumber);
|
||||
String decodedString = decodedSymbols.stream().map(GODEL_2026_MAP::get).collect(Collectors.joining());
|
||||
Assertions.assertEquals("β(𝑿,𝘴(𝑿∗))=(β(𝑿,𝑿∗)×β(𝑿,𝑿∗))+𝑿∗∗", decodedString);
|
||||
System.out.println("Decoded Formula: " + decodedString);
|
||||
|
||||
// 3. Run Math Formula 13 times (for c = 0.25)
|
||||
List<Double> iterations = runMandelbrot(0.25, 13);
|
||||
System.out.println("Mandelbrot Sequence (13 iterations):");
|
||||
for (int i = 0; i < iterations.size(); i++) {
|
||||
System.out.printf("z_%d = %.5f\n", i, iterations.get(i));
|
||||
}
|
||||
|
||||
Assertions.assertEquals(14, iterations.size()); // z_0 through z_13
|
||||
Assertions.assertTrue(iterations.get(13) < 0.5); // Should converge for c=0.25
|
||||
}
|
||||
|
||||
/**
|
||||
* Interprets a PM symbol sequence as a mathematical operation.
|
||||
* Arguments:
|
||||
* - symbols: The Gödel indices (e.g., [17, 3, 9, ...])
|
||||
* - state: [sequence_pointer, n_index, c_value]
|
||||
*/
|
||||
public static double interpret(List<Integer> symbols, List<Double> state) {
|
||||
// In PM logic, β(s, n) retrieves the value at index n in sequence s.
|
||||
// For this recurrence: z_{n+1} = z_n^2 + c
|
||||
double zn = state.get(0); // Current z value
|
||||
double c = state.get(2); // Constant value
|
||||
|
||||
boolean hasMultiplication = symbols.contains(53);
|
||||
boolean hasAddition = symbols.contains(47);
|
||||
|
||||
double result = zn;
|
||||
if (hasMultiplication) result = result * result;
|
||||
if (hasAddition) result = result + c;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the interpreted formula 13 times.
|
||||
*/
|
||||
public static List<Double> runInterpreted(List<Integer> symbols, double initialC) {
|
||||
List<Double> trajectory = new ArrayList<>();
|
||||
double z = 0.0; // z_0
|
||||
trajectory.add(z);
|
||||
|
||||
for (int i = 0; i < 13; i++) {
|
||||
// State: [current_z, current_n, constant_c]
|
||||
List<Double> state = List.of(z, (double)i, initialC);
|
||||
z = interpret(symbols, state);
|
||||
trajectory.add(z);
|
||||
}
|
||||
return trajectory;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInterpretedExecution() {
|
||||
// PM symbol list for: β(X,𝘴(X*)) = (β(X,X*) × β(X,X*)) + X**
|
||||
List<Integer> formulaSymbols = List.of(17, 3, 9, 7, 13, 3, 9, 11, 5, 5, 29, 3, 17, 3, 9, 7, 9, 11, 5, 53, 17, 3, 9, 7, 9, 11, 5, 5, 47, 9, 11, 11);
|
||||
|
||||
double constantC = 0.25;
|
||||
List<Double> results = runInterpreted(formulaSymbols, constantC);
|
||||
|
||||
System.out.println("Interpreted Mandelbrot Results (13 steps):");
|
||||
for (int i = 0; i < results.size(); i++) {
|
||||
System.out.printf("Step %d: %.6f\n", i, results.get(i));
|
||||
}
|
||||
|
||||
// Verification: z_1 should be (0^2 + 0.25) = 0.25
|
||||
Assertions.assertEquals(0.25, results.get(1), 0.0001);
|
||||
// Verification: z_2 should be (0.25^2 + 0.25) = 0.3125
|
||||
Assertions.assertEquals(0.3125, results.get(2), 0.0001);
|
||||
Assertions.assertEquals(14, results.size());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue