WSQ14 – Estimating e

Background

creative commons licensed (BY-NC-SA) flickr photo by gail m tang: http://flickr.com/photos/gailtang/2786292212

creative commons licensed (BY-NC-SA) flickr photo by gail m tang: http://flickr.com/photos/gailtang/2786292212

In this assignment you will estimate the mathematical constant e. You should create a function called calculuate_e which receives one parameter called precision that should specify the number of decimal points of accuracy.

 

What to Do

You will want to use the infinite series to calculate the value, stopping when the accuracy is reached (previous and current calculation are the same at the specified accuracy).

From http://en.wikipedia.org/wiki/E_%28mathematical_constant%29

From http://en.wikipedia.org/wiki/E_%28mathematical_constant%29

While calculating the estimate, you may need to truncate the “extra” decimals after precision number of digits.¬† This answer on StackOverflow may help (you probably want to use floor instead of ceiling): http://stackoverflow.com/a/11209099

What to Submit

As usual, create a blog post explaining what you did, where you found resources (books, videos, web pages, friends) to help you solve this. Remember to put the tag #WSQ14 on your post so our blog hub picks that up.

You should include your code as a link to GitHub.

And of course, leave any questions here as well as asking those questions on Twitter with the hashtag #TC1017 so we all see your question posted there.

CC BY 4.0 WSQ14 – Estimating e by Ken Bauer is licensed under a Creative Commons Attribution 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.