|
25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more... |
Home Projects Up Sitemap Search Blog Forum+Chat About Us Privacy Terms of Use Feedback FAQ Images Services Payments Humor Music |
Calculates the increasing area within the Koch snowflake as the number of segments is increased.
It shows that the fractal dimension of the curve is the limit that the area approaches but can never reach because it requires an infinite number of iterations to get there.
10 'KOCHMATH.BAS 7/28/88 11 'COPYRIGHT (C)1988 STEVEN WHITNEY. 12 'Published under GNU GPL (General Public License) Version 3, with ABSOLUTELY NO WARRANTY. 13 'Initially published by http://25yearsofprogramming.com. 20 'CALCULATES THE MATH ASSOCIATED WITH THE KOCH CURVE. 30 'ALL IT REALLY DOES IT PRINT SOME LINES OF NUMBERS, BUT 35 'THOSE NUMBERS SHOW THAT... 40 'THE FRACTIONAL DIMENSION OF THE KOCH CURVE IS THE 45 'LIMIT TOWARDS WHICH THE INCREASED AREA GOES! 80 DEFDBL A,L,S,C 90 LENGTH=3 100 AREA= SQR(3)/4 110 LASTAREA=AREA 120 PRINT "I","AREA","CUM.DIFF." 130 FOR I=1 TO 42 140 SEGS = (3 * 4^I) - (3 * 4^(I-1)) 150 SEGAREA = (SQR(3)/4) * 1/(9^I) 160 LENGTH=LENGTH * 4/3 170 AREA = AREA + SEGS/3 * SEGAREA 180 CUMAREA=CUMAREA+(AREA-LASTAREA) 190 PRINT I,AREA,CUMAREA 200 LASTAREA=AREA 210 NEXT I
|
|
|
|
|
Copyright ©2012 Steven Whitney. Last modified Sun 07/29/2012 11:39:57 -0700. |
||