Question
I need help with these 2 functions for python 3.x. Will post my current code and what the function is supposed to do below. Function
I need help with these 2 functions for python 3.x. Will post my current code and what the function is supposed to do below.
Function 1
def mycos_mod(x, tol=1e-8): """ compute cos(x) by summing taylor expansion at x0=j*pi, (for some integer j such that j*pi is closest to x), if j is even, then cos(x) = 1 + (x-x0)^4/4! + (x-x0)^8/8! + (x-x0)^12/12! + (x-x0)^16/16! + ... - (x-x0)^2/2! + (x-x0)^6/6! + (x-x0)^10/10! + ... ) if j is odd, multiply the above by -1. """ #if you can, apply the more efficient 'updating' method instead of direct sum term-by-term
Function 2
def mysin_mod(x, tol=1e-8): """ compute sin(x) by summing taylor expansion at x0=j*pi, (for some integer j such that j*pi is closest to x), if j is even, then sin(x) = (x-x0) - (x-x0)^3/3! + (x-x0)^5/5! +.... + (-1)^k*(x-x0)^(2k+1)/(2k+1)! + ... if n is odd, multiply the above by -1. """
If you can help me figure these out thatd be very helpful thanks.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started