Skip to content
DeepForgeby svx
All problems
EasyCalculusca-099

Taylor Remainder Bound

Problem

For f(x) = e^x expanded about 0, the Lagrange remainder after the degree-n term on [0, a] satisfies |R_n| <= e^a * a^(n+1) / (n+1)!.

Return this bound for a >= 0 and n >= 0.

Hint

The bound uses the maximum of the (n+1)-th derivative on the interval, which is e^a for e^x.

Test cases

case 1
in: [1,5]
expected: 0.0037753914284153404
case 2
in: [0,10]
expected: 0
case 3
in: [2,3]
expected: 4.9260373992871
case 4
in: [0.5,4]
expected: 0.0004293544975781584
Starter codePython
def taylor_remainder_bound(a, n):
    # Your code here
    pass

4 test cases · run your code against them in the editor