-1
I’m trying to get a sequence of a recursive function, but it always returns me the overflow error.
import math
f = 1.5;
a = 100;
b = 10;
d = 1;
w = 3.76;
x1 = 0;
y1 = 0;
z1 = 0;
h = 10^-3;
for i in range (20000):
x1 = (1/6)*h**3*y1*b-(1/2)*h**3*y1*a*x1**2-(1/6)*h**3*d*b*x1+(1/6)*h**3*d**2*y1+(1/6)*h**3*d*a*x1**3-(1/6)*h**3*d*f*math.cos(z1)-(1/6)*h**3*f*math.sin(z1)*w+(1/2)*h**2*b*x1-(1/2)*h**2*d*y1;-(1/2)*h**2*a*x1**3+(1/2)*h**2*f*math.cos(z1)+h*y1+x1;
y1 = y1+h**3*y1*d*a*x1**2-(1/2)*h**3*a*x1**2*f*math.cos(z1)+(1/6)*h**3*w*d*f*math.sin(z1)+(1/6)*h**3*b**2*x1+(1/2)*h**3*a**2*x1**5-(1/6)*h**3*d**3*y1+(1/2)*h**2*y1*b+(1/2)*h**2*d**2*y1+h*b*x1-h*d*y1-h*a*x1**3+h*f*math.cos(z1)-h**3*a*x1*y1**2;-(1/3)*h**3*y1*d*b-(2/3)*h**3*b*a*x1**3+(1/6)*h**3*d**2*b*x1-(1/6)*h**3*d**2*a*x1**3-(3/2)*h**2*y1*a*x1**2;-(1/2)*h**2*d*b*x1+(1/2)*h**2*d*a*x1**3+(1/6)*h**3*b*f*math.cos(z1)+(1/6)*h**3*d**2*f*math.cos(z1)-(1/6)*h**3*f*math.cos(z1)*w**2;-(1/2)*h**2*d*f*math.cos(z1)-(1/2)*h**2*f*math.sin(z1)*w;
z1 = h*w+z1;
This is because the result of its mathematical operation is greater than Python can handle.
– JeanExtreme002