// by Tim Ratigan // plots magnitude of EGF for bitstrings not containing the pattern // 0101010101 public class Bitstring2 implements ComplexFunction { public Complex pow(Complex z, int n) { // return z^n Complex d = z; for (int i = 0; i < n; i++) { d = d.times(z); } return d; } // \frac{1+z^2+z^4+z^6+z^8}{z^{10}+(1-2z)(1+z^2+z^4+z^6+z^8)} public Complex eval(Complex z) { Complex one = new Complex(1, 0); Complex f = one.plus(pow(z,2)).plus(pow(z,4)).plus(pow(z,6)).plus(pow(z,8)); Complex d = pow(z,10).plus(f.times(one.minus(z).minus(z))); return f.times(d.reciprocal()); } public static void main(String[] args) { Plot2Dez.show(new Bitstring2(), 512); } }