From the course: Python: Programming Efficiently

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Time profiling

Time profiling - Python Tutorial

From the course: Python: Programming Efficiently

Start my 1-month free trial

Time profiling

- [Instructor] Let us experiment with time profiling by computing the Mandelbrot set, perhaps the most famous fractal in popular culture. Let me explain first how the set turns a mathematical equation into a striking picture. Complex numbers can be identified with points in the plane. The real part is the x-coordinate and the imaginary part is the y-coordinate. These numbers come with special rules for addition and multiplication. The Mandelbrot set is actually the black area in the blot, which consists of all the complex numbers, C, such that if we keep iterating the computation, Z equals Z squared plus C, the resulting X never escapes to infinity. If X does run away, we color the corresponding point using a number of iterations that it took to escape. To determine that, we use a simple rule. If Z gets a distance larger than two from the origin, it's guaranteed to escape, so that's what we'll check for. Since our…

Contents