eighth man Posted September 16, 2004 Posted September 16, 2004 I wrote a small program that generates alot of regularity: $pattern= "#################################################################################################"; $r=1; for(0..366000) { $x=1/($r**2); $r=$r+0.01; @t=split/\./,$x; $t[1]=~m/^..(.)..(.)../; $p=$2.$1; print $p.' '.substr($pattern,0,$p)."\n" } You can see the result by entering c:>perl this.pl > rw and browsing through rw with word at 10% size (choose normal view) Is this a fractal or chaos or something unknown ? it is the combination of a formula and a simple logical operation that extracts a couple of digits of the precision and graphs numbers out of them. The / .../ matches the digits and $1 and $2 identifies which. Any clues if these things are already known ? Thanks eighth man
Dave Posted September 16, 2004 Posted September 16, 2004 For those of use not familiar with perl, can you explain your algorithm a bit more? I think I know what it's doing, but I'm not 100% sure.
eighth man Posted September 17, 2004 Author Posted September 17, 2004 Ok. The only thing really hard is the split and pattern matching thing. the @t=split/\./,$x; is splitting the number $x between it's whole number place and decimal place putting it in 2 slots of the array @t (which in perl can also be written $t[) so for $x=3.234 $t[0] is equal to 3 and $t[1] is equal to 234. Next you extract some character from the pattern $x[1] according to position with the syntax $t[1]=~m/....../; each dot is the corresponding character the first dot is 2 the second is 3 etc. Put (.) to identify the character and it is $1 or $2 according to if it is the first or second paranthesese. so if if $t[1] is 234 then $t[1]=~m/(.).(.)/ would make $1 equal to 2 and $2 equal to 4. Sorry I didn't think it was too complicated but maybe I use perl too much.. It could be done in other languages but this is the fastest way. I find the resulting drawing which I scroll with word really strange! It has alot of regularity but it doesn't seem to come from nowhere. I don't know if this is already known mathematically or if it is a new discovery.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now