Question

The following function computes by summing the Taylor series expansion to n terms. Write a program...

The following function computes e^x by summing the Taylor series expansion to n terms. Write a program to print a table of e^x using both this function and the exp() function from the math library, for x = 0 to 1 in steps of 0.1. The program should ask the user what value of n to use. (PLEASE WRITE IN PYTHON)

    def taylor(x, n): 
        sum = 1
        term = 1
        for i in range(1, n):
            term = term * x / i
            sum = sum + term
        return sum
0 0
Add a comment Improve this question Transcribed image text
Answer #1

n = input("Enter a number: ")

print (taylor(0,n))

print (taylor(0.1,n))

print (taylor(0.2,n))

print (taylor(0.3,n))

print (taylor(0.4,n))

print (taylor(05,n))

print (taylor(0.6,n))

print (taylor(0.7,n))

print (taylor(0.8,n))

print (taylor(0.9,n))

print (taylor(1,n))

Add a comment
Know the answer?
Add Answer to:
The following function computes by summing the Taylor series expansion to n terms. Write a program...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT