Mandelbrot Set
2015-12-12, post № 89
mathematics, programming, Pygame, Python, #colorful, #complex, #fractal, #f_c(z) = z^2 + c, #imaginary, #iterating, #iteration, #Mandelbrot, #repeating, #self-repeathing, #set
Working with complex numbers and iterating the function , I created this program which lets you explore the depth of this self-repeating fractal. The different colors are caused by different color schemes.
Controls
- Left mouse click and mouse movements control the zoom frame,
- Middle mouse click zooms in,
- ‘Space’ takes a screenshot,
- ‘F1’ moves a zoom back,
- ‘F2’ zooms to default zoom.
Source code: mandelbrot-set.py
Extra assets: mandelbrot-set-000.png, mandelbrot-set-001.png, mandelbrot-set-002.png, mandelbrot-set-003.png, mandelbrot-set-004.png, mandelbrot-set-005.png, mandelbrot-set-006.png, mandelbrot-set-007.png, mandelbrot-set-008.png, mandelbrot-set-009.png, mandelbrot-set-010.png, mandelbrot-set-011.png, mandelbrot-set-012.png, mandelbrot-set-013.png, mandelbrot-set-014.png, mandelbrot-set-015.png, mandelbrot-set-016_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-017_-0.9000000000000004_-0.3250000000000002_-0.6624999999999996_0.0.png, mandelbrot-set-018_-0.17750835905349785_-1.04787792924097_-0.13265217764060344_-1.0179738082990402.png, mandelbrot-set-019_-0.1623148148148149_-1.0489506172839502_-0.15666666666666673_-1.0451851851851848.png, mandelbrot-set-020_-2.1125_-0.07500000000000018_-1.3624999999999998_0.037499999999999645.png, mandelbrot-set-021_-1.4625000000000004_-0.13750000000000018_-1.1875_0.13750000000000018.png, mandelbrot-set-022_-1.2778935185185185_-0.1325347222222224_-1.2580324074074074_-0.11420138888888903.png, mandelbrot-set-023_-1.2674664351851852_-0.12945370370370388_-1.2657193930041153_-0.12746759259259277.png, mandelbrot-set-024_-1.2665120325121932_-0.12813238811728414_-1.2664764446159122_-0.12806066743827177.png, mandelbrot-set-025_0.21250000000000036_-0.0625_0.3250000000000002_0.07500000000000018.png, mandelbrot-set-026_0.31552083333333353_-0.03347222222222218_0.31989583333333355_-0.028124999999999956.png, mandelbrot-set-027_0.3176556712962965_-0.029914834104938226_0.31793113425925945_-0.029446952160493783.png, mandelbrot-set-028_0.3177196909293555_-0.0298888406635802_0.317729383144719_-0.029871295090663535.png, mandelbrot-set-029_0.3177244293457554_-0.029877972155912376_0.3177249678021645_-0.029876997401861453.png, mandelbrot-set-030_-0.875_-0.2787499999999999_-0.8565393518518518_-0.2501388888888889.png, mandelbrot-set-031_-0.8627441808127572_-0.27465702160493816_-0.8624877829218107_-0.27410069444444435.png, mandelbrot-set-032_-0.5959051568930038_-0.6670972222222222_-0.594300518689986_-0.6661238425925926.png, mandelbrot-set-033_-0.5949156300011429_-0.6667173337834362_-0.5948220261059668_-0.6666483860596708.png, mandelbrot-set-034_-1.2087962962962966_-0.31737847222222204_-1.2048611111111114_-0.3150868055555554.png, mandelbrot-set-035_-0.23553240740740772_-1.1306712962962964_-0.1974074074074077_-1.1052546296296297.png, mandelbrot-set-036_-0.7374999999999998_-0.4833333333333325_-0.5999999999999996_-0.3916666666666675.png, mandelbrot-set-037_-1.811238425925926_-0.025748456790123386_-1.7136921296296297_0.039282407407407405.png, mandelbrot-set-038_-1.7496397462277093_0.0114335419524463_-1.747110768175583_0.013119527320530434.png, mandelbrot-set-039_-1.7475790974444954_0.012183649331487436_-1.7475205562858813_0.012222676770563459.png, mandelbrot-set-040_-1.7475450568448567_0.012195249153657254_-1.7475432680872325_0.012196441658740132.png, mandelbrot-set-041_-0.8875000000000002_-0.24583333333333268_-0.6375000000000002_-0.0791666666666675.png, mandelbrot-set-042_-0.8349537037037039_-0.2391203703703698_-0.8259259259259261_-0.2331018518518513.png, mandelbrot-set-043_-0.8309831532921812_-0.23689686213991712_-0.8306571502057615_-0.23667952674897064.png, mandelbrot-set-044_-0.8307649123371058_-0.23685822473708218_-0.8307567622599453_-0.23685279135230852.png, mandelbrot-set-045_-0.8307595921478482_-0.23685462511966962_-0.8307592072830935_-0.23685436854316644.png, mandelbrot-set-046_-0.8307595593630728_-0.23685458782104832_-0.8307595436833977_-0.23685457736793153.png, mandelbrot-set-047_-0.8307595506521421_-0.2368545834607436_-0.830759550114968_-0.23685458310262755.png, mandelbrot-set-048_-0.8307595504795501_-0.23685458328201717_-0.8307595504671155_-0.23685458327372744.png, mandelbrot-set-049_0.13750000000000018_-0.6625000000000001_0.47499999999999964_-0.4375.png, mandelbrot-set-050_0.16562500000000013_-0.6057291666666668_0.21406250000000004_-0.5734375.png, mandelbrot-set-051_0.17836226851851864_-0.5850834297839507_0.1850000000000001_-0.580658275462963.png, mandelbrot-set-053_0.18295063454980195_-0.5820707434450626_0.18296051375234984_-0.5820641573100307.png, mandelbrot-set-054_0.18295410141810348_-0.5820700299471008_0.18295434839816718_-0.5820698652937251.png, mandelbrot-set-055_0.18295431501012152_-0.5820699333656993_0.18295432438621653_-0.5820699271149694.png, mandelbrot-set-056_0.18295431738019_-0.5820699301506248_0.18295431929881684_-0.5820699288715403.png, mandelbrot-set-057_-0.2071079471274312_-1.1227563932114668_-0.20710794671447597_-1.1227563929361632.png, mandelbrot-set-058_-0.20710794693361204_-1.12275639309085_-0.20710794693310078_-1.1227563930905091.png, mandelbrot-set-059_-0.625_-0.6708333333333334_-0.5374999999999996_-0.6124999999999998.png, mandelbrot-set-060_-0.6006944444444443_-0.6669984567901235_-0.5735532407407405_-0.6489043209876543.png, mandelbrot-set-061_-0.5830275312928668_-0.6540142389689072_-0.577850597993827_-0.6505629501028806.png, mandelbrot-set-062_-0.5831138135145174_-0.6535572627579426_-0.5822414043844941_-0.6529756566712603.png, mandelbrot-set-063_-0.23416666666666672_-1.122800925925926_-0.21277777777777782_-1.1085416666666665.png, mandelbrot-set-064_-0.21792695473251034_-1.1146744684499315_-0.2171743827160494_-1.1141727537722907.png, mandelbrot-set-065_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-066_-1.4625000000000004_-0.47499999999999964_-1.0125000000000002_-0.17499999999999982.png, mandelbrot-set-067_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-068_-1.4000000000000004_-0.4833333333333325_-1.1124999999999998_-0.29166666666666696.png, mandelbrot-set-069_-1.1990162037037038_-0.33656635802469137_-1.189699074074074_-0.330354938271605.png, mandelbrot-set-070_-1.1944007737482853_-0.3346396676383174_-1.1940988297325104_-0.33443837162780066.png, mandelbrot-set-071_-1.1942604295795334_-0.33453210741730005_-1.194260275552879_-0.334532004732864.png, mandelbrot-set-072_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-073_-1.2612962962962964_-0.3843827160493828_-1.2493055555555557_-0.37638888888888894.png, mandelbrot-set-074_-1.253602237654321_-0.38276914723365346_-1.253258058984911_-0.38253969478738004.png, mandelbrot-set-075_-1.2534158075417239_-0.38273324217493104_-1.253405928339176_-0.38272665603989914.png, mandelbrot-set-076_-1.2534121485778174_-0.38272834831070596_-1.2534118192710657_-0.38272812877287155.png, mandelbrot-set-077_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-078_0.0625_-0.7416666666666663_0.4249999999999998_-0.5.png, mandelbrot-set-079_0.3350462962962961_-0.7129128086419749_0.3699537037037035_-0.6896412037037034.png, mandelbrot-set-080_0.3452599451303153_-0.702548325331504_0.346261917009602_-0.7018803440786462.png, mandelbrot-set-081_0.3456468176059288_-0.7022647425496195_0.3456987717033733_-0.7022301064846564.png, mandelbrot-set-082_0.15000000000000036_-0.08333333333333393_0.3875000000000002_0.07500000000000018.png, mandelbrot-set-083_0.34681712962962985_-0.07886188271604995_0.37694444444444464_-0.058777006172839985.png, mandelbrot-set-084_0.35677588091563806_-0.06580671296296348_0.3623829089506175_-0.062068694272977176.png, mandelbrot-set-085_0.35773634405125954_-0.06341334266284725_0.35796997021938365_-0.06325759188409782.png, mandelbrot-set-086_0.3579024782152589_-0.06335291712923984_0.35791134735682656_-0.06334700436819471.png, mandelbrot-set-087_0.3579067074818398_-0.06335019342681396_0.35790720842409496_-0.06334985946531048.png, mandelbrot-set-088_0.3579068786371103_-0.06335015137240241_0.35790692270147534_-0.06335012199615905.png, mandelbrot-set-089_-2.3125_-1.1458333333333335_1.1624999999999996_1.1708333333333334.png, mandelbrot-set-090_-1.437314814814815_-0.46584876543209874_-1.0061574074074076_-0.1784104938271608.png, mandelbrot-set-091_-1.2616580932784638_-0.3852063614540467_-1.249681498628258_-0.3772219650205762.png, mandelbrot-set-092_-1.2538400384373574_-0.3846481929996698_-1.2533299242207745_-0.38430811685528127.png, mandelbrot-set-093_-1.2536629154454884_-0.3844329688842165_-1.2536227675673313_-0.38440620363211186.png, mandelbrot-set-094_-1.2536334364942119_-0.38442072625964274_-1.2536312432304977_-0.3844192640838333.png, mandelbrot-set-095_-1.2536329166094797_-0.384420102804124_-1.2536325266959305_-0.3844198428617579.png, mandelbrot-set-096_-1.2536328465694533_-0.38441992481580944_-1.25363282165831_-0.38441990820838046.png, mandelbrot-set-097_-1.5625_-0.5541666666666663_-0.5625_0.11249999999999982.png, mandelbrot-set-098_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-099_-1.2374999999999998_-0.5333333333333337_-0.625_-0.125.png, mandelbrot-set-100_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-101_-0.9249999999999998_-1.1791666666666663_0.2999999999999998_-0.3624999999999998.png, mandelbrot-set-102_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-103_-0.7374999999999998_-1.2333333333333334_0.13750000000000018_-0.6499999999999999.png, mandelbrot-set-104_-0.24733796296296273_-1.1315200617283951_-0.19062499999999982_-1.0937114197530864.png, mandelbrot-set-105_-0.2308491941015087_-1.1213152291952446_-0.21945408950617262_-1.1137184927983539.png, mandelbrot-set-106_-0.22284096781645307_-1.117119439138999_-0.22193357985793558_-1.1165145138333206.png, mandelbrot-set-107_-0.22245532793408312_-1.11680661433972_-0.22242676201687056_-1.1167875703949115.png, mandelbrot-set-108_-0.22244107142540018_-1.1167974009497548_-0.22243953732984617_-1.1167963782193855.png, mandelbrot-set-109_-0.22243979869427388_-1.1167969099444803_-0.2224397532395908_-1.116796879641358.png, mandelbrot-set-110_-0.2224397772716501_-1.1167968959573447_-0.2224397745359516_-1.1167968941335458.png, mandelbrot-set-111_-0.2224397760557841_-1.1167968951695648_-0.22243977576701593_-1.1167968949770528.png, mandelbrot-set-112_-0.22243977592450154_-1.116796895081865_-0.22243977589402045_-1.1167968950615441.png, mandelbrot-set-113_-0.2224397759112084_-1.1167968950730875_-0.22243977590714425_-1.116796895070378.png, mandelbrot-set-114_-0.2224397759098085_-1.1167968950720877_-0.22243977590865324_-1.1167968950713176.png, mandelbrot-set-115_-0.22243977590959135_-1.116796895071911_-0.22243977590954536_-1.1167968950718803.png, mandelbrot-set-116_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-117_-2.05_-0.15833333333333321_-1.625_0.125.png, mandelbrot-set-118_-1.7953935185185186_-0.025848765432098714_-1.7816203703703704_-0.016666666666666607.png, mandelbrot-set-119_-1.7886089677640604_-0.021495770461819788_-1.7883666623799725_-0.021334233539094596.png, mandelbrot-set-120_-1.7885039126750797_-0.02143164907003356_-1.7885035979522943_-0.021431439254843292.png, mandelbrot-set-121_-1.788503754148047_-0.021431539791288628_-1.7885037427830577_-0.02143153221462898.png, mandelbrot-set-122_-1.7885037494652505_-0.0214315374270902_-1.78850374912851_-0.021431537202596582.png, mandelbrot-set-123_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-125_0.3237500000000002_-0.03939814814814801_0.32805555555555577_-0.036527777777777645.png, mandelbrot-set-126_0.3271266718106998_-0.038022762345678876_0.32727019032921834_-0.037927083333333195.png, mandelbrot-set-127_0.32720972650891655_-0.03795410379515304_0.32721504200960244_-0.03795056012802912.png, mandelbrot-set-128_0.3272145301465734_-0.03795331139181005_0.3272149288091249_-0.03795304561677576.png, mandelbrot-set-129_0.3272146478996789_-0.037953228829287824_0.32721465602058275_-0.03795322341535194.png, mandelbrot-set-130_0.32721465129842753_-0.0379532260847231_0.3272146516593566_-0.03795322584410373.png, mandelbrot-set-131_0.3125_-0.9708333333333328_0.9000000000000004_-0.579166666666667.png, mandelbrot-set-132_0.34622685185185187_-0.6518788580246915_0.3717939814814815_-0.6348341049382719.png, mandelbrot-set-133_0.3553647333676269_-0.6502138381630088_0.35619329775377234_-0.6496614619055786.png, mandelbrot-set-134_0.3557260795026959_-0.6500373846363298_0.3557629045865246_-0.6500128345804439.png, mandelbrot-set-135_0.3557292164542813_-0.6500220635829344_0.35573122819497194_-0.6500207224224739.png, mandelbrot-set-136_0.35573026330452956_-0.6500214693743415_0.35573034153888977_-0.6500214172181014.png, mandelbrot-set-137_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-138_-0.2999999999999998_-1.0083333333333337_0.27500000000000036_-0.625.png, mandelbrot-set-139_-0.14496742112482816_-0.8886631229995429_-0.14260973936899826_-0.887091335162323.png, mandelbrot-set-140_-0.28749999999999964_-1.1583333333333337_-0.08750000000000036_-1.025.png, mandelbrot-set-141_-0.1708333333333334_-1.0419753086419752_-0.1456481481481483_-1.0251851851851852.png, mandelbrot-set-143_-0.16075656022963988_-1.0369356085623802_-0.16071197226032627_-1.0369058832495046.png, mandelbrot-set-144_-0.16074937661236158_-1.0369284249451018_-0.16074417468260832_-1.0369249569919332.png, mandelbrot-set-145_-0.1607471417092083_-1.0369268691827775_-0.16074689606252554_-1.0369267054183224.png, mandelbrot-set-146_-0.1607470152466568_-1.0369267945789702_-0.16074700296432268_-1.0369267863907474.png, mandelbrot-set-147_-1.2230898491083677_-0.24439729080932765_-1.221592935528121_-0.24339934842249636.png, mandelbrot-set-148_-1.221994884545039_-0.2440078160722449_-1.2219574617055329_-0.2439828675125741.png, mandelbrot-set-149_-1.22197780171182_-0.24399936128257868_-1.2219761384745087_-0.24399825245770443.png, mandelbrot-set-150_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-151_-0.9874999999999998_-0.3458333333333332_-0.5625_-0.0625.png, mandelbrot-set-152_-0.9874999999999998_-0.3458333333333332_-0.5625_-0.0625.png, mandelbrot-set-153_-0.746273148148148_-0.29598765432098756_-0.7289583333333333_-0.28444444444444433.png, mandelbrot-set-154_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-155_-0.8375000000000004_-0.9375_-0.125_-0.46250000000000036.png, mandelbrot-set-156_-0.2787152777777778_-0.8457986111111112_-0.26684027777777786_-0.8378819444444445.png, mandelbrot-set-157_-0.2709525462962964_-0.8422507716049383_-0.27030381944444454_-0.8418182870370371.png, mandelbrot-set-158_-0.27085163323045275_-0.8420335281993028_-0.27081319015775046_-0.8420078994841679.png, mandelbrot-set-159_-0.2708289233412082_-0.8420273345931452_-0.27082700118757314_-0.8420260531573884.png, mandelbrot-set-160_-0.2708275137618758_-0.8420271791597339_-0.27082714356932386_-0.8420269323646993.png, mandelbrot-set-161_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-162_-0.375_-1.225_0.11249999999999982_-0.8999999999999999.png, mandelbrot-set-163_-0.13621527777777787_-0.9922337962962963_-0.12041666666666673_-0.9817013888888888.png, mandelbrot-set-164_-0.1282282021604939_-0.9891813485939643_-0.1278186085390947_-0.9889082861796982.png, mandelbrot-set-165_-0.12805640039151814_-0.9890783180996926_-0.1279945820949551_-0.9890371059019839.png, mandelbrot-set-166_-0.12800900636415313_-0.9890624437716863_-0.1280055147751806_-0.9890601160457045.png, mandelbrot-set-167_-0.1280077325807687_-0.9890614501775403_-0.12800724117195036_-0.9890611225716615.png, mandelbrot-set-168_-0.12800758834318035_-0.989061289559658_-0.1280075692328374_-0.9890612768194295.png, mandelbrot-set-169_-0.12800757432892887_-0.989061283684997_-0.12800757305490598_-0.9890612828356485.png, mandelbrot-set-170_-0.12800757375797786_-0.9890612835465846_-0.12800757364591103_-0.9890612834718735.png, mandelbrot-set-171_-0.1280075736939545_-0.9890612835041791_-0.12800757369187918_-0.9890612835027957.png, mandelbrot-set-172_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-173_-0.3250000000000002_-1.15_-0.0625_-0.9750000000000001.png, mandelbrot-set-174_-0.18670138888888899_-1.0752199074074074_-0.15777777777777785_-1.0559375.png, mandelbrot-set-175_-0.1773547775205762_-1.0733363018689985_-0.1719182098765433_-1.0697119234396433.png, mandelbrot-set-176_-0.1748428819146758_-1.0721684465973174_-0.17458615510926315_-1.071997295393709.png, mandelbrot-set-177_-0.17467410781111747_-1.0720940433657487_-0.17464914826059125_-1.072077403665398.png, mandelbrot-set-178_-0.17466285290268574_-1.072084822198471_-0.1746607729401419_-1.072083435556775.png, mandelbrot-set-179_-0.17466181869908756_-1.0720841481365353_-0.17466162803585436_-1.0720840210277132.png, mandelbrot-set-180_-0.17466173060561221_-1.0720840915848788_-0.17466171701202984_-1.0720840825224904.png, mandelbrot-set-182_-0.17466172416404427_-1.0720840872221904_-0.1746617239773889_-1.0720840870977535.png, mandelbrot-set-183_-0.17466172404254546_-1.0720840871585318_-0.17466172400383176_-1.0720840871327226.png, mandelbrot-set-184_-0.174661724025662_-1.072084087146392_-0.1746617240215397_-1.0720840871436437.png, mandelbrot-set-185_-0.17466172402376498_-1.07208408714564_-0.17466172402346725_-1.0720840871454416.png, mandelbrot-set-186_-0.17466172402369468_-1.072084087145528_-0.17466172402363678_-1.0720840871454893.png, mandelbrot-set-187_-6.75_-4.5_6.75_4.5.png, mandelbrot-set-189_-0.75_-0.7708333333333335_-0.3250000000000002_-0.4874999999999998.png, mandelbrot-set-190_-0.3816666666666668_-0.6645833333333333_-0.36868055555555573_-0.6559259259259259.png, mandelbrot-set-191_-0.37435596707818947_-0.6632326174554184_-0.3716986239711936_-0.6614610553840877.png, mandelbrot-set-192_-0.3732364382692236_-0.662509229609625_-0.3727861662427604_-0.6622090482586496.png, mandelbrot-set-193_-0.3731146980546613_-0.6624365468102916_-0.3730613324811546_-0.6624009697612872.png, mandelbrot-set-194_-0.3730913259099681_-0.6624228265872265_-0.373083271661374_-0.6624174570881638.png, mandelbrot-set_failure-1.py, mandelbrot-set_failure-2.py, mandelbrot-set_failure-3.py, mandelbrot-set_v3-different-coloring.py, mandelbrot-set_v3-f_c-of-z-equals-z-cubed-plus-c.py