

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!


: def funcion(x,y): return pow(x,2)+pow(y,2)
: def funcion(x,y): return pow(x,2)+pow(y,2)
def quadrature(f,ax,bx,ay,by): xi=[-0.9061798459, -0.5384693101, 0, 0.5384693101, 0.9061798459] wi=[0.2369268851, 0.4786286705, 0.5688888889, 0.4786286705, 0.2369268851]
#numero de puntos par aproximar n=len(xi) sumadoble= for i in range(n): for j in range(n): wii=0.5(bx-ax)wi[i] wjj=0.5(by-ay)wi[j] xii=0.5(bx-ax)xi[i]+0.5(ax+bx) yii=0.5(bx-ax)xi[j]+0.5(ay+by) sumadoble+=wiiwjjf(xii,yii) return sumadoble quadrature(funcion,0,1,0,1)
: import numpy as np import matplotlib.pyplot as plt x=[0, 102, 102, 53.92, 53.92, 102, 102, 0, 0, 48.08, 48.08, 0, 0] y=[0, 0, 6.86, 6.86, 247.14, 247.14, 300, 250, 247.14, 247.14, 6.86, 6.86, 0]
#calculando area suma= sumaMx= sumaMy=
for i in range(len(x)-1): suma+=(x[i]y[i+1]-x[i+1]y[i]) sumaMx+=(x[i]-x[i+1]) * (pow(y[i+1],2) + y[i+1] * y[i] + pow(y[i],2)) sumaMy+=(y[i]-y[i+1]) * (pow(x[i+1],2) + x[i+1] * x[i] + pow(x[i],2)) Mx=abs(sumaMx/6) My=abs(sumaMy/6) A=suma/ #calculando el centro de gravedad Cx=My/A Cy=Mx/A
print(f"EL AREA DE LA FIGURA ES A= { round(A,3) } "+" "+"m^2") print(f"EL CENTRO DE GRAVEDAD EN X ES= { round(Cx,3) } "+" "+"m") print(f"EL CENTRO DE GRAVEDAD EN Y ES= { round(Cy,3) } "+" "+"m")
# graficando la figura plt.plot(x,y,'o-',color='blue') plt.plot(Cx,Cy,'o',color='red') plt.grid() plt.show()
EL AREA DE LA FIGURA ES A= 4944.675 m^ EL CENTRO DE GRAVEDAD EN X ES= 59.767 m EL CENTRO DE GRAVEDAD EN Y ES= 188.713 m