# Processing - Fractal generation not fitting in expected range

Page 1 of 1

## 2 Replies - 7772 Views - Last Post: 12 January 2013 - 06:50 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=306833&amp;s=ab881999cbd2f81434191b2ad98c3457&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 ballaw

Reputation: 0
• Posts: 1
• Joined: 11-January 13

# Processing - Fractal generation not fitting in expected range

Posted 11 January 2013 - 10:30 PM

Here's a problem description for generating a fractal. I'm doing it in Processing:

The program will use the position of the mouse to set the value of a complex number of the form v = (a + bi). The program will then draw a large collection of points (or small circles) that are positioned at the locations given by sums of powers of this value v. In particular, you can calculate truncated sums of an infinite series of powers of v:

1.0 -- 0 ± v -- 0 ± v ± v^2 -- etc. ...

The first term of this series represents the position (0,0), which should appear as a point in the center of the screen. The next term of the series is 0 ± v0, which is the same as the two positions (1,0) and (-1,0). The next term gives four possible values, and you should draw a separate point for each of these values. The next term gives eight points, then 16, 32, 64, and so on. The program should calculate at least the first 10 terms of this series, and plot points for each of these, which corresponds to drawing at least 1023 points.

Calculate powers of v using the standard rules for multiplying complex numbers. For example v^2 = (a + bi) * (a + bi) = (a^2– b^2) + 2abi, where i = sqrt(-1).

The problem is with the sum of complex numbers. If v is larger than 1, which it can be since the range is -3 to 3. The usual behavior is for the numbers to blow up quickly, often reaching infinity. But the problem shows example fractals fitting within the range.

If anyone has any insight into this problem and what I'm conceptually getting wrong it would be of great help. Thanks!

Is This A Good Question/Topic? 0

## Replies To: Processing - Fractal generation not fitting in expected range

### #2 macosxnerd101

• Games, Graphs, and Auctions

Reputation: 11334
• Posts: 42,748
• Joined: 27-December 08

## Re: Processing - Fractal generation not fitting in expected range

Posted 11 January 2013 - 10:38 PM

I'm not overly familiar with fractals, but I found a good article explaining it.

Also, I'm going to move this to Other Languages, as Processing != Java.

### #3 sepp2k

• D.I.C Lover

Reputation: 2270
• Posts: 3,483
• Joined: 21-June 11

## Re: Processing - Fractal generation not fitting in expected range

Posted 12 January 2013 - 06:50 AM

ballaw, on 12 January 2013 - 06:30 AM, said:

In particular, you can calculate truncated sums of an infinite series of powers of v:

1.0 -- 0 ± v -- 0 ± v ± v^2 -- etc. ...

[...] The program should calculate at least the first 10 terms of this series
[...]
If v is larger than 1, which it can be since the range is -3 to 3. The usual behavior is for the numbers to blow up quickly, often reaching infinity.

Are you sure? If I calculate the sum of the first 10 powers of 3+3i, I get 436053 + 2180271i. So that should be the largest number you get in that range. If you get infinity, there must be a mistake in your calculations.

This post has been edited by sepp2k: 12 January 2013 - 11:59 AM