Question: python -- this is euler.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- Estimation methods for the Euler Number __author__ = def series(n_terms=1000): Estimate e
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Estimation methods for the Euler Number"""
__author__ = ""
def series(n_terms=1000):
"""Estimate e with series: 1/1 + 1/1 + 1/(1*2) + 1/(1*2*3) + ..."""
pass
def limit(n_limit=1000):
"""Estimate e with limit: (1 + 1) ^ n"""
Pass

We briefly used another contant, also called Euler's number(e), which is the base of the natural logarithm and comes up very often in scientific formulas (e.g. Optimal Stopping, our classwork example) Just like , the constant e is transcendental, but its numerical value can be estimated by various methods. In this homework assignment we are going to use two alternative approximations. Series Approximation 00 e = 3+=++++++ 1 1.2 1 .+... 1.2.3 RO As you can see, you need to iteratively calculate a sum up until a given number of steps (n). Limit (Bernoulli) 11 (1+-)" n eslim 00 With this method, you need to evalute a mathematical expression with a given (n) paramter. With this method, you need to evalute a mathematical expression with a given (n) paramter. Tasks You are given a skeleton program (euler.py). You need to add the following parts: 1. Set the _author variable to your VUnetID (as a string) 2. Implement the series function, based on the formula above. First, remove the pass statement, and replace it with your algorithm. Do not forget to return the result. (40 pts) 3. Implement the limit function, based on the formula above. First, remove the pass statement, and replace it with your algorithm. Do not forget to return the result. (40 pts) 4. Add a small test program to the end of the file, but make sure your test code runs only if the script is executed at the top level (hint: programming idiom, as discussed in the Lecture). Your test code should print out the following output (use your own functions to calculate the results) (20 pts): name serien (10) - 2.7182815255731922 linit(1000000) 2.7182804690957534
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
