hey hi simply click the box above to copy paste my code. It will have line breaks once pasted, html just doesnt like them
import java.lang.Math;
import java.util.ArrayList;
/*
DISCLAIMER:
if you know anything about java style guides and are reading this code please
know much of it was written while i had a fever. yes i know its messy, i also know it works.
*/
public class gausCalcs{
public final class gausInt{
final int Re;
final int Im;
public gausInt(int a, int b) {
this.Re = a;
this.Im = b;
}
public gausInt(gausInt alpha){
this.Re = alpha.Re;
this.Im = alpha.Im;
}
public String toString(){
String s = "" + this.Re + "+" + this.Im + "i";
return s;
}
public int Norm(){
int norm = (int) ( Math.pow(this.Re,2) + Math.pow(this.Im,2) );
return norm;
}
public gausInt conjugate() {
gausInt conj = new gausInt(this.Re, (-this.Im));
return conj;
}
public gausInt minus(gausInt beta){
gausInt alpha = new gausInt(this.Re - beta.Re, this.Im - beta.Im);
return alpha;
}
public gausInt mult(gausInt beta){
int Re = (this.Re*beta.Re) - (this.Im * beta.Im);
int Im = (this.Re * beta.Im) + (this.Im * beta.Re);
return new gausInt(Re, Im);
}
public boolean inCircle(int r){
if(this.Norm() <= (r * r) ){
return true;
} else{
return false;
}
}
}
//can use object to make gaus ints hopefully in static context
public gausInt gausInt(int a, int b){
gausInt alpha = new gausInt(a,b);
return alpha;
}
public int gcdInCirclesCalc(int r, gausInt gamma){
int count = 0;
for(int a=1; a < r; a++){
for(int b=1; b < r; b++){
for(int c=1; c < r; c++){
for(int d=1; d < r; d++){
gausInt alpha = new gausInt(a,b);
gausInt beta = new gausInt(c,d);
if(alpha.inCircle(r) && beta.inCircle(r)){
gausInt psi = euclidAlgo(alpha, beta);
if( (psi.Re == gamma.Re) && (psi.Im == gamma.Im) ){
count ++;
} else {
continue;
}
}
}
}
}
}
return count;
}
public double gausVisProportion(int bound){
double top = 0;
double bottom = 0;
for(int a=1; a