Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

2 Visitor Messages

  1. Instead of alternating operations, I did it by putting both operations in one loop and adding 2 inbetween like so:

    	double factor = 0;
    	int count = 0;
     
    	for(int i = 1;i<=3000000;i+=2) {
    		count+=2;
    		double addend = (1.0/i);
    		i+=2;
    		addend-=(1.0/i);
    		factor+=addend;
    		System.out.println(count + ": 4*"+factor+" = " + 4*factor);
     
    	}

    That will print ALOT of them, so don't use that loop probably, change the delimiter part, or put an if(count>=30000) break; since i is not a count of factors added
  2. View Conversation
    pi=4*(1-1/3+1/5-1/7+1/9-1/11+1/13+...)
    please help me in getting this code implemented.. i dont have any clue on how to start this..
    i know that in the loop you need to add 2 in the denominator but i have no idea on how to implement alternating operations
Showing Visitor Messages 1 to 2 of 2
About Zula

Basic Information

About Zula
Location:
Denver, CO

Statistics


Total Posts
Total Posts
55
Posts Per Day
0.04
Visitor Messages
Total Messages
2
Most Recent Message
November 4th, 2010 10:40 PM
Total Thanks
Total Thanks
1
  • Thanked 30 Times in 29 Posts
General Information
Last Activity
February 7th, 2012 12:30 AM
Join Date
October 28th, 2010

1 Friend

  1. javapenguin javapenguin is offline

    Banned

    • Send a message via ICQ to javapenguin
    • Send a message via MSN to javapenguin
    • Send a message via AIM to javapenguin
    • Send a message via Yahoo to javapenguin
    javapenguin
Showing Friends 1 to 1 of 1