Clan x86

Technical (Development, Security, etc.) => General Programming => Topic started by: Joe on November 08, 2005, 10:10:27 pm

Title: [JAVA] Calculate Pi!
Post by: Joe on November 08, 2005, 10:10:27 pm
Yes! A very advanced mathematical..tool?

This is the brainchild of five straight hours of pondering the problem, resulting in 5 hours of detention to be served starting tomorrow, for insubordination when teachers told me to get to work.

public class CalculatePi {
  public static void main(String args[]) {
    System.out.println("Pi: " + 4 * Math.atan(1));
  }
}


I also managed to port it to Visual Basic after another three hours of work, mostly debugging.
Public Sub Main
    Call MsgBox(4 * Atan(1))
End Sub


You may use this in your programs for a royalty of 50cents per copy sold.
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 08, 2005, 10:25:51 pm
Wow, your teachers suck. -_-
Title: Re: [JAVA] Calculate Pi!
Post by: Newby on November 08, 2005, 10:26:12 pm
How about pi?

Or (22 / 7) (isn't that supposed to be pi?)
Title: Re: [JAVA] Calculate Pi!
Post by: Joe on November 08, 2005, 10:35:00 pm
Wow, your teachers suck. -_-

We didn't learn that in school son.

Newby, I doubt it. Just a sec..

EDIT -
No, but its close. 22/7=3.1428571
Title: Re: [JAVA] Calculate Pi!
Post by: deadly7 on November 08, 2005, 10:35:51 pm
How about pi?

Or (22 / 7) (isn't that supposed to be pi?)
I think it is.
Pi = the world's gayest number.
Title: Re: [JAVA] Calculate Pi!
Post by: Joe on November 08, 2005, 10:39:40 pm
22/7 is 3.1428571. Pi is 3.141592 something.

EDIT -
deadly, actually, that would be infinity (the gayest number). At least you can add/subtract/multiply/divide something by pi and get something not pi.

Also, pi is not only a number, but the 16th letter in the greek alphabet.

(http://yoni.valhallalegends.com/greek/small-16.gif)

STUPID -
Hm, are they going to start with hurricane gamma next year? I can just see it now "Hurricane Pi is coming!"
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 08, 2005, 10:51:34 pm
How about pi?

Or (22 / 7) (isn't that supposed to be pi?)
I think it is.
Pi = the world's gayest number.

No, it's not.  It's moderately close, but using a Pi constant on calculators is a lot more accurate than using 22/7.
Title: Re: [JAVA] Calculate Pi!
Post by: Joe on November 08, 2005, 11:12:32 pm
How about pi?

Or (22 / 7) (isn't that supposed to be pi?)
I think it is.
Pi = the world's gayest number.

No, it's not. It's moderately close, but using a Pi constant on calculators is a lot more accurate than using 22/7.

Anyone here work at TI and know how that's done? I figure its probably 4*ATan(1) rounded to the nearest millionth or something.
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 09, 2005, 12:06:01 am
Anyone here work at TI and know how that's done? I figure its probably 4*ATan(1) rounded to the nearest millionth or something.

How what's done?  Calculating Pi?  There's a stored constant for Pi in all TI model's I've ever used.  Calculating it is pretty dumb.  Plus, all TI model's I've seen round to the nearest 10th digit (or at least that's what I understand).
Title: Re: [JAVA] Calculate Pi!
Post by: trust on November 09, 2005, 06:20:14 am
infinity isn't a number.

I've debated it with my math teacher and that's what she says.
Title: Re: [JAVA] Calculate Pi!
Post by: iago on November 09, 2005, 08:34:39 am
Infinity isn't a number.  But, then, neither is 0, so eh?

And by the way, taking the atan of 1 isn't calculating Pi, since the forumla for arctan uses Pi.  It's like "calculating" the constant C in a=bC by setting b to 1.  You aren't calculating anything.  The best way to calculate Pi in Java is Math.PI, I believe.

To actually calculate Pi, it's an infinite formula.  You can keep going and it gets more and more accurate the longer you iterate, until you run out of room in your variable (unless you're using java.Math.BigDecimal, then you can go forever). 

I believe this is it:
(http://en.wikipedia.org/math/f/4/6/f4617c1392641b9dabb48be0cbdf2330.png)
Title: Re: [JAVA] Calculate Pi!
Post by: MyndFyre on November 09, 2005, 10:25:19 am
What is that, the sequence of squares over odd numbers (roughly)?
Title: Re: [JAVA] Calculate Pi!
Post by: iago on November 09, 2005, 05:42:08 pm
Yeah, that sounds right.  It looks pretty recursive, and the deeper you go the more accurate you get.  Of course, on computess, double's are only see accurate in the first place, so..
Title: Re: [JAVA] Calculate Pi!
Post by: d&q on November 09, 2005, 06:15:51 pm
Infinity isn't a number, its a concept.

I've used this formula for Pi since 'round sixth grade:

(http://img495.imageshack.us/img495/2706/8734cd1bd788164765a35d2277556d.png)
Title: Re: [JAVA] Calculate Pi!
Post by: Quik on November 09, 2005, 06:32:22 pm
If infinity isn't a number, is e? I recently had a conversation with my math teacher about "the number e" (Euler's number)
Title: Re: [JAVA] Calculate Pi!
Post by: Newby on November 09, 2005, 07:21:06 pm
If infinity isn't a number, is e? I recently had a conversation with my math teacher about "the number e" (Euler's number)

e isn't infinite. It comes really close, seeing as how it's a constant.
Title: Re: [JAVA] Calculate Pi!
Post by: Quik on November 09, 2005, 07:25:31 pm
If infinity isn't a number, is e? I recently had a conversation with my math teacher about "the number e" (Euler's number)

e isn't infinite. It comes really close, seeing as how it's a constant.

I know it's not infinte, it's irrational. (1 + 1/n)^n as n -> infinity

The question is, do you consider "e" to be a number? I believe it is, just an irrational one.
Title: Re: [JAVA] Calculate Pi!
Post by: Ender on November 09, 2005, 08:11:01 pm
How about pi?

Or (22 / 7) (isn't that supposed to be pi?)

Pi is an irrational number, meaning that it can't be expressed as int / int.
The question is, do you consider "e" to be a number? I believe it is, just an irrational one.

Of course it is. We say the word number when we refer to "real numbers." And irrational numbers are a subset of real numbers.

Infinity isn't a number simply because we can't put numbers to it. It's a concept that helps us understand things. e is used in calculations, however. It's paramount in calculus. Why? Derivative of ln x = 1/x.
Title: Re: [JAVA] Calculate Pi!
Post by: d&q on November 09, 2005, 08:15:40 pm
Yes, because it can be expressed as an irrational number.

[Edit]: Whoops, didn't see Ender's post.

[Edit #2]: Actually, sometimes I refer to imaginary numbers as "a number". By imaginary, I mean a complex number with a coefficient of i.
Title: Re: [JAVA] Calculate Pi!
Post by: Quik on November 09, 2005, 08:35:43 pm
Of course it is. We say the word number when we refer to "real numbers." And irrational numbers are a subset of real numbers.

This is my point. Usually, people refer to it as a letter.
Title: Re: [JAVA] Calculate Pi!
Post by: d&q on November 09, 2005, 09:21:12 pm
But it can be expressed as an irrational number, which is what I think counts. I also view i as a number, because it can be defined as the square root of -1.
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 09, 2005, 09:49:52 pm
If infinity isn't a number, is e? I recently had a conversation with my math teacher about "the number e" (Euler's number)

Yes, it's just as much of a constant as Pi is. :P

You can round Pi and e; you can't round infinite.
Title: Re: [JAVA] Calculate Pi!
Post by: Joe on November 09, 2005, 10:03:35 pm
(http://images.google.com/imgres?imgurl=http://thesaurus.maths.org/mmkb/media/png/Infinity.png&imgrefurl=http://thesaurus.maths.org/mmkb/entry.html%3Faction-entryByConcept%26id%3D961%26langcode%3Den%26expand%3D0&h=160&w=300&sz=15&tbnid=EKJPI77eCbAJ:&tbnh=59&tbnw=111&hl=en&start=1&prev=/images%3Fq%3Dinfinity%26svnum%3D10%26hl%3Den%26lr%3D%26safe%3Doff%26client%3Dfirefox%26rls%3Dorg.mozilla:en-US:unofficial%26sa%3DN) rounded to the nearest tenth is (http://images.google.com/imgres?imgurl=http://thesaurus.maths.org/mmkb/media/png/Infinity.png&imgrefurl=http://thesaurus.maths.org/mmkb/entry.html%3Faction-entryByConcept%26id%3D961%26langcode%3Den%26expand%3D0&h=160&w=300&sz=15&tbnid=EKJPI77eCbAJ:&tbnh=59&tbnw=111&hl=en&start=1&prev=/images%3Fq%3Dinfinity%26svnum%3D10%26hl%3Den%26lr%3D%26safe%3Doff%26client%3Dfirefox%26rls%3Dorg.mozilla:en-US:unofficial%26sa%3DN)

Joe > Sidoh.

EDIT -
Nice, google </3 hotlinkers.
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 09, 2005, 10:07:48 pm
(http://images.google.com/imgres?imgurl=http://thesaurus.maths.org/mmkb/media/png/Infinity.png&imgrefurl=http://thesaurus.maths.org/mmkb/entry.html%3Faction-entryByConcept%26id%3D961%26langcode%3Den%26expand%3D0&h=160&w=300&sz=15&tbnid=EKJPI77eCbAJ:&tbnh=59&tbnw=111&hl=en&start=1&prev=/images%3Fq%3Dinfinity%26svnum%3D10%26hl%3Den%26lr%3D%26safe%3Doff%26client%3Dfirefox%26rls%3Dorg.mozilla:en-US:unofficial%26sa%3DN) rounded to the nearest tenth is (http://images.google.com/imgres?imgurl=http://thesaurus.maths.org/mmkb/media/png/Infinity.png&imgrefurl=http://thesaurus.maths.org/mmkb/entry.html%3Faction-entryByConcept%26id%3D961%26langcode%3Den%26expand%3D0&h=160&w=300&sz=15&tbnid=EKJPI77eCbAJ:&tbnh=59&tbnw=111&hl=en&start=1&prev=/images%3Fq%3Dinfinity%26svnum%3D10%26hl%3Den%26lr%3D%26safe%3Doff%26client%3Dfirefox%26rls%3Dorg.mozilla:en-US:unofficial%26sa%3DN)

Joe > Sidoh.

EDIT -
Nice, google </3 hotlinkers.

That's not rounding.  It's like symbolizing a universe with a dot.  Don't be an idiot, Joe.  I guess that kind of is asking a lot of you though, isn't it? :P
Title: Re: [JAVA] Calculate Pi!
Post by: MyndFyre on November 09, 2005, 10:18:12 pm
If infinity isn't a number, is e? I recently had a conversation with my math teacher about "the number e" (Euler's number)

Yes.  e is a constant, infinity is not; for example, you could have one infinity larger than another.  Suppose:
sum[i = 0 to infinity] i / i2 + 1.  Obviously i summed from 0 to infinity would be infinity, but the denominator's infinity is larger, and so we call the series convergent.
Title: Re: [JAVA] Calculate Pi!
Post by: iago on November 09, 2005, 11:28:10 pm
In case there's some question about whether i is a number:
- We know that x + 1 = 0 is a valid equation; however, if we only had regular "counting" numbers available, we couldn't solve it.  We would have to invent a concept of negative numbers, which we are all comfortable with .
- Then we have the equation x2 + 1 = 0.  It also had no solution without inventing the concept of imaginary numbers.
--> Imaginary numbers are negative numbers are both pretty abstract.  We can't see or touch either, but they seem to be numbers in a purely mathematical sense. 

Ok, so the next question is, is 0 a number?  It seems that 0 is just a placeholder.  Doesn't "0" represent the lack of a number, not an actual number?

If 0 is a number, is it even or odd?  What is the definition of even and odd that shows that 0 is even? Can it be shown that 0 also fits into the odd category?

Is the 0 in 2304 the same as the number 0?  How are they related?

What is x in 2x = 6? Is it a number?  It doesn't look like a number, but to anybody with more than a few years of math experience, it's immediately obvious that it's 3.  If x can be considered a number, is it possible that our definition of numbers isn't as clear as we think?

What about x in 0x = 6? Is x still a number?  Any number, real, rational, irrational, imaginary, etc. can be place in front of the x.  But when the number 0 is, x no longer has a value.  It seems like 0 isn't behaving as a number here. 

Or, is there a case for considering 1/0 to be a number?  Is the result infinite or undefined? Why? Is there a case for looking at it either way? 

I think this is the most important question of all:
How are 0 and infinite related?  Think about how to get the result of infinite in a finite equation.  The only way to get it is to use a 0.  This means that 0 and infinite are related, and that infinite can be derived from 0.  Because, as it was already discussed here, infinite isn't a number, does that show that 0 isn't either? 


By the way, most of these questions were inspired by or ripped from a variety of sources.  I post them here to provoke discussion, and maybe we'll all learn something. :)
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 10, 2005, 01:30:25 am
In case there's some question about whether i is a number:
- We know that x + 1 = 0 is a valid equation; however, if we only had regular "counting" numbers available, we couldn't solve it.  We would have to invent a concept of negative numbers, which we are all comfortable with .
- Then we have the equation x2 + 1 = 0.  It also had no solution without inventing the concept of imaginary numbers.
--> Imaginary numbers are negative numbers are both pretty abstract.  We can't see or touch either, but they seem to be numbers in a purely mathematical sense. 

Ok, so the next question is, is 0 a number?  It seems that 0 is just a placeholder.  Doesn't "0" represent the lack of a number, not an actual number?

If 0 is a number, is it even or odd?  What is the definition of even and odd that shows that 0 is even? Can it be shown that 0 also fits into the odd category?

Is the 0 in 2304 the same as the number 0?  How are they related?

What is x in 2x = 6? Is it a number?  It doesn't look like a number, but to anybody with more than a few years of math experience, it's immediately obvious that it's 3.  If x can be considered a number, is it possible that our definition of numbers isn't as clear as we think?

What about x in 0x = 6? Is x still a number?  Any number, real, rational, irrational, imaginary, etc. can be place in front of the x.  But when the number 0 is, x no longer has a value.  It seems like 0 isn't behaving as a number here. 

Or, is there a case for considering 1/0 to be a number?  Is the result infinite or undefined? Why? Is there a case for looking at it either way? 

I think this is the most important question of all:
How are 0 and infinite related?  Think about how to get the result of infinite in a finite equation.  The only way to get it is to use a 0.  This means that 0 and infinite are related, and that infinite can be derived from 0.  Because, as it was already discussed here, infinite isn't a number, does that show that 0 isn't either? 


By the way, most of these questions were inspired by or ripped from a variety of sources.  I post them here to provoke discussion, and maybe we'll all learn something. :)

Those are some pretty interesting points.

  It's funny how life is.  I used to hate math--it was my least favorite subject.  Just this year, I really started enjoying it.  It probably started when I showed some respect for the potential it had to do anything any other "tool" humans have.
Title: Re: [JAVA] Calculate Pi!
Post by: d&q on November 10, 2005, 04:31:17 pm
In case there's some question about whether i is a number:
- We know that x + 1 = 0 is a valid equation; however, if we only had regular "counting" numbers available, we couldn't solve it.  We would have to invent a concept of negative numbers, which we are all comfortable with .
- Then we have the equation x2 + 1 = 0.  It also had no solution without inventing the concept of imaginary numbers.
--> Imaginary numbers are negative numbers are both pretty abstract.  We can't see or touch either, but they seem to be numbers in a purely mathematical sense. 

My argument for both infinity and i is their placement in the number system.

Number System:

All  Numbers-
      Imaginary Numbers- Numbers using the quantity i[/i(Complex Numbers). i defined as being the square root of -1.
      Real Numbers- A number that can be expressed on a number line.
           Irrational Numbers- A number that cannot be written as a result of the calculation: a/b.
           Rational Numbers- Can be written as a result of the calculation: a/b. This includes repeating decimals, such as 5/7 or 1/3.
                Integer- A number that is in the set of Natural numbers, 0, and the negatives of the natural numbers.
                    Whole Number- A number is in the set of Natural numbers, and 0.
                    Natural Number- A number in the set [1, 2, 3, 4, ...]

This is by no means the entire set of numbers, just what I think of when I thinking about what a particular value is. Since i fits, it's a number, and since ∞ does not, it is not a number.
               
Ok, so the next question is, is 0 a number?  It seems that 0 is just a placeholder.  Doesn't "0" represent the lack of a number, not an actual number?

I agree that zero is a lack of a number, but for practical uses, we have to regard it as a whole number.

If 0 is a number, is it even or odd?  What is the definition of even and odd that shows that 0 is even? Can it be shown that 0 also fits into the odd category?

An even number is a number that can be expressed as (2*x). Seeing that 2*0=0, 0 is even.


Is the 0 in 2304 the same as the number 0?  How are they related?

The 0 in 2304, means that in base 10, the second place, which is 10^1, has no value. 0 used in that text means that in whatever place it is, regardless of base, it means that that particular place has no value.


What is x in 2x = 6? Is it a number?  It doesn't look like a number, but to anybody with more than a few years of math experience, it's immediately obvious that it's 3.  If x can be considered a number, is it possible that our definition of numbers isn't as clear as we think?

x in 2x=6 is a variable. It is a symbol used to represent a quantity. In this case however, the hidden value "x", is 3. Which is a number.


What about x in 0x = 6? Is x still a number?  Any number, real, rational, irrational, imaginary, etc. can be place in front of the x.  But when the number 0 is, x no longer has a value.  It seems like 0 isn't behaving as a number here.

In this case, x cannot be defined, as we cannot divide by zero. 

Or, is there a case for considering 1/0 to be a number?  Is the result infinite or undefined? Why? Is there a case for looking at it either way?

I like to view it in baby terms. Lets say we have "1" of something. If we divide it upon 0 people, has it been divided at all, or has it been divided to 0 people, but just in unknown quantities? I had to look this up, and this is what wikipedia said:

Quote
Division: 0 / x = 0, for nonzero x. But x / 0 is undefined, because 0 has no multiplicative inverse, a consequence of the previous rule. For positive x, as y in x / y approaches zero from positive values, its quotient increases toward positive infinity, but as y approaches zero from negative values, the quotient increases toward negative infinity. The different quotients confirms that division by zero is undefined.

I think this is the most important question of all:
How are 0 and infinite related?  Think about how to get the result of infinite in a finite equation.  The only way to get it is to use a 0.  This means that 0 and infinite are related, and that infinite can be derived from 0.  Because, as it was already discussed here, infinite isn't a number, does that show that 0 isn't either? 

The only possible way I could think to produce ∞ from an equation would be x*0=0. But as that is undefined, I do not see any other way.

---------------

Whew! That was long post  :P.
Title: Re: [JAVA] Calculate Pi!
Post by: Joe on November 10, 2005, 05:05:36 pm
Sweet, I sparked a nice conversation by being an idiot!
Title: Re: [JAVA] Calculate Pi!
Post by: rabbit on November 10, 2005, 05:32:47 pm
Also, pi is not only a number, but the 16th letter in the greek alphabet.

(http://yoni.valhallalegends.com/greek/small-16.gif)
It's also a function.  Also, it's another (different) function.  So, pi is officially a letter, number, and two functions.  Hrm.
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 10, 2005, 05:36:01 pm
Sweet, I sparked a nice conversation by being an idiot!

You're actually pretty good at that, I've noticed. :P
Title: Re: [JAVA] Calculate Pi!
Post by: d&q on November 10, 2005, 06:15:18 pm
rabbit: What do you mean Pi itself is a function?
Title: Re: [JAVA] Calculate Pi!
Post by: Joe on November 10, 2005, 07:11:42 pm
rabbit: What do you mean Pi itself is a function?

Yeah, I don't quite get that either.
Title: Re: [JAVA] Calculate Pi!
Post by: AntiVirus on November 11, 2005, 01:08:28 pm
Quote
         Rational Numbers- Can be written as a result of the calculation: a/b. This includes repeating decimals, such as 5/7 or 1/3.
I may be wrong.  But, don't raitonal numbers have numbers that repeat after teh decimal?  Such as .3333333 ect.  But, 5/7 doesn't fit the description, so did you mean to put that in irrational?  Or am I just wrong?
Title: Re: [JAVA] Calculate Pi!
Post by: iago on November 11, 2005, 01:15:13 pm
Quote
         Rational Numbers- Can be written as a result of the calculation: a/b. This includes repeating decimals, such as 5/7 or 1/3.
I may be wrong.  But, don't raitonal numbers have numbers that repeat after teh decimal?  Such as .3333333 ect.  But, 5/7 doesn't fit the description, so did you mean to put that in irrational?  Or am I just wrong?
You're just wrong :-P

Rational numbers have numbers that repeat, as well as numbers that terminate (I forget what they're called), an integers, whole numbers, and natural numbers. 

Irrational numbers contain all rational numbers, and everything below it. 
Title: Re: [JAVA] Calculate Pi!
Post by: d&q on November 11, 2005, 06:23:47 pm
Haha, 5/7 does repeat  :), there is as cool little pattern to know what any x/7 repeating decimal is.

@iago, Actually, I believe irrational numbers do not contain rational numbers, as irrational numbers cannot be written as "a/b".
Title: Re: [JAVA] Calculate Pi!
Post by: MyndFyre on November 11, 2005, 07:00:41 pm
@iago, Actually, I believe irrational numbers do not contain rational numbers, as irrational numbers cannot be written as "a/b".
You are correct, Real numbers are the set of rational numbers plus irrationational numbers, like the set of all numbers contains real and imaginary numbers, whcih are mutually exclusive.  ;)
Title: Re: [JAVA] Calculate Pi!
Post by: iago on November 11, 2005, 08:03:24 pm
@iago, Actually, I believe irrational numbers do not contain rational numbers, as irrational numbers cannot be written as "a/b".
You are correct, Real numbers are the set of rational numbers plus irrationational numbers, like the set of all numbers contains real and imaginary numbers, whcih are mutually exclusive.  ;)
Ah, you're right, I was mixing up irrational and real.  Stupid mistake :)
Title: Re: [JAVA] Calculate Pi!
Post by: rabbit on November 12, 2005, 12:58:35 pm
The first pi function (lowercase pi, as we usually see it), is the number of primes less than the argument.
IE:
(http://img318.imageshack.us/img318/9586/pi23rd.png)

The second pi function (uppercase pi) is the expression for the process of Eratosthenes' Sieve (the multiplication of all factors of the argument).
IE:
(http://img318.imageshack.us/img318/3135/pi13yd.png)
Title: Re: [JAVA] Calculate Pi!
Post by: MyndFyre on November 12, 2005, 01:18:52 pm
The first pi function (lowercase pi, as we usually see it), is the number of primes less than the argument.
IE:
(http://img318.imageshack.us/img318/3135/pi13yd.png)

The second pi function (uppercase pi) is the expression for the process of Eratosthenes' Sieve (the multiplication of all factors of the argument).
IE:
(http://img318.imageshack.us/img318/9586/pi23rd.png)
That seems off.  Number of primes less than 60 is not 46.7 billion.  They are: 2,3,5,7,11,13,17,19,23,27,31,37,41,43,47,53,57.

The multiplication of all positive integral factors of 12 = 1 * 2 * 3 * 4 * 6 = 144.

Unless I'm misunderstanding you.
Title: Re: [JAVA] Calculate Pi!
Post by: rabbit on November 12, 2005, 02:07:35 pm
I got it backwards!!  Whoops....fixing...

Fixed.  Even still, you should have noticed it was backwards considering I said the case of pi...and then had the different cases.
Title: Re: [JAVA] Calculate Pi!
Post by: iago on November 12, 2005, 02:31:02 pm
But in any case, neither of those has anything to do with the constant Pi, doe they?
Title: Re: [JAVA] Calculate Pi!
Post by: rabbit on November 12, 2005, 04:27:20 pm
Sure they do!  They are all represented by the Greek letter Pi.
Title: Re: [JAVA] Calculate Pi!
Post by: Tomcat on November 14, 2005, 08:10:25 pm
e is like pi, I believe.  My ti-83 says it's approximately 2.71828182.  If by "like infinity" you mean not a number, then no, it's a number.  It's more like Pi in that they are both irrational numbers.  I would, however, relate it more closely to phi (phi is approximately 1.618...), because both were discovered frequently in nature.  Phi is a very interresting number.

-EDIT-
Quote
The only possible way I could think to produce ∞ from an equation would be x*0=0. But as that is undefined, I do not see any other way.
x*0 equals 0.  It's defined as 0, isn't it?  anything * 0 is 0, or so I thought.
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 14, 2005, 08:57:17 pm
e is like pi, I believe.  My ti-83 says it's approximately 2.71828182.  If by "like infinity" you mean not a number, then no, it's a number.  It's more like Pi in that they are both irrational numbers.  I would, however, relate it more closely to phi (phi is approximately 1.618...), because both were discovered frequently in nature.  Phi is a very interresting number.

-EDIT-
Quote
The only possible way I could think to produce ∞ from an equation would be x*0=0. But as that is undefined, I do not see any other way.
x*0 equals 0.  It's defined as 0, isn't it?  anything * 0 is 0, or so I thought.

I think those things have already been mentioned.  :P

x * 0 = 0 is one way to think of infinitie, but since you can't devide by zero due to mathematical laws, it's undefined, not infinite.
Title: Re: [JAVA] Calculate Pi!
Post by: Tomcat on November 14, 2005, 09:01:58 pm
Yeah I saw something I knew about, and decided to go ahead and post about it.  I didn't read past page 2.  Oops  ;D ;D
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 14, 2005, 09:10:53 pm
By the way, e is more formally defined as one of the following (I learned it in Calculus about two months ago, but I'm ripping the images from Wikipedia):

(http://en.wikipedia.org/math/8/d/7/8d7fd8270549fd0f682d81d1cd94ccdb.png)

(http://en.wikipedia.org/math/5/d/7/5d787122d4e0a1a698aa112593b45778.png)

(http://en.wikipedia.org/math/9/6/a/96ac2e9617c47dd12949fbdb0017ede7.png)
Title: Re: [JAVA] Calculate Pi!
Post by: MyndFyre on November 14, 2005, 09:42:24 pm
I don't see how e can be the sum of 1/n! from 0 to infinity.  1/0! = 1/0 = undefined.
Title: Re: [JAVA] Calculate Pi!
Post by: d&q on November 15, 2005, 03:11:17 pm
Wrong  :-*! 0! = 1.
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 15, 2005, 03:55:16 pm
Wrong  :-*! 0! = 1.

Hehe, yep
Title: Re: [JAVA] Calculate Pi!
Post by: MyndFyre on November 15, 2005, 05:09:34 pm
Wrong  :-*! 0! = 1.
Oh yeah that's right.  *reaches back 3 years* I remember arguing over that with my calculus teacher.  He won.
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 15, 2005, 10:16:08 pm
Oh yeah that's right.  *reaches back 3 years* I remember arguing over that with my calculus teacher.  He won.

Haha.  I don't think I ever remember learning the reasoning behind it.  I just remember learning 0! = 1. :)
Title: Re: [JAVA] Calculate Pi!
Post by: d&q on November 15, 2005, 10:41:44 pm
Basically, its that you can only arrange nothing in one way.
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 15, 2005, 11:28:42 pm
Basically, its that you can only arrange nothing in one way.

Makes perfect sense. :)
Title: Re: [JAVA] Calculate Pi!
Post by: iago on November 16, 2005, 03:12:22 pm
By the way, here's another math problem: Are there more natural numbers (1, 2, 3, ...) or integers (...., -2, -1, 0, 1, 2, ....)?

For every natural number x, there are two integers, x and -x.  So there are twice as many integers as naturals numbers, plus 1 (for 0).  Right?
Title: Re: [JAVA] Calculate Pi!
Post by: Hitmen on November 16, 2005, 03:17:12 pm
By the way, here's another math problem: Are there more natural numbers (1, 2, 3, ...) or integers (...., -2, -1, 0, 1, 2, ....)?

For every natural number x, there are two integers, x and -x.  So there are twice as many integers as naturals numbers, plus 1 (for 0).  Right?
Well, there's an infinate number for both, one just gets to infinity slightly faster :)
Title: Re: [JAVA] Calculate Pi!
Post by: rabbit on November 16, 2005, 04:59:02 pm
Actually, if either could reach infinity, neither would be faster.
Title: Re: [JAVA] Calculate Pi!
Post by: d&q on November 16, 2005, 05:10:24 pm
There are varying levels of infinity. Numerically, as in counting from 1, 2 ,3, 4 etc, they are infinity, but cardinally, as in {1, 2, 3, ...}, integers are greater. I believe they are alaph numbers..

[Edit]: Whoops, Aleph* Numbers (http://en.wikipedia.org/wiki/Aleph_number)
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 16, 2005, 06:48:08 pm
No number set will ever reach infinite.  Infinite isn't a value, it's a concept.
Title: Re: [JAVA] Calculate Pi!
Post by: d&q on November 16, 2005, 08:43:25 pm
Not reach infinite, be infinite.  :o
Title: Re: [JAVA] Calculate Pi!
Post by: iago on November 16, 2005, 08:51:28 pm
So they're both infinite, but one has twice as many values? :)

And by the way, you are absolutely right:
There are varying levels of infinity. Numerically, as in counting from 1, 2 ,3, 4 etc, they are infinity, but cardinally, as in {1, 2, 3, ...}, integers are greater. I believe they are alaph numbers..

[Edit]: Whoops, Aleph* Numbers (http://en.wikipedia.org/wiki/Aleph_number)
Rational, whole, natural, etc., are all "countable" infinite sets.  So is Real, apparently, but we haven't proven that one yet. 

It's still neat to think that there are the same "number" of even numbers as even+odd numbers. 
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 16, 2005, 09:05:53 pm
Not reach infinite, be infinite.  :o

Actually, if either could reach infinity, neither would be faster.
Title: Re: [JAVA] Calculate Pi!
Post by: MyndFyre on November 16, 2005, 09:14:34 pm
We're not talking about whether either could reach infinity, we're talking about the value of the count of numbers in the series.  Integers have 2 x (count of whole numbers) + 1 items.  Assuming (count of whole numbers) is infinity, the count of integers is 2x(whole numbers count infinity) + 1, which makes it a bigger infinity.

If you put (whole numbers count infinity) / (count of integers infinty) you'd get a value infinitesimally approaching 0.5 from the left.
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 16, 2005, 09:20:30 pm
Aah, I see what you're saying now.  :)
Title: Re: [JAVA] Calculate Pi!
Post by: iago on November 16, 2005, 09:35:50 pm
We're not talking about whether either could reach infinity, we're talking about the value of the count of numbers in the series.  Integers have 2 x (count of whole numbers) + 1 items.  Assuming (count of whole numbers) is infinity, the count of integers is 2x(whole numbers count infinity) + 1, which makes it a bigger infinity.

If you put (whole numbers count infinity) / (count of integers infinty) you'd get a value infinitesimally approaching 0.5 from the left.

Aha, you are correct; however, look at this mapping:

N| 1 2  3 4  5 6  7 ....
------------------------
Z| 0 1 -1 2 -2 3 -3 ....


Assuming we continue doing that to infinity, we can convert any natural number to an integer:
Z
Z
Z

So, for every integer Z

Isn't infinity great? :)
Title: Re: [JAVA] Calculate Pi!
Post by: MyndFyre on November 16, 2005, 10:55:25 pm
Perhaps, but there's also a 2:1 mapping! :P
Title: Re: [JAVA] Calculate Pi!
Post by: Joe on November 16, 2005, 11:23:40 pm
e is like pi, I believe. My ti-83 says it's approximately 2.71828182. If by "like infinity" you mean not a number, then no, it's a number. It's more like Pi in that they are both irrational numbers. I would, however, relate it more closely to phi (phi is approximately 1.618...), because both were discovered frequently in nature. Phi is a very interresting number.

-EDIT-
Quote
The only possible way I could think to produce ∞ from an equation would be x*0=0. But as that is undefined, I do not see any other way.
x*0 equals 0. It's defined as 0, isn't it? anything * 0 is 0, or so I thought.

I think those things have already been mentioned. :P

x * 0 = 0 is one way to think of infinitie, but since you can't devide by zero due to mathematical laws, it's undefined, not infinite.


Technically, dividing something means splitting it into equal piles. A good way of thinking of this is dealing cards. How do you deal cards to 0 people?
52/0 = 0R52 (you didn't give anyone any cards) = 1.

Division by 0 equals 1.
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 16, 2005, 11:43:59 pm
Technically, dividing something means splitting it into equal piles. A good way of thinking of this is dealing cards. How do you deal cards to 0 people?
52/0 = 0R52 (you didn't give anyone any cards) = 1.

Division by 0 equals 1.

No, division by 0 = undefined.  Try it on any calculator.  That's why there's an error in games and things of this nature that reads "Error: Cannot divide by 0."

Lern 2 do math
Title: Re: [JAVA] Calculate Pi!
Post by: iago on November 16, 2005, 11:48:32 pm
e is like pi, I believe. My ti-83 says it's approximately 2.71828182. If by "like infinity" you mean not a number, then no, it's a number. It's more like Pi in that they are both irrational numbers. I would, however, relate it more closely to phi (phi is approximately 1.618...), because both were discovered frequently in nature. Phi is a very interresting number.

-EDIT-
Quote
The only possible way I could think to produce ∞ from an equation would be x*0=0. But as that is undefined, I do not see any other way.
x*0 equals 0. It's defined as 0, isn't it? anything * 0 is 0, or so I thought.

I think those things have already been mentioned. :P

x * 0 = 0 is one way to think of infinitie, but since you can't devide by zero due to mathematical laws, it's undefined, not infinite.


Technically, dividing something means splitting it into equal piles. A good way of thinking of this is dealing cards. How do you deal cards to 0 people?
52/0 = 0R52 (you didn't give anyone any cards) = 1.

Division by 0 equals 1.
By your example, you'd be giving out cards forever, because you'd be sitting there with the deck giving one to each of the 0 people.  So your deck would never lose a card.  So it would work out to infinity, or undefined, depending on how long you sit around, I suppose..
Title: Re: [JAVA] Calculate Pi!
Post by: Sidoh on November 17, 2005, 12:28:49 am
By your example, you'd be giving out cards forever, because you'd be sitting there with the deck giving one to each of the 0 people.  So your deck would never lose a card.  So it would work out to infinity, or undefined, depending on how long you sit around, I suppose..

Hehe, exactly. :D
Title: Re: [JAVA] Calculate Pi!
Post by: rabbit on November 17, 2005, 08:44:49 pm
e is like pi, I believe. My ti-83 says it's approximately 2.71828182. If by "like infinity" you mean not a number, then no, it's a number. It's more like Pi in that they are both irrational numbers. I would, however, relate it more closely to phi (phi is approximately 1.618...), because both were discovered frequently in nature. Phi is a very interresting number.

-EDIT-
Quote
The only possible way I could think to produce ∞ from an equation would be x*0=0. But as that is undefined, I do not see any other way.
x*0 equals 0. It's defined as 0, isn't it? anything * 0 is 0, or so I thought.

I think those things have already been mentioned. :P

x * 0 = 0 is one way to think of infinitie, but since you can't devide by zero due to mathematical laws, it's undefined, not infinite.


Technically, dividing something means splitting it into equal piles. A good way of thinking of this is dealing cards. How do you deal cards to 0 people?
52/0 = 0R52 (you didn't give anyone any cards) = 1.

Division by 0 equals 1.
Division is more accurately described as "division among/between".  IE: Division by 1 means "division among 1", and thus the source remains whole, as it all goes to 1 "thing".