import numpy as np
x0=0
x1=25000
x2=50000
x3=75000
x4=100000
x5=125000

y0=9.8100
y1=9.7335
y2=9.6578
y3=9.5830
y4=9.5091
y5=9.4361

v=62500

A=np.array([[1,x0,x0**2,x0**3,x0**4,x0**5],
            [1,x1,x1**2,x1**3,x1**4,x1**5],
            [1,x2,x2**2,x2**3,x2**4,x2**5],
            [1,x3,x3**2,x3**3,x3**4,x3**5],
            [1,x4,x4**2,x4**3,x4**4,x4**5],
            [1,x5,x5**2,x5**3,x5**4,x5**5]])

B=np.array([y0,y1,y2,y3,y4,y5])

Coef=np.linalg.solve(A,B)

a0=Coef[0]
a1=Coef[1]
a2=Coef[2]
a3=Coef[3]
a4=Coef[4]
a5=Coef[5]

s=a0+a1*v+a2*v**2+a3*v**3+a4*v**4+a5*v**5

print("La gravedad para una altura de v",v,"es",s)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: