|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectbigOpera.BigOpera
public class BigOpera
List numbers by counting the number of ones needed to construct those numbers
using the bigO(int, int, int) method and positive integers.
| Field Summary | |
|---|---|
private int[] |
abLimits
Default limits to decide when to reduce the operator number c for good. |
private int[] |
B_MAX
Array with absolute maximum values b for each c. |
(package private) int |
cMax
Maximum operator number. |
(package private) int[][] |
data
Simple integer array to store the result data. |
(package private) double |
obitDeviationTotal
Sum of deviations of the Obit length from the mean of Obit lengths. |
static java.lang.String[] |
OPERATORS
Array of supported operators as Strings. |
(package private) boolean |
PREFER_LOWER_C
Prefer to record and display those equations that have the lowest c when fingers are equal. |
int |
PRINT_MULTI_STATS
Print the totals and gains every 1000th multiple of PRINT_MULTI_STATS inbetween. |
boolean |
PRINT_OBITS
Print a second line with the experimental mathematical "Obit" representation of a number. |
java.lang.String |
serialPath
File path to serialize this BigOpera object. |
(package private) static long |
serialVersionUID
The ID 7625597484987L for serialization of this class. |
private java.io.BufferedWriter |
textWriter
Writer for storing the console data directly in a user specified file. |
(package private) long[] |
totals
Cummulative totals for Vingers values V and bigO stack values W. |
(package private) int |
Y_MAX
An absolute maximum set to the results of bigO that can be recorded. |
private int[] |
yNextVn
Array to keep track of cummulative Vingers "number of ones" data in the list. |
private int[] |
yNextWn
Array to keep track of cummulative bigO stack data in the list. |
| Constructor Summary | |
|---|---|
BigOpera()
Default constructor. |
|
| Method Summary | |
|---|---|
static int |
bigO(int a,
int b,
int c)
Calculate bigO(a,b,c) for integer types. |
void |
buildNumbers(int yEnd)
Start building numbers from where you've ended last time. |
static void |
main(java.lang.String[] args)
Console method to use this class. |
java.lang.String |
OBitExpression(int n)
Get a bigO mathematical bit expression (or "Obit") for a number. |
private void |
print(java.lang.String line)
Print some text to the console. |
void |
printData(int y)
Print data for the next number constructions with the bigO equation. |
void |
printFooter(int y)
Create and print the footer with the totals and statistical percentages. |
void |
printHeader()
Create and print the header for the results of bigO equations. |
(package private) void |
setData(int a,
int b,
int c,
int y)
Check if a candidate solution for bigO can be stored in the data array. |
(package private) int |
setModel(int yEnd)
Set up the data model to store and display new results. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public java.lang.String serialPath
null if serialization is unwanted. Default is "BigOpera.bin"
public int PRINT_MULTI_STATS
PRINT_MULTI_STATS inbetween. endY is not a multiple.
public boolean PRINT_OBITS
12 = 11111111111115 = O(3,5,1) = 011101111101123 = O(3,O(4,5,1)) = 011100111101111101101226 = 01000111011111011011011101
boolean PREFER_LOWER_C
false the order of creation prevails, which favors higher c.
The default also minimizes the construction stack counts, eg. 16 9 8 8 2^^3 7 5 4
public static java.lang.String[] OPERATORS
{ +, *, ^, ^^ }c as index.
int Y_MAX
Integer.MAX_VALUE number of integers takes 2^31*4bytes = 8GbY_MAX = 2097152 => Y_MAX*data.length = 8Mb*6 = 48MbendY==1000000 contains hundreds of megabytes!
int cMax
a+b where a>1.a+b<11 this cMax = 3 or ^^
because 2^^4 = 2^16 = 65536 = 2^^^3 (same Vingers value too)
and 9^^2 = 9^9 = 387420489 and 10^10 > Integer.MAX_VALUEa+b<33 this is 2 because 2^31 = Integer.MAX_VALUE+1
private int[] B_MAX
b for each c.B_MAX = { 524286, 262143, 18, 4 }
private int[] abLimits
yEnd later.ab in the construction loop gets bigger put cMax--abLimits[2] for ^ powers is the maximal root plus 2.
static final long serialVersionUID
7625597484987L for serialization of this class.
private java.io.BufferedWriter textWriter
BufferedWriter is not constructed to append text.
main(java.lang.String[]),
print(java.lang.String)int[][] data
V1 for +*
is the number of ones needed to create a number with + and *V2 for +*^
is the number of ones needed to create a number with c={0,1,2}Vn for +*^..
is the number of ones needed to create a number with c>=0a first operant in last equation with least Vb second operant in last equation with least Vc operator number of last equation with least VW1
passed in its +* construction stack.W2
passed in its +*^ construction stack.Wn
passed in its widest +*^.. construction stack.setModel(int).
long[] totals
V and bigO stack values W.
From these the percentage gain from allowing a wider operator can be calculated.totals is indexed as follows:
V1 for +*V2 for +*^Vn for +*^..W1 for +*W2 for +*^Wn for +*^..
double obitDeviationTotal
printData(int)
to display Obit trends at each call to printFooter(int).
private int[] yNextVn
V value thus far.
Set to highlight "~" the start of higher V at number y in printData(int).
private int[] yNextWn
W value thus far.
Set to highlight "~" the start of higher W at number y in printData(int).
| Constructor Detail |
|---|
public BigOpera()
| Method Detail |
|---|
int setModel(int yEnd)
data to accomodate more numbers.
yEnd - the last result as to be calculated by buildNumbers(int).
index if the model was set up and can be expanded by new data-1 if all data upto yEnd has already been collected
java.lang.IllegalArgumentException - if yEnd > Y_MAXpublic void buildNumbers(int yEnd)
yEnd - the result y = bigO(a,b,c) upto where to build number space
void setData(int a,
int b,
int c,
int y)
data array. setData() stores it for all operants >= c
a - first bigO operantb - second bigO operantc - bigO operator numbery - the result y = bigO(a,b,c)
public static int bigO(int a,
int b,
int c)
bigO(a,b,c) for integer types.
c=0 addition a+bc=1 multiplication a*bc=2 power a^bc=3 doublepower a^^bc=4 triplepower a^^^bc=-1 division b/ac=-2 logarithm log(b)/log(a)
a - first numberb - second numberc - operator number
int number,Integer.MAX_VALUE = 2^31-1 = 2147483647 if the result is too big
or Integer.MIN_VALUE = -2^31 = -2147483648 if the result is too small
java.lang.ArithmeticException - if the calculation is impossible or unsupported
or if the result is not exactly integer^... operations never throw this exception for positive bpublic void printHeader()
public void printData(int y)
y - the data for number y that has to printed next
java.lang.IllegalStateException - if data is missingpublic void printFooter(int y)
y - can be the yEnd or some inbetween statistics requestprivate void print(java.lang.String line)
line - one or two lines of textpublic java.lang.String OBitExpression(int n)
"5 = 11111",
but larger numbers have a more succint mathematical expression starting with the prefix
"0" to distinguish a matBit number that's created with bigO.c is expressed as:
1=+ 11=* 111=^ 1111=^^ 11111=^^^"0" means a nesting of bigO inside itself, as in
30 = 3+3^3 = 011100111011101110130 = 11110
n - any natural number n >= 0
java.lang.IllegalArgumentException - if n > MIN_ONES and no data is available for it
(MIN_ONES = 26)public static void main(java.lang.String[] args)
args - the 1st argument should be an end number yEnd,java bigOpera/BigOpera 10000 "operadata.txt"
java.lang.SecurityException - if the security manager doesn't allow files to be read
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||