[java] Concurrency in java.

Started by
1 comment, last by Jason64 20 years, 5 months ago
I''m trying to write a java program that calculates e to a specific number of decimal places using threads. It''s turning out to be a bit of a bitch..., has anybody got any ideas? I''ve implemented the standard algorithm for computing e which is: e = 1 + 1/(1!) + 1/(2!) + 1/(3!) + 1/(4!) + .... but im stuck at how to set it to work out a specific no. of decimal places since I can''t use any java libraries except .io I don;t want to be told exactly how to do it but if anyone has any clues or hints thaty would be cool.
Advertisement
If you need to run it to n decimal places, how about you just run the algorithm until none of the digits of the result up to n change, for like 10 or so iterations, then pronounce it done.
Since you''re using taylor polynomials to calculate e, then use the talyor error formula.

http://www.math.uiowa.edu/ftp/atkinson/ENA_Materials/Overheads/sec_1-2.pdf

If you go to page 3, he uses exactly your problem as an example: when estimating e to n decimal places, what is the minimum order of the taylor polynomial that is required.

This topic is closed to new replies.

Advertisement