use of org.nfunk.jep.type.Complex in project JWildfire by thargor6.
the class KleinGroupFunc method calcMaskitLeysModifiedGenerators.
/**
* based on modified Maskit parameterization discussed in Jos Leys' article
* "A fast algorithm for limit sets of Kleinian groups with the Maskit parametrisation",
* section 4.1
* replaces b(z) = z + 2
* with b(z) = z + k
* where k = 2*cos(PI/n) and n is integer
* here we also allow imaginary component for k, to be set by b_im
*/
public Complex[][] calcMaskitLeysModifiedGenerators() {
Complex mu = new Complex(a_re, a_im);
Complex[] mat_a = new Complex[] { mu.mul(-1).mul(im1), im1.mul(-1), im1.mul(-1), zero };
Complex b1 = new Complex(2 * cos(M_PI / b_re), b_im);
Complex[] mat_b = new Complex[] { re1, b1, zero, re1 };
Complex[][] generators = new Complex[2][4];
generators[0] = mat_a;
generators[1] = mat_b;
return generators;
}
use of org.nfunk.jep.type.Complex in project JWildfire by thargor6.
the class KleinGroupFunc method calcGrandmaGenerators.
/**
* using "Grandma's special parabolic commutator groups" recipe
* from the book "Indra's Pearls: the Vision of Felix Klein"
*/
public Complex[][] calcGrandmaGenerators() {
Complex traceA = new Complex(a_re, a_im);
Complex traceB = new Complex(b_re, b_im);
// solve for traceAB:
// traceAB^2 - (traceA * traceB * traceAB) + traceA^2 + traceB^2 = 0
// x = (-b +- sqrt(b^2 - 4ac)) / 2a
// x = traceAB
// a = 1
// b = -1 * traceA * traceB
// c = traceA^2 + traceB^2
Complex b = traceA.mul(traceB).mul(-1);
Complex c = traceA.power(2).add(traceB.power(2));
// Complex bsq = traceA.mul(traceB).power(2);
Complex bsq = b.power(2);
Complex ac4 = c.mul(4);
Complex trABplus = b.mul(-1).add(bsq.sub(ac4).sqrt()).div(re2);
Complex trABminus = b.mul(-1).sub(bsq.sub(ac4).sqrt()).div(re2);
Complex traceAB = trABminus;
// z0 = ((traceAB - 2) * traceB) / ((traceB * traceAB) - (2 * traceA) + (2i * traceAB))
// z0 = traceAB.sub(2).mult(traceB).div(traceB.mult(traceAB).sub(traceA.mult(2)).add(traceAB.mult(Complex.I).mult(2)) )
Complex znum = traceAB.sub(re2).mul(traceB);
Complex zdenom = traceB.mul(traceAB).sub(traceA.mul(re2)).add(traceAB.mul(im2));
Complex z0 = znum.div(zdenom);
Complex a0 = traceA.div(re2);
Complex a1num = traceA.mul(traceAB).sub(traceB.mul(re2)).add(im4);
Complex a1denom = traceAB.mul(re2).add(re4).mul(z0);
Complex a1 = a1num.div(a1denom);
Complex a2num = traceA.mul(traceAB).sub(traceB.mul(re2)).sub(im4).mul(z0);
Complex a2denom = traceAB.mul(re2).sub(re4);
Complex a2 = a2num.div(a2denom);
Complex a3 = traceA.div(re2);
Complex b0 = traceB.sub(im2).div(re2);
Complex b1 = traceB.div(re2);
Complex b2 = traceB.div(re2);
Complex b3 = traceB.add(im2).div(re2);
mat_a = new Complex[] { a0, a1, a2, a3 };
mat_b = new Complex[] { b0, b1, b2, b3 };
Complex[][] generators = new Complex[2][4];
generators[0] = mat_a;
generators[1] = mat_b;
return generators;
}
use of org.nfunk.jep.type.Complex in project JWildfire by thargor6.
the class KleinGroupFunc method calcModifiedMaskitGenerators.
public Complex[][] calcModifiedMaskitGenerators() {
Complex mu = new Complex(a_re, a_im);
// modifying Maskit to utilize b_re and b_im
Complex b1 = new Complex(b_re, b_im);
Complex[] mat_a = new Complex[] { mu.mul(-1).mul(im1), im1.mul(-1), im1.mul(-1), zero };
// Complex[] mat_b = new Complex[]{ re1, re2, zero, re1};
Complex[] mat_b = new Complex[] { re1, b1, zero, re1 };
Complex[][] generators = new Complex[2][4];
generators[0] = mat_a;
generators[1] = mat_b;
return generators;
}
use of org.nfunk.jep.type.Complex in project JWildfire by thargor6.
the class KleinGroupFunc method calcJorgensenGenerators.
public Complex[][] calcJorgensenGenerators() {
Complex traceA = new Complex(a_re, a_im);
Complex traceB = new Complex(b_re, b_im);
// solve for traceAB:
// traceAB^2 - (traceA * traceB * traceAB) + traceA^2 + traceB^2 = 0
// x = (-b +- sqrt(b^2 - 4ac)) / 2a
// x = traceAB
// a = 1
// b = -1 * traceA * traceB
// c = traceA^2 + traceB^2
Complex b = traceA.mul(traceB).mul(-1);
Complex c = traceA.power(2).add(traceB.power(2));
Complex bsq = b.power(2);
Complex ac4 = c.mul(4);
Complex trABplus = b.mul(-1).add(bsq.sub(ac4).sqrt()).div(re2);
Complex trABminus = b.mul(-1).sub(bsq.sub(ac4).sqrt()).div(re2);
Complex traceAB = trABminus;
// a0 = ta - (tb/tab)
Complex a0 = traceA.sub(traceB.div(traceAB));
// a1 = ta / tab^2
Complex a1 = traceA.div(traceAB.power(2));
Complex a2 = traceA;
Complex a3 = traceB.div(traceAB);
// b0 = tb - (ta/tab)
Complex b0 = traceB.sub(traceA.div(traceAB));
// b1 = -tb/tab^2
Complex b1 = traceB.mul(-1).div(traceAB.power(2));
Complex b2 = traceB.mul(-1);
Complex b3 = traceA.div(traceAB);
mat_a = new Complex[] { a0, a1, a2, a3 };
mat_b = new Complex[] { b0, b1, b2, b3 };
Complex[][] generators = new Complex[2][4];
generators[0] = mat_a;
generators[1] = mat_b;
return generators;
}
use of org.nfunk.jep.type.Complex in project JWildfire by thargor6.
the class KleinGroupFunc method calcModifiedRileyGenerators.
public Complex[][] calcModifiedRileyGenerators() {
Complex c = new Complex(a_re, a_im);
// modifying Riley to utilize b_re and b_im
Complex b1 = new Complex(b_re, b_im);
Complex[] mat_a = new Complex[] { re1, zero, c, re1 };
// Complex[] mat_b = new Complex[]{ re1, re2, zero, re1 };
Complex[] mat_b = new Complex[] { re1, b1, zero, re1 };
Complex[][] generators = new Complex[2][4];
generators[0] = mat_a;
generators[1] = mat_b;
return generators;
}