heres the problem i made a code for sine(X) to calculate the taylor series but i need to change sine(x) for sine(x+1) but i dont know how to do it, heres the code i made

from math import sin as senopy

def factorial(numero):
    factorial = 1
    while (numero > 1):
        factorial = factorial * numero
        numero = numero - 1
    return factorial

def seno_taylor(x, precision=20) :    
    sum_seno = 0.0
    n = 0.0
    termino = 1.0
    while (n < precision) :
        termino = ((x**(2*n))) / (factorial (2*n))
        if (n % 2 == 0):
            sum_seno = sum_seno + termino
        else:
            sum_seno = sum_seno - termino
        n = n + 1
    return sum_seno

def prueba_seno_taylor(x, precision=20):
    a = 0
    print ("sin(x) ".rjust(20) + "error verdadero".rjust(20) + "error porcentual".rjust(20))
    while (a < precision):
        seno = seno_taylor(x,a)
        error = senopy(x) - seno
        error_porcentual = error / senopy(x) * 100
        print (str(seno).rjust(20)) + str(error).rjust(20) + str(error_porcentual).rjust(20)
        a = a + 1

PMJI, but is the problem one of finding the Taylor series for sin(x+1), instead of using the Taylor series for sin(x)?

Ask Wolfram Alpha for taylor series sin (x+1) and it will tell you roughly:

sin(x+1) = sin(1) + x*cos(1) - 1/2 * x^2 * sin(1) - 1/6 * x^3 * cos(1) + 1/24 * x^4 * sin(1) + ...

The pattern is obvious. What's not clear is if this answers the problem.

This question has already been answered. Start a new discussion instead.