I have created the code for recurrence relationship for two coupled sequences but for some reason, I'm getting an error
Code:
import math
for x,y in range(1,3):
def Function_X_Y(x,y):
x_val = (-5*x*(n-2)) + (2*y*(n-1))
y_val = (3*y*(n-2)) - (4*x*(n-1)) + (4*y*(n-1))
return(x_val, y_val)
def coupled_sequence(n):
return Function_X_Y(x,y)
print(coupled_sequence(0))
print(coupled_sequence(1))
print(coupled_sequence(5))
#Expected output: print(coupled_sequence(0))
#>>> (1, 1)
#print(coupled_sequence(1))
#>>> (2, 2)
#print(coupled_sequence(5))
#>>> (246, 322)
Error
----> 5 for x,y in range(1,3):
6 def Function_X_Y(x,y):
7 x_val = (-5*x*(n-2)) + (2*y*(n-1))
TypeError: cannot unpack non-iterable int object
I have tried different ways to iterate over the given function with the help of for
loop, but can't get the expected output