Archived

This topic is now archived and is closed to further replies.

[java] Concurrency in java.

This topic is 5148 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites