Subversion Repositories distributed

Compare Revisions

No changes between revisions

Regard whitespace Rev 49 → Rev 48

/ViaThinkSoft Distributed/src/de/viathinksoft/marschall/raumplan/formula/InvalidValException.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/ViaThinkSoft Distributed/src/de/viathinksoft/marschall/raumplan/formula/SelfTestException.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/ViaThinkSoft Distributed/src/de/viathinksoft/marschall/raumplan/formula/FormulaProbe.java
2,19 → 2,44
 
public class FormulaProbe {
 
private static boolean nearlyEqual(double a, double b) {
protected static double round(double value, int decimalPlace) {
if (value < 0) {
// positive value only.
return -round(-value, decimalPlace);
}
 
double power_of_ten = 1;
// floating point arithmetic can be very tricky.
// that's why I introduce a "fudge factor"
double fudge_factor = 0.05;
while (decimalPlace-- > 0) {
power_of_ten *= 10.0d;
fudge_factor /= 10.0d;
}
return Math.round((value + fudge_factor) * power_of_ten) / power_of_ten;
}
 
protected static String roundu(double value) {
if (Math.abs(value) < 0.000000000000001) {
// return "<0.000000000000001";
return "0";
}
return "" + round(value, 17);
}
 
protected static boolean nearlyEqual(double a, double b) {
return Math.abs(Math.abs(a) - Math.abs(b)) < 0.0000000000001;
}
 
private static double pow(double x, double y) {
protected static double pow(double x, double y) {
return Math.pow(x, y);
}
 
private static double sqrt(double x) {
protected static double sqrt(double x) {
return Math.pow(x, 1.0 / 2.0);
}
 
private static double sqrt3(double x) {
protected static double sqrt3(double x) {
if (x >= 0)
return Math.pow(x, 1.0 / 3.0);
else
32,16 → 57,16
+ sqrt3(0.5 - sqrt(31.0 / 108.0));
}
 
public static double w2(double b, double g) throws InvalidValException {
public static double w2(double b, double g) {
if (nearlyEqual(b, b_star())) {
System.out.println("FATAL: w2(b*) is Lambda!");
throw new InvalidValException();
return Double.NaN;
}
 
if (!((g <= g_star()) && (b > b_star()) || (g >= g_star())
&& (b < b_star()))) {
System.out.println("w ist nicht definiert für b=" + b + "; g=" + g);
throw new InvalidValException();
return Double.NaN;
}
 
return (double) ((1 - b) * (g + 1) * (pow(g, 2) - 3 * g + 1))
48,8 → 73,7
/ (2 * (1 - g) * (pow(b, 3) + b - 1));
}
 
public static double K2(double b, double g, double w)
throws SelfTestException {
public static double K2(double b, double g, double w) {
// Vor Umstellung
double res = (double) (3 - g) / (1 - g) - g + pow(g, 2) - 4 + 2 * w
* (b / (1 - b) - b - pow(b, 2) - 1);
63,7 → 87,7
System.out.println("Fatal in K2");
System.out.println(res);
System.out.println(res2);
throw new SelfTestException();
System.exit(1);
}
 
return res;
72,10 → 96,10
 
// Seite 2
 
public static double X(double b, double g) throws InvalidValException {
public static double X(double b, double g) {
if (nearlyEqual(b, b_star())) {
System.out.println("FATAL: X(b,g) may not have b*");
throw new InvalidValException();
return Double.NaN;
}
 
return (g + 1) * (pow(g, 2) - 3 * g + 1) * (1 - b + pow(b, 4)) - 2
88,12 → 112,7
* pow((pow(b, 3) + b - 1), 2);
}
 
public static double b_star_star() {
return 0.724492; // TODO
}
 
public static double w23(double b, double g) throws SelfTestException,
InvalidValException {
public static double w23(double b, double g) {
if (nearlyEqual(b, b_star()))
return w3(b, g);
 
102,34 → 121,24
 
if (dec1 != dec2) {
System.out.println("FATAL: X(b,g) ist falsch");
throw new SelfTestException();
System.exit(1);
return Double.NaN;
}
 
if (!dec1) {
System.out.println("w23 ist nicht definiert für b=" + b + "; g="
+ g);
throw new InvalidValException();
return Double.NaN;
} else {
return w3(b, g); // == w2(b,g)
}
}
 
public static double w3(double b, double g) throws InvalidValException {
if (nearlyEqual(b, b_star_star())) {
System.out.println("FATAL: w3(b**) is Lambda!");
throw new InvalidValException();
public static double w3(double b, double g) {
return (double) (pow(g, 3) * (1 - b)) / ((1 - g) * (1 - b + pow(b, 4)));
}
 
if (b > b_star_star()) {
System.out.println("FATAL: w3(b B b**) < 0!");
throw new InvalidValException();
}
 
return (double) (pow(g, 3) * (1 - b)) / ((1 - g) * (1 - b - pow(b, 4)));
}
 
public static double K3(double b, double g, double w)
throws SelfTestException {
public static double K3(double b, double g, double w) {
// Vor Umstellung
double res = (1.0 / (1 - g)) - g - pow(g, 2) - 1 - w + b * w
* ((1.0 / (1 - b)) - b - pow(b, 2) - 1);
144,29 → 153,80
System.out.println("Fatal in K3");
System.out.println(res);
System.out.println(res2);
throw new SelfTestException();
System.exit(1);
}
 
return res;
}
 
public static double w_star() throws SelfTestException, InvalidValException {
public static double w_star() {
double res = (double) (pow(3 - sqrt(5), 3) * (1 - sqrt3(0.5 + sqrt(31.0 / 108.0)) - sqrt3(0.5 - sqrt(31.0 / 108.0))))
/ (8 * (1 - (double) (3 - sqrt(5)) / 2) * (1
- sqrt3(0.5 + sqrt(31.0 / 108.0))
- sqrt3(0.5 - sqrt(31.0 / 108.0)) - pow(
- sqrt3(0.5 - sqrt(31.0 / 108.0)) + pow(
sqrt3(0.5 + sqrt(31.0 / 108.0))
+ sqrt3(0.5 - sqrt(31.0 / 108.0)), 4)));
double res2 = w3(b_star(), g_star());
 
if (!nearlyEqual(res, res2)) {
if (!nearlyEqual(res, w3(b_star(), g_star()))) {
System.out.println("Self test for w_star() failed!");
System.out.println(res);
System.out.println(res2);
throw new SelfTestException();
System.exit(1);
return Double.NaN;
}
 
return res;
}
 
/**
* @param args
*/
public static void main(String[] args) {
// vereinfachte K2 prüfen
// vereinfachte K3 prüfen (???)
// Die Formel w2 prüfen
// Die Formel w3 prüfen
// Die Formeln w2,3 numerisch prüfen: Ist 2D=3D=0?
// für b=b*
// für b!=b*
// b* g* lambda prüfen: Ist 2D=3D=0
// b* g* [irgendwas] prüfen: ist 2D=0 und 3D!=0?
 
System.out.println("b* = " + roundu(b_star()));
System.out.println("g* = " + roundu(g_star()));
System.out.println("w* = " + roundu(w_star()));
System.out.println("w23(b*, g*) = " + roundu(w23(b_star(), g_star())));
System.out.println("w3(b*, g*) = " + roundu(w3(b_star(), g_star())));
System.out.println("K2(.5 .5 .5) = " + roundu(K2(0.5, 0.5, 0.5)));
System.out.println("K3(.5 .5 .5) = " + roundu(K3(0.5, 0.5, 0.5)));
System.out.println("K2(0 .5 .375) = " + roundu(K2(0.0, 0.5, 0.375)));
System.out.println("K3(0 .5 .375) = " + roundu(K3(0.0, 0.5, 0.375)));
System.out.println("K2(b*, g*, 0.0) = "
+ roundu(K2(b_star(), g_star(), 0.0)));
System.out.println("K2(b*, g*, 0.1) = "
+ roundu(K2(b_star(), g_star(), 0.1)));
System.out.println("K2(b*, g*, 0.3) = "
+ roundu(K2(b_star(), g_star(), 0.3)));
System.out.println("K2(b*, g*, 0.5) = "
+ roundu(K2(b_star(), g_star(), 0.5)));
System.out.println("K2(b*, g*, 0.7) = "
+ roundu(K2(b_star(), g_star(), 0.7)));
System.out.println("K2(b*, g*, 0.99) = "
+ roundu(K2(b_star(), g_star(), 0.99)));
System.out.println("K2(b*, g*, w*) = "
+ roundu(K2(b_star(), g_star(), w_star())));
System.out.println("K3(b*, g*, w*) = "
+ roundu(K3(b_star(), g_star(), w_star())));
 
// w23test(0.2, 0.7);
w23test(b_star(), g_star());
}
 
protected static void w23test(double b, double g) {
double w = w23(b, g);
System.out.println("w23(" + b + " " + g + ") = " + roundu(w));
System.out.println("K2(" + b + " " + g + " " + w + ") = "
+ roundu(K2(b, g, w)));
System.out.println("K3(" + b + " " + g + " " + w + ") = "
+ roundu(K3(b, g, w)));
}
 
}
/ViaThinkSoft Distributed/test/de/viathinksoft/marschall/raumplan/formula/FormulaProbeTest.java
File deleted
Property changes:
Deleted: svn:mime-type
-text/plain
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/Gen2Test.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/Immortable.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/math/MathUtils2.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/math/MathUtils2Test.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/math/DivisionAndRemainderResult.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/math/CoPrimeExpectedException.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/math/CRTNotSolveableException.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/math/CRTException.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/math/ExtEuclResult.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/math/MathUtils.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/math/RemainderNotSmallerThanModulusException.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/ImmortableWriter.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/ImmortableTest.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/erkenntnisse
0,0 → 1,32
Erkenntnis #1 - Der Zusammenhang zwischen M5 und M6
 
M5(u) + M6(u) = 1 + 10^u
 
M5(u) = 1 + 10^u - M6(u)
M6(u) = 1 + 10^u - M5(u)
 
z.B.
 
M6 = 0081787109376
M5 = 9918212890625
^^^^^^^^^^^^
999999999999
 
Erkenntnis #2 - Speicherung
 
Aufgrund von Erkenntnis #1:
=> Man muss nur noch M5 oder M6 größtmöglich berechnen und
kann dann auf das jeweils Andere schließen.
=> Man benötigt kein BigInteger, um von M5 auf M6 zu wechseln.
Es reicht, wenn man alle Komplemente der Ziffern (mit
Ausnahme der letzten Ziffer "5" bzw "6"!) bildet und
aneinander reiht!
 
Desweiteren
- Man sollte die Zahlen umdrehen, sodass eine Datei mit
der aktuellen größtmöglichen Suche immer nur Appended
werden muss.
- Man sollte immer wieder Backups machen, um zu prüfen
ob der Algorithmus nicht an irgendeiner Stelle einen
Fehler gemacht hat (danach prüfen, ob alle Dateien den
selben Anfang haben)
/ViaThinkSoft Distributed/bin/de/viathinksoft/immortable/gen2/InvalidLengthException.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/test/pirnd/TestRndPi.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/test/pirnd/PiDigits.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/test/pirnd/TranszedentRnd.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/test/pirnd/EDigits.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/ViaThinkSoft Distributed/bin/de/viathinksoft/test/pirnd/DigitIterator.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property