Page 3 of 4 [ 55 posts ]  Go to page Previous  1, 2, 3, 4  Next

Ancalagon
Veteran
Veteran

User avatar

Joined: 25 Dec 2007
Age: 40
Gender: Male
Posts: 2,525

10 Feb 2012, 12:39 am

Shorttail wrote:
Forgot this! Fractals! Like walking on the razor edge of insanity.

http://upload.wikimedia.org/wikipedia/c ... ot_set.jpg

I want to write that code.

Fractals are indeed awesome.

Writing code for that is actually not very hard. Do a bunch of iterations of z = z^2 + c (where z and c are complex numbers). c is the complex number of a grid position in the complex plane, and z is 0 initially. If you go from -2 to +0.5 on the real axis and -1.25 to 1.25 on the imaginary axis, you should get the whole set on the screen. If z goes to infinity (if it goes farther than about 2 units from the origin) then color the pixel corresponding to c with a color that depends on how fast it left. If z doesn't go far from the center in a set number of iterations (256 is a good one to start with), then it's part of the set, so color it black.

There are optimizations that you can make to avoid excess work, but that shouldn't be too slow to start off with.


_________________
"A dead thing can go with the stream, but only a living thing can go against it." --G. K. Chesterton


marshall
Veteran
Veteran

User avatar

Joined: 14 Apr 2007
Gender: Male
Posts: 11,000
Location: Turkey

11 Feb 2012, 12:51 am

Ancalagon wrote:
Shorttail wrote:
Forgot this! Fractals! Like walking on the razor edge of insanity.

http://upload.wikimedia.org/wikipedia/c ... ot_set.jpg

I want to write that code.

Fractals are indeed awesome.

Writing code for that is actually not very hard. Do a bunch of iterations of z = z^2 + c (where z and c are complex numbers). c is the complex number of a grid position in the complex plane, and z is 0 initially. If you go from -2 to +0.5 on the real axis and -1.25 to 1.25 on the imaginary axis, you should get the whole set on the screen. If z goes to infinity (if it goes farther than about 2 units from the origin) then color the pixel corresponding to c with a color that depends on how fast it left. If z doesn't go far from the center in a set number of iterations (256 is a good one to start with), then it's part of the set, so color it black.

There are optimizations that you can make to avoid excess work, but that shouldn't be too slow to start off with.


There are actually a lot of fractal software programs that contain their own language and compiler that will do high precision floating point math on complex numbers very efficiently. Using 128 or 256 bit floats allows you to zoom to depths that you can't get with the normal 64 bit double precision numbers. You can also tweak the iteration algorithm to get all kinds of different fractals and color them any way you want using creative mathematical formulas and coloring/shading gradients. I really got into making fractal artwork about 8 years ago. The software's probably gotten even better these days. The program I used cost around $40.



iamnotaparakeet
Veteran
Veteran

User avatar

Joined: 31 Jul 2007
Age: 34
Gender: Male
Posts: 25,257
Location: 0.5 Galactic radius

11 Feb 2012, 12:59 am

RushKing wrote:
Math is the only subject my brain won't gain pleasure from for some reason. How can I gain pleasure from just memorizing, following rules and steps? It makes my mind feel like a slave. I learn allot quicker when I gain pleasure from knowledge, maybe that’s why I fail at math.


Study mathematics in conjunction with a study of physics then, since you'll be able to see how incredibly useful the mathematics really are.



monkeykoder
Blue Jay
Blue Jay

User avatar

Joined: 7 Feb 2012
Age: 34
Gender: Male
Posts: 76

11 Feb 2012, 1:14 am

iamnotaparakeet wrote:
RushKing wrote:
Math is the only subject my brain won't gain pleasure from for some reason. How can I gain pleasure from just memorizing, following rules and steps? It makes my mind feel like a slave. I learn allot quicker when I gain pleasure from knowledge, maybe that’s why I fail at math.


Study mathematics in conjunction with a study of physics then, since you'll be able to see how incredibly useful the mathematics really are.


You're confusing Mathematics with the application of Mathematics.



marshall
Veteran
Veteran

User avatar

Joined: 14 Apr 2007
Gender: Male
Posts: 11,000
Location: Turkey

11 Feb 2012, 1:15 am

Declension wrote:
monkeykoder wrote:
Here we may contend with differing definitions of the word "true" or "truth"


I think so. For me, a claim can only be true or false when it refers to objects in "reality".

So for me, mathematical claims cannot be true or false, because there are no mathematical objects in reality for them to refer to.

However, metamathematical claims can be true or false, because they refer to proofs, and proofs exist in reality.

e.g. "There exists an empty set."
-mathematical claim
-neither true nor false

e.g. "In ZFC, the statement "there exists an empty set" is provable."
-metamathematical claim
-true


I do feel that ZFC is arbitrary to some degree, but I do think certain things arise more naturally than others. You can play around with axioms but in the end there is a strong sense that "all roads lead to Rome". If some other intelligent life forms came up with their own mathematics I have a strong feeling they would have similar axioms and proofs. The more controversial matters concerning axioms mostly crop up at a level that has less connection to the physical world. The existence of certain pathological mappings and structure of higher order transfinite numbers is very sensitive to the axiomatic framework, but the part of set theory needed to do calculus and differential equations is a bit more settled.



Declension
Veteran
Veteran

User avatar

Joined: 20 Jan 2012
Age: 31
Gender: Male
Posts: 1,880

11 Feb 2012, 1:25 am

marshall wrote:
You can play around with axioms but in the end there is a strong sense that "all roads lead to Rome".


I definitely agree that aliens have the concept of natural numbers. That is an extremely "natural" concept (as the name implies!)

Also, aliens are studying the same physics as us, so presumably the mathematics that they use to model the physics is isomorphic in some sense.

However, I strongly suspect that there are some fields of mathematics that are "cultural", i.e. if we thought of mathematics from a different viewpoint, it would never occur to us to study them. I have no idea which fields these are, because I cannot escape from my assumptions.



monkeykoder
Blue Jay
Blue Jay

User avatar

Joined: 7 Feb 2012
Age: 34
Gender: Male
Posts: 76

11 Feb 2012, 1:33 am

marshall wrote:
Declension wrote:
monkeykoder wrote:
Here we may contend with differing definitions of the word "true" or "truth"


I think so. For me, a claim can only be true or false when it refers to objects in "reality".

So for me, mathematical claims cannot be true or false, because there are no mathematical objects in reality for them to refer to.

However, metamathematical claims can be true or false, because they refer to proofs, and proofs exist in reality.

e.g. "There exists an empty set."
-mathematical claim
-neither true nor false

e.g. "In ZFC, the statement "there exists an empty set" is provable."
-metamathematical claim
-true


I do feel that ZFC is arbitrary to some degree, but I do think certain things arise more naturally than others. You can play around with axioms but in the end there is a strong sense that "all roads lead to Rome". If some other intelligent life forms came up with their own mathematics I have a strong feeling they would have similar axioms and proofs. The more controversial matters concerning axioms mostly crop up at a level that has less connection to the physical world. The existence of certain pathological mappings and structure of higher order transfinite numbers is very sensitive to the axiomatic framework, but the part of set theory needed to do calculus and differential equations is a bit more settled.


I believe contrary to popular thought that reality does not create truth but rather truth creates reality. ALL that is true exists. EVERY axiom is true in it's own space. Physics/Biology/Science in general are merely languages to describe the consequences of a given set of axioms that gave rise to us.



monkeykoder
Blue Jay
Blue Jay

User avatar

Joined: 7 Feb 2012
Age: 34
Gender: Male
Posts: 76

11 Feb 2012, 1:50 am

Declension wrote:
marshall wrote:
You can play around with axioms but in the end there is a strong sense that "all roads lead to Rome".


I definitely agree that aliens have the concept of natural numbers. That is an extremely "natural" concept (as the name implies!)

Also, aliens are studying the same physics as us, so presumably the mathematics that they use to model the physics is isomorphic in some sense.

However, I strongly suspect that there are some fields of mathematics that are "cultural", i.e. if we thought of mathematics from a different viewpoint, it would never occur to us to study them. I have no idea which fields these are, because I cannot escape from my assumptions.


I am at this exact moment trying to postulate an alien race that has no concept of natural numbers. It might take me a few weeks to break that far out of my limited human brain.



monkeykoder
Blue Jay
Blue Jay

User avatar

Joined: 7 Feb 2012
Age: 34
Gender: Male
Posts: 76

11 Feb 2012, 1:59 am

Dang I've come up with a few thought processes which might come to the conclusion of having an alien being that has no concept of the natural numbers but I don't know that I could get anyone to perceive it as "alive".



ruveyn
Veteran
Veteran

User avatar

Joined: 21 Sep 2008
Age: 83
Gender: Male
Posts: 31,726
Location: New Jersey

11 Feb 2012, 11:51 am

monkeykoder wrote:
Dang I've come up with a few thought processes which might come to the conclusion of having an alien being that has no concept of the natural numbers but I don't know that I could get anyone to perceive it as "alive".


Do newborn babies have any concept of number? No. But they eat and eliminate. Yup. They are alive.

ruveyn



monkeykoder
Blue Jay
Blue Jay

User avatar

Joined: 7 Feb 2012
Age: 34
Gender: Male
Posts: 76

11 Feb 2012, 12:08 pm

ruveyn wrote:
monkeykoder wrote:
Dang I've come up with a few thought processes which might come to the conclusion of having an alien being that has no concept of the natural numbers but I don't know that I could get anyone to perceive it as "alive".


Do newborn babies have any concept of number? No. But they eat and eliminate. Yup. They are alive.

ruveyn


I guess I have to amend that to say "mature sentient alien being". I think I am narrowing down to a perception of the universe that would actually forbid a concept of the natural numbers. Of course my usual thought experiments can get a little too far out there to actually be useful for the conversation.



Ancalagon
Veteran
Veteran

User avatar

Joined: 25 Dec 2007
Age: 40
Gender: Male
Posts: 2,525

11 Feb 2012, 2:52 pm

marshall wrote:
There are actually a lot of fractal software programs that contain their own language and compiler that will do high precision floating point math on complex numbers very efficiently.

True, and if you just want to make fractal images, grabbing an already-written program is more efficient. But he did say he wanted to write that code, and simple code to do just that can be written in 15 lines or so. Writing code that does something that cool (even if you got the recipe from somewhere else) is pretty cool itself.

I first wrote that code in an interpreted BASIC on a very slow computer by following the code from a book. I started playing around with it, and images sometimes took hours to make. Then I tried out a free software package (fractint) and it did things almost instantly on the same computer (at least if you weren't zoomed in a lot).


_________________
"A dead thing can go with the stream, but only a living thing can go against it." --G. K. Chesterton


marshall
Veteran
Veteran

User avatar

Joined: 14 Apr 2007
Gender: Male
Posts: 11,000
Location: Turkey

12 Feb 2012, 7:32 pm

Ancalagon wrote:
marshall wrote:
There are actually a lot of fractal software programs that contain their own language and compiler that will do high precision floating point math on complex numbers very efficiently.

True, and if you just want to make fractal images, grabbing an already-written program is more efficient. But he did say he wanted to write that code, and simple code to do just that can be written in 15 lines or so. Writing code that does something that cool (even if you got the recipe from somewhere else) is pretty cool itself.

I first wrote that code in an interpreted BASIC on a very slow computer by following the code from a book. I started playing around with it, and images sometimes took hours to make. Then I tried out a free software package (fractint) and it did things almost instantly on the same computer (at least if you weren't zoomed in a lot).


Yea. The pseudo-code in c would be something like...

bound = 4.0;

for ( x_grid = 0; x_grid < x_gridsize; x_grid++)
for ( y_grid = 0; y_grid < y_gridsize; y_grid++) {

x = grid2float(x_grid)
y = grid2float(y_grid)
z1 = 0.0
z2 = 0.0
bail = false;

for ( i = 0; i<256; i++ ) {

new_z1 = z1*z1 - z2*z2 + x;
z2 = 2*z1*z2 + y;
z1 = new_z1;

if (bound < z1*z1 + z2*z2) { bail = true; break; }
}

if (bail) { colorgrid(x_grid, y_grid, color( i ) ); }
else { colorgrid(x_grid, y_grid, "black"); }
}



iamnotaparakeet
Veteran
Veteran

User avatar

Joined: 31 Jul 2007
Age: 34
Gender: Male
Posts: 25,257
Location: 0.5 Galactic radius

13 Feb 2012, 5:00 pm

monkeykoder wrote:
iamnotaparakeet wrote:
RushKing wrote:
Math is the only subject my brain won't gain pleasure from for some reason. How can I gain pleasure from just memorizing, following rules and steps? It makes my mind feel like a slave. I learn allot quicker when I gain pleasure from knowledge, maybe that’s why I fail at math.


Study mathematics in conjunction with a study of physics then, since you'll be able to see how incredibly useful the mathematics really are.


You're confusing Mathematics with the application of Mathematics.


No, I'm not. Seeing the application of mathematics to reality was a great encouragement to me to keep learning more in the field of mathematics, and seeing how everything behaves in a mathematical manner allows for a better understanding of the mathematics itself.



Zorae
Butterfly
Butterfly

User avatar

Joined: 13 Feb 2012
Age: 29
Gender: Female
Posts: 10

15 Feb 2012, 12:47 am

iamnotaparakeet wrote:
monkeykoder wrote:
iamnotaparakeet wrote:
RushKing wrote:
Math is the only subject my brain won't gain pleasure from for some reason. How can I gain pleasure from just memorizing, following rules and steps? It makes my mind feel like a slave. I learn allot quicker when I gain pleasure from knowledge, maybe that’s why I fail at math.


Study mathematics in conjunction with a study of physics then, since you'll be able to see how incredibly useful the mathematics really are.


You're confusing Mathematics with the application of Mathematics.


No, I'm not. Seeing the application of mathematics to reality was a great encouragement to me to keep learning more in the field of mathematics, and seeing how everything behaves in a mathematical manner allows for a better understanding of the mathematics itself.


Realizing that everything behaves in a mathematical manner fascinated me and made me value math much more. But I do feel a bit of distain towards physics as it is inductive and therefore impossible to be absolutely true (just very likely that it's true). Math, however, is absolute. If the constants of the universe were to change, then all of our current knowledge of physics would be wrong and new laws/rules would have to be written. But no matter what they are, 1+1=2. Math isn't just true everywhere in this universe, it's true in every universe, and that's a godly quality in my eyes.

Math's consistency is what I love about it. It's not subjective like english or history. If you follow the correct steps, you'll always get the correct answer. Because math itself is logical, the steps you need to apply are usually logical themselves (yes usually, partial differential equations can go f*** themselves). I love working on a hard math problem. The amount of focus and energy you put in it makes the moment when you have an epiphany/finally get the correct answer very rewarding.

Also, fractals are beautiful and awesome!