Python Lab 9

Math 152 – Python Lab 9

Directions: Use Python to solve each problem. (Template link)

1. Given the power series X∞

n=1

(−1)n+1 (−2 + 4x

2

)

n

4

n n

:

(a) Simplify

an+1

an

and find the limit n → ∞. (NOTE: Python handles it better if you define

bn = |an| and use that instead)

(b) State the radius of convergence and the endpoints. If applicable, substitute to show

whether each endpoint is in the interval of convergence or not.

(c) It can be shown that the series converges to f(x) = ln

2x

2 + 1

2

on its interval of

convergence. To illustrate this, find s5, s10, and s15. Plot these three polynomials and f

on the same set of axes in the window x ∈ [−3, 3] , y ∈ [−1, 2].

2. Given the power series X∞

n=0

(−1)n√

πx2n+1

(2n + 1)n!

:

(a) Simplify

an+1

an

and find the limit n → ∞.

(b) State the radius of convergence and the endpoints. If applicable, substitute to show

whether each endpoint is in the interval of convergence or not.

(c) It can be shown that the series converges to f(x) = √

π

Z x

0

e

−t

2

dt on its interval of

convergence. To illustrate this, find s5, s10, and s15. Plot these three polynomials and f

on the same set of axes with domain x ∈ [−10, 10] and domain y ∈ [−2, 2].

(d) Notice that Z

e

−t

2

dt cannot be integrated using standard techniques, but the series can

be used to approximate values of the definite integral in f for any value of x. Use s100

to obtain a decimal approximation for f(5). (NOTE: from the graph that this is a pretty

good approximation for Z ∞

0

e

−t

2

dt)

Compare your answer with the decimal approximation for π

2

. What do you notice?

(Problems continued on next page…)

© 2023 TAMU Department of Mathematics MATH 152 Python Lab 9: Page 1 of 2

3. The power series J1(x) = X∞

n=0

(−1)n x

2n+1

n! (n + 1)! 22n+1 is called the Bessel function of order 1. The

Bessel function measures the radial part of the vibration of a circular drumhead.

(a) What is the radius of convergence of the series?

(b) Graph the first five partial sums on a common axis with domain x ∈ (0, 5) and range

y ∈ (−0.6, 0.6).

(c) The command for the Bessel function in Python is besselj(n,x) where n is the order of

the curve and x is the variable. Plot the first five orders of Bessel functions.

(d) Plot the first order Bessel function and at least the first five partial sums on the same axes

to see how they approach J1. Use domain x ∈ (0, 5) and range y ∈ (−0.6, 0.6)

© 2023 TAMU Department of Mathematics MATH 152 Python Lab 9: Page 2 of 2