Easily choose number of internal iterations
Desired size and accuracy passed by parameters. Stops on given accuracy or max iterations. Now prints to a file the max error every 1k iterations.