reset password
Author Message
Arnav98
Posts: 48
Posted 23:54 Mar 10, 2017 |

Does the Pi output values for this question for all the cases should come out to be exactly the same ? The values im getting are close but not the same as in sample output.

jzunig20
Posts: 38
Posted 23:58 Mar 10, 2017 |

yeah they should i got the exact numbers from the sample output. 

try showing the sum for i=1 to i =5 (maybe less numbers if you're' lazy) and calculate by hand(calculator) to see if you getting the same solution on java that you get on your calculator 

fengus97
Posts: 18
Posted 03:38 Mar 12, 2017 |

Is everyone getting the exact values?

bliu14
Posts: 10
Posted 04:02 Mar 12, 2017 |

My values are a little different than his are. Mine approach PI from the positive side while his approach it from the negative side. I'm not sure if this is acceptable, but I'll be working out the differences tomorrow.

fengus97
Posts: 18
Posted 04:06 Mar 12, 2017 |
bliu14 wrote:

My values are a little different than his are. Mine approach PI from the positive side while his approach it from the negative side. I'm not sure if this is acceptable, but I'll be working out the differences tomorrow.

my values are a bit higher like 3.1416......... I cant seem to figure out how to make them match...

bliu14
Posts: 10
Posted 13:27 Mar 12, 2017 |

I fixed my code. I was accidentally printing the value for the sum before adding the ith term, so my approximations were for i=9999 etc. Note that for even i values, the sum should be less than pi. Thanks!

fengus97
Posts: 18
Posted 14:00 Mar 12, 2017 |
bliu14 wrote:

I fixed my code. I was accidentally printing the value for the sum before adding the ith term, so my approximations were for i=9999 etc. Note that for even i values, the sum should be less than pi. Thanks!

That helped a lot thanks!