The post lab 7 assignment involves creating a fractal by performing calculations with complex numbers. So, for this sub-post-lab assignment you will implement a complex number class. The file Complex.java contains a class that represents a complex number. It has instance data, a constructor, and a toString method.
The Complex class has a method
called quadPolyBound
. This method computes the
number of iterations of the quadratic polynomial function that can
be completed with this complex number before its absolute
value exceeds the specified bound. The quadratic polynomial
function sometimes does not have any bound. In order to prevent
infinite recursion or loops, the method should stop testing if the
number of iterations exceeds the specified maximum.
The quadratic polynomial function can be defined recursively as:
cn = cn-12 + c0
Where c0 is the complex number this and
cn is the nth complex number computed by the
quadratic polynomial function. In order to complete
the quadPolyBound
method you will need to add,
multiply, and take the absolute value of complex numbers. Two
complex numbers are added using the equation:
(a + bi) + (c + di) = (a + c) + (b + d)i
Two complex numbers are multiplied using the equation:
(a + bi)(c + di) = (ac - bd) + (bc + ad)i
The absolute value of a complex number is computed using:
|a + bi| = √(a2+b2)
Submission: Submit your code as a zip file with your name as the zip file name on the course Inquire site.