. : News : . . : Message of the Week : .
You are currently viewing an archive of the Wilderness Guardians clan's IPB1 forums.

These forums were used by WG from 2008 to 2011, and now exist for historical and achival purposes only.

For the clan's current forums, CLICK HERE.
"You are a Wilderness Guardian. That northern wasteland; that land of blood, desolation and death is your dominion. Tonight we are going home."
~His Lordship
War Alert: OFF Raid Alert: OFF
PM a WG Official
 JAVA HELP ME NEED!
Posted: October 13, 2008 07:00 pmTop
   
User Avatar

IRC Nickname: Matt|Georgio9
Group: Emeritus
Posts: 706
Member No.: 94
Joined: January 3, 2008
Total Events Attended: 0
Ok, so something is totally frigged up but I can't figure out what. I'm programming a Taylor series to calculate the value of Pi using the Liebniz formula.

user posted image

Ok so that's not that hard to program in java. But I'm having problems getting the code to stop running. I end up with it just oscillating between 2 numbers for forever.

CODE

// Uses the Leibniz formula for pi with floats
       public static float slowPiCalculator()
       {
           float Pi = 0;      // Sum total
           float PreviousSum;    // Sum of the term (count - 1)
           float SummationValue = 0;    // calculated value to add onto Pi
           
           
           do{
               /* Determine if the numerator of the summation value is postive
                * or negative. Then divide the numerator by two times the
                * value of the counter plus 1
                */
               PreviousSum = Pi;
               
               SummationValue = (float)(Math.pow((-1.0), (float)count));
               SummationValue = SummationValue / (float) (2 * (float)count +1);
               
               
                   Pi += SummationValue;   // Add onto the sum of what becomes Pi
                   System.out.println("Counter: " + count + "\tSummationValue" + SummationValue + "\tPi: " + Pi);
                   count++;
                                             
           }while(PreviousSum != Pi);
           
           Pi = Pi * 4;    //Multiply by 4 to complete the summation.
           
           
           return Pi;
       }




 
--------------------
user posted imageuser posted image

Posted: October 13, 2008 07:08 pmTop
   
User Avatar

IRC Nickname: leecable
Group: Banned
Posts: 1938
Member No.: 410
Joined: April 1, 2008
Total Events Attended: 178
Is Pi not an infinite number?
 
--------------------
user posted image
user posted image user posted image

Posted: October 13, 2008 07:47 pmTop
   
User Avatar

IRC Nickname: Kiwi011
Group: Emeritus
Posts: 3052
Member No.: 40
Joined: December 30, 2007
Total Events Attended: 21
QUOTE (leecable @ October 13, 2008 07:08 pm)
Is Pi not an infinite number?

no it ends.....its just such a small decimal that we only use 3.14 and finding it is useless in all maths until you reach a higher level....
 
--------------------
user posted image

Posted: October 13, 2008 07:56 pmTop
   
User Avatar

IRC Nickname: Woolachee
Group: Clan Friend
Posts: 165
Member No.: 688
Joined: May 24, 2008
Total Events Attended: 22
the record of most digits calculated is 206,158,430,000 digits...

if that helps at all.
 
--------------------
user posted image
user posted image

Posted: October 13, 2008 08:01 pmTop
   
User Avatar

IRC Nickname: Matt|Georgio9
Group: Emeritus
Posts: 706
Member No.: 94
Joined: January 3, 2008
Total Events Attended: 0
I need it to stop summing once the term for Pi at count n is the same as the term for Pi at term (n -1).

So basically, when i start going outside the precision of a floating point.
 
--------------------
user posted imageuser posted image

Posted: October 13, 2008 08:25 pmTop
   
User Avatar

IRC Nickname: leecable
Group: Banned
Posts: 1938
Member No.: 410
Joined: April 1, 2008
Total Events Attended: 178
QUOTE (Kiwi011 @ October 13, 2008 02:47 pm)
QUOTE (leecable @ October 13, 2008 07:08 pm)
Is Pi not an infinite number?

no it ends.....its just such a small decimal that we only use 3.14 and finding it is useless in all maths until you reach a higher level....

Your obviously not at that 'higher' level you talk about. Because I was 10 when i was taught that Pi is infinite. Pi is an irrational number. Irrational numbers are numbers that do not terminate or repeat when written out as a decimal.

 
--------------------
user posted image
user posted image user posted image

Posted: October 14, 2008 03:05 pmTop
   
User Avatar

IRC Nickname: Samurai-JM
Group: Emeritus
Posts: 3204
Member No.: 117
Joined: January 11, 2008
Total Events Attended: 8
QUOTE (leecable @ October 13, 2008 03:25 pm)
QUOTE (Kiwi011 @ October 13, 2008 02:47 pm)
QUOTE (leecable @ October 13, 2008 07:08 pm)
Is Pi not an infinite number?

no it ends.....its just such a small decimal that we only use 3.14 and finding it is useless in all maths until you reach a higher level....

Your obviously not at that 'higher' level you talk about. Because I was 10 when i was taught that Pi is infinite. Pi is an irrational number. Irrational numbers are numbers that do not terminate or repeat when written out as a decimal.

lol, useless like finding stuff about circles? ever take a manufacturing or engineering class? try making a building without circular columns lol.

disregard that, 22/7 isn't equal to pi. pi is irrational. want me to post the first 100,000 places to prove it? biggrin.gif how bout the first 10 million? veryevilgrin.gif
 
--------------------
-=}¤- Vi Veri Veniversum Vivus Vici -¤{=-
user posted image

W I N N I N G

Posted: October 14, 2008 09:58 pmTop
   
User Avatar

IRC Nickname: Kiwi011
Group: Emeritus
Posts: 3052
Member No.: 40
Joined: December 30, 2007
Total Events Attended: 21
QUOTE (leecable @ October 13, 2008 08:25 pm)
QUOTE (Kiwi011 @ October 13, 2008 02:47 pm)
QUOTE (leecable @ October 13, 2008 07:08 pm)
Is Pi not an infinite number?

no it ends.....its just such a small decimal that we only use 3.14 and finding it is useless in all maths until you reach a higher level....

Your obviously not at that 'higher' level you talk about. Because I was 10 when i was taught that Pi is infinite. Pi is an irrational number. Irrational numbers are numbers that do not terminate or repeat when written out as a decimal.

Actually I feel somewhat stupid now.

I think I remember doing a proof way back in precalc or geometry with it and I found a way to make pi end.......

I think its like the .9999999999999 repeating really is 1 if you proof it...... idk maybe im wrong....
 
--------------------
user posted image

Posted: October 15, 2008 01:58 amTop
   
User Avatar

IRC Nickname: Matt|Georgio9
Group: Emeritus
Posts: 706
Member No.: 94
Joined: January 3, 2008
Total Events Attended: 0
QUOTE (Kiwi011 @ October 14, 2008 09:58 pm)
QUOTE (leecable @ October 13, 2008 08:25 pm)
QUOTE (Kiwi011 @ October 13, 2008 02:47 pm)
QUOTE (leecable @ October 13, 2008 07:08 pm)
Is Pi not an infinite number?

no it ends.....its just such a small decimal that we only use 3.14 and finding it is useless in all maths until you reach a higher level....

Your obviously not at that 'higher' level you talk about. Because I was 10 when i was taught that Pi is infinite. Pi is an irrational number. Irrational numbers are numbers that do not terminate or repeat when written out as a decimal.

Actually I feel somewhat stupid now.

I think I remember doing a proof way back in precalc or geometry with it and I found a way to make pi end.......

I think its like the .9999999999999 repeating really is 1 if you proof it...... idk maybe im wrong....

Pi does not terminate. No super computer has been able to compute its end and I have never seen a proof which shows the termination of Pi. There is no way you'd do that in precalc.

I'm in second year university for engineering and you will learn that Pi shows up in all sorts of places and about how messed up the value of Pi really is.

For example....this assumes that you know what complex numbers are.

Well on a normal Real numbers plane, if you add 2Pi or 2kPi where k is an integer value, onto any angle on the plane, you will end up at the same spot.

However, on a complex plane, if you add 2kPi to an angle, you will end up on a totally different plane than where you started.

But thats more of a complex numbers example than a Pi example but its still very cool/messed up at the same time.

Oh ya,

e^iPi = -1

Can remember the proof but its true.
 
--------------------
user posted imageuser posted image

Posted: October 15, 2008 02:10 amTop
   
User Avatar

IRC Nickname: Kiwi011
Group: Emeritus
Posts: 3052
Member No.: 40
Joined: December 30, 2007
Total Events Attended: 21
QUOTE (Georgio9 @ October 15, 2008 01:58 am)
QUOTE (Kiwi011 @ October 14, 2008 09:58 pm)
QUOTE (leecable @ October 13, 2008 08:25 pm)
QUOTE (Kiwi011 @ October 13, 2008 02:47 pm)
QUOTE (leecable @ October 13, 2008 07:08 pm)
Is Pi not an infinite number?

no it ends.....its just such a small decimal that we only use 3.14 and finding it is useless in all maths until you reach a higher level....

Your obviously not at that 'higher' level you talk about. Because I was 10 when i was taught that Pi is infinite. Pi is an irrational number. Irrational numbers are numbers that do not terminate or repeat when written out as a decimal.

Actually I feel somewhat stupid now.

I think I remember doing a proof way back in precalc or geometry with it and I found a way to make pi end.......

I think its like the .9999999999999 repeating really is 1 if you proof it...... idk maybe im wrong....

Pi does not terminate. No super computer has been able to compute its end and I have never seen a proof which shows the termination of Pi. There is no way you'd do that in precalc.

I'm in second year university for engineering and you will learn that Pi shows up in all sorts of places and about how messed up the value of Pi really is.

For example....this assumes that you know what complex numbers are.

Well on a normal Real numbers plane, if you add 2Pi or 2kPi where k is an integer value, onto any angle on the plane, you will end up at the same spot.

However, on a complex plane, if you add 2kPi to an angle, you will end up on a totally different plane than where you started.

But thats more of a complex numbers example than a Pi example but its still very cool/messed up at the same time.

Oh ya,

e^iPi = -1

Can remember the proof but its true.

yea the last thing you said what I was talking about i think.

If only I payed more attention in math lul.
 
--------------------
user posted image

Posted: October 15, 2008 03:48 amTop
   
User Avatar

IRC Nickname: Matt|Georgio9
Group: Emeritus
Posts: 706
Member No.: 94
Joined: January 3, 2008
Total Events Attended: 0
Lol k.

On another note i solved my problem. Turns out I wasn't getting the full effect of number truncation so what I did was I casted the value to a float at the very end of the calculation.
 
--------------------
user posted imageuser posted image