# (Solved) : P2 Write Python Function F N Returns Sympy Polynomial Degree 2n Taylor Expansion Cos X Fun Q41349804 . . .

Please use PYTHON to solve this.

P2) Write a Python function f(n) that returns a Sympy polynomial that is the degree 2n Taylor expansion of the cos x function. K2 T2n(x) = 1 – *. x2 + *- x4 + … + (-1)” ** -In xan (2n), +2n Print out these polynomials for n = 1,2,3,4,5 using sympy’s pprint command. Use Sympy to compute the integrals: I cos(x²)dx JO T2n(x2)dx for n = 1,2,3,4,5. Put the plots of these functions in one common matplotlib plot, so that they can be compared. Make the domain of the plot [-3.4, 3.4]. How big do you need to make n to ensure these two plots look the same on this domain? Show transcribed image text P2) Write a Python function f(n) that returns a Sympy polynomial that is the degree 2n Taylor expansion of the cos x function. K2 T2n(x) = 1 – *. x2 + *- x4 + … + (-1)” ** -In xan (2n), +2n Print out these polynomials for n = 1,2,3,4,5 using sympy’s pprint command. Use Sympy to compute the integrals: I cos(x²)dx JO T2n(x2)dx for n = 1,2,3,4,5. Put the plots of these functions in one common matplotlib plot, so that they can be compared. Make the domain of the plot [-3.4, 3.4]. How big do you need to make n to ensure these two plots look the same on this domain?