Skip to content

A simple Java program which enables visualization of fractals generated using Newton's method

License

Notifications You must be signed in to change notification settings

gustavohb/newton-fractals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Newton Fractal Explorer

This is Java code for an application which enables visualization of fractals generated using Newton's method. It only supports simple polynomials with maximum degree of 9 with real coefficients.

About

Newton fractals are a visual representation of a process called the Newton's method used to find the roots (or zeroes) of a function, f(z_n). This method starts with a guess z0 and then iterates the following expression until the values either converge or fail to converge:

equation

where zn is n-th guess root point, f(z_n) is function value at zn, f'(z_n) is function's derivative value at zn. You use this expression like this: first you guess a possible root and define it as z0, then you use this expression and obtain z1, now you can check precision of guessed root dz=|z_1-z_0|, if dz satisfies you then you can claim that z1 is root with precision dz. Note that you can iterate as long as you want, the more iterations the more precise root you get. However, for every polynomial of degree at least 2 there are points for which the Newton's method does not converge to any root.

The approximate value z0 chosen at the beginning of the process, determines to which root you will eventually converge.

This method works with complex numbers, which naturally lend themselves to 2D images. A complex number z=x+yi can be represented as a point on a 2D plane with coordinates x and y, or alternatively as a pair (x,y).

If we assign each root a color, and we color each point on the complex plane based on the root to which that point converges, a Newton fractal is the result.

In this program, the number of iterations Newton's method takes to converge determines the brightness of a pixel at a particular point (the brighter pixel the faster it reaches root). Therefore the brightest pixels are root regions.

For more information on Newton fractal check Newton fractal @ Wikipedia.

Screenshots

The following images were generated by this program:

screenshot

screenshot

screenshot

screenshot

License

See the LICENSE file for license rights and limitations (MIT).

About

A simple Java program which enables visualization of fractals generated using Newton's method

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages