My Math Forum  

Go Back   My Math Forum > Science Forums > Computer Science

Computer Science Computer Science Forum


Reply
 
LinkBack Thread Tools Display Modes
February 2nd, 2012, 08:32 PM   #1
Newbie
 
Joined: Feb 2012

Posts: 3
Thanks: 0

Fractal Program

Not sure if this belongs here or in the mathematics in art and fractals section, but I am trying to make a "fractal" program. Here is my code– I used a generic language so it is easy-ish to read. I'm getting incorrect results for many numbers.

Code:
set X to ORIGINALVALUE (for example, 1+i)

set bounded to true
set n to 1

repeat 6 times

set X to (X2 + X) (This is just the mandlebrot equation)

If (absolute value of x is greater than 4) then set bounded to false

end repeat
Anyone know why it might not be working? I figure putting the original value through the mandlebrot equation six times is enough, and the 4 is got is from Wikipedia, which (i think) says the Mandlebrot set declares anything which reaches a value greater than 4 is "unbounded".

Thanks!
boy129349 is offline  
 
February 2nd, 2012, 08:55 PM   #2
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: Fractal Program

Does your language handle complex numbers properly? Is six iterations enough? Are you actually squaring, or are you doing something else? (Languages differ on how to represent exponentiation, so if you were in C for example you might write x^2 thinking it would square x where in fact that would take the bitwise XOR of x and 2.) Is the display not working properly, rather than the calculation?
CRGreathouse is offline  
February 4th, 2012, 06:49 PM   #3
Newbie
 
Joined: Feb 2012

Posts: 3
Thanks: 0

Re: Fractal Program

I'll answer the easy questions first. I'm programming on a TI-83 plus calculator. I am certain I am actually squaring the equation. (I actually had a mistake with the mandlebrot equation, but I fixed it now) The TI language mostly handles complex numbers properly– I'm not too worried about it. The code is pretty complex for the displaying aspect, so I wasn't sure– until I ran the function in its entirety. The strange blob that appears is clearly nothing like the Mandlebrot set, so it isn't a rotation, slide, or stretch of anything. That leaves
Quote:
Originally Posted by CRGreathouse
Is six iterations enough?
I guess I'll try it with more iterations. With just six, it took an hour and a half or so. With like 10 iterations, it'll probably take about 3 hours. Yikes. I hope I have enough batteries in the calculator. Thanks for all the help, I'll let you know if it works. If it doesn't, I think either I misinterpreted the numbers I got from Wikipedia or the TI calculators really do not handle complex numbers well.
boy129349 is offline  
February 6th, 2012, 06:13 AM   #4
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: Fractal Program

Quote:
Originally Posted by boy129349
I guess I'll try it with more iterations. With just six, it took an hour and a half or so. With like 10 iterations, it'll probably take about 3 hours. Yikes. I hope I have enough batteries in the calculator. Thanks for all the help, I'll let you know if it works. If it doesn't, I think either I misinterpreted the numbers I got from Wikipedia or the TI calculators really do not handle complex numbers well.
Try graphing only a small part of the set and see what you get. That's probably the best way to debug the program.
CRGreathouse is offline  
Reply

  My Math Forum > Science Forums > Computer Science

Tags
fractal, program



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fractal Binary ashesmi New Users 3 January 5th, 2013 08:31 AM
Fractal Programming boy129349 Art 1 February 22nd, 2012 07:21 AM
Fractal Spirograph (Fractal Roulette) benice Art 3 February 1st, 2012 11:22 AM
Fractal mathematics adriaani Abstract Algebra 2 July 21st, 2009 02:01 AM
Fractal Binary ashesmi Number Theory 0 December 31st, 1969 04:00 PM





Copyright © 2019 My Math Forum. All rights reserved.