1. ## decimal places

suppose iam to solve cos x = 2x to 5 decimal places using newton raphson method how many iterations do i need to perform?

2. I imagine that would depend on where your initial guess is - I am sure CB will give a better answer then that. Out of curiosity why do you need to know how many iterations to perform? Are you attempting to implement the function with a for loop rather then a while/do loop?

Regards Elbarto

3. yeah iam gonna implement using a for loop and ask the user to input the no of correct decimal places needed. so how am i gonna determine the no of correct decimal places at the current iteration?

4. Originally Posted by ilikec
yeah iam gonna implement using a for loop and ask the user to input the no of correct decimal places needed. so how am i gonna determine the no of correct decimal places at the current iteration?
What you do is include a condition that is tested after each iteration. Once the condition is true the program ends. You should think about what condition will end the program once you have achieved 5 decimal places of accuracy (Hint: Once you are correct to 5 decimal place, the fifth decimal place will no longer change).

5. i got it mr fantasitic. But isn't there a equation that i can use or does theory say that after say n iterations you get x no of decimal places correct?

6. Originally Posted by ilikec
i got it mr fantasitic. But isn't there a equation that i can use or does theory say that after say n iterations you get x no of decimal places correct?