Logo by teamfresh - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit us on facebook
 
*
Welcome, Guest. Please login or register. April 20, 2024, 07:04:59 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Fractal in "Collatz iteration"  (Read 6518 times)
0 Members and 1 Guest are viewing this topic.
Khaotik
Forums Freshman
**
Posts: 15



« on: October 30, 2011, 06:41:13 AM »

I found some fractal-ish pattern in Collatz-like iterations. I think it may be to do with cellular automaton, but I'm not sure.

Collatz Conjecture says that given an integer, if it's even, you divide it by 2, otherwise you multiply it by 3 and plus 1. Repeat the process and you'll eventually get into "4-2-1-4-..." loop.

I converted the Collatz iteration rule into the following form:
Code:
input integer M

if( exists integer n that M == 2n)
M <- n

else //exists integer n that M == 2n+1
n <- (M-1)/2
M <- 3n+2 //equalivant to M <- 3M+1 then M <- M/2


And here's how I draw the pattern:

1.   Begin with a row of integers ( 1, 2, 3 ... n );
2.   Apply the iteration rule to the whole row;
3.   Repeat the iteration and record the result of each step;
4.   Draw every row with black and white, EVEN NUMs-> White, ODD
NUMs -> Black.
5.   Replace "3n+2" with other formulas to get various patterns.

Here's my Mathematica program to implement the above process.
Code:
(*---------------CELL BEGIN---------------*)

BiIter[nInput_, ExprE_, ExprO_, Var_] :=
 Module[
  {in = nInput},
  If[
   Mod[in, 2] == 0,
   (
    in = in/2;
    in = ExprE /. Var -> in
    ),
   (
    in = (in - 1)/2;
    in = ExprO /. Var -> in
    )
   ];
  in
  ];

CollatzPlot[ExprE_, ExprO_, var_, nMaxNum_, nMaxStep_] := Graphics[
  Raster[Transpose[Table[
     Mod[
      NestList[BiIter[#, ExprE, ExprO, var] &, i, nMaxStep],
      2
      ],
     {i, 0, nMaxNum}
     ]]],
  ImagePadding -> None,
  ImageMargins -> None,
  ImageSize -> 512,
  PlotRangePadding -> None
  ]

(*---------------CELL END---------------*)


(*---------------CELL BEGIN---------------*)

g = CollatzPlot[n, 3 n + 2, n, 512, 128];

Export["G3np2.jpg", g];

Show[g]

(*---------------CELL END---------------*)

I drew some images and I put them in the RAR attachment.
Any idea?

* CIters.rar (249.94 KB - downloaded 247 times.)
Logged

The problem is the problem itself
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
"19th Hole Terraces" fractal zoom in HD (XviD and H.264) Movies Showcase (Rate My Movie) ericbigas 4 8205 Last post January 05, 2007, 04:19:43 AM
by Zoom
The cover image from "The Science of Fractal images" Images Showcase (Rate My Fractal) Duncan C 2 4032 Last post January 22, 2009, 07:20:26 PM
by HPDZ
Free Fractal Music Album "Fractalus" Fractal Music Saquedon 1 3284 Last post December 31, 2009, 11:58:24 PM
by Nahee_Enterprises
New book: "Alt.Fractals: A visual guide to fractal geometry and design" Commercial Corner ErkDemon 4 7958 Last post September 26, 2014, 02:57:18 PM
by LMarkoya
Special "offset" and "rotate" options from Fractallab possible in M3d-formula? Mandelbulb 3d « 1 2 » SaMMy 18 29975 Last post April 05, 2011, 12:20:52 PM
by DarkBeam

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.185 seconds with 24 queries. (Pretty URLs adds 0.012s, 2q)