EJERCICIO DE NARANJAS Y TORONJAS
#import numpy as np
norma_Nar_Tor = np.array([])
np.random.seed(84)
coeficientes_angulares_Nar_Tor = np.random.uniform(low=0.0, high=30.0, size=100)
for i_Citro in range(100):
norma_Nar_Tor = np.append(norma_Nar_Tor, np.linalg.norm(Y_cit - (coeficientes_angulares_Nar_Tor[i_Citro]*X_cit + b_cit)))
#import matplotlib.pyplot as plt
#plt.plot(Diametro_Toronja, Peso_Toronja)
#plt.legend(['DiamVsPesoToronja', 'DiamVsPeso_Toronja'])
#plt.plot(X_cit,Y_cit)
import matplotlib.pyplot as plt
plt.plot(Diametro_Toronja, Peso_Toronja, label='MuestreoToronjas')
plt.plot(X_cit,Y_cit,label='NumpyRLToronjas')
plt.plot(10,a_cit*10+b_cit,'*r')
plt.plot(14,a_cit*14+b_cit,'*r')
plt.xlabel('Diametro (cm)')
plt.ylabel('Peso (g)')
plt.title('Peso vs Diametro de toronjas')
plt.legend()
plt.show()
coeficientes_angulares_Nar_Tor
array([ 1.38122981, 11.10726948, 7.26954802, 18.85440015, 29.7033018 ,
3.91764148, 5.2076749 , 7.74942173, 12.551969 , 3.9305668 ,
8.71350376, 14.85918284, 29.01012944, 8.92169589, 19.55405809,
16.06838693, 26.61079143, 25.93794743, 28.21598469, 3.17499416,
18.39666959, 5.35772433, 2.22531178, 29.87798219, 10.68821932,
25.18423466, 19.14214247, 6.2887161 , 29.35280822, 4.15234091,
16.59669329, 8.00203135, 9.35075423, 9.92995032, 4.37492812,
24.62277514, 4.83352329, 14.95030108, 9.93094363, 5.84526794,
4.38982698, 20.60177977, 29.83857306, 8.54271236, 16.98575806,
3.60922643, 1.30088839, 4.73555879, 12.99042874, 11.31646296,
1.80529112, 18.74512405, 14.63389951, 12.35148368, 13.54604561,
16.5782834 , 28.04458097, 7.93242059, 0.53037966, 20.95237995,
24.22028342, 19.27028464, 15.82512199, 24.97090641, 10.53327999,
5.68690898, 0.51853556, 29.42174872, 24.33071825, 28.82385803,
0.3819315 , 8.4934502 , 6.8195916 , 0.0819661 , 10.4688358 ,
13.19444647, 5.44591159, 15.23479681, 8.48406917, 28.56142166,
14.24557119, 7.80117928, 9.27036974, 0.64138088, 8.48044443,
7.73803418, 28.43813469, 21.68796718, 24.87150158, 17.20375632,
3.69858194, 17.37570081, 16.32640469, 14.48051899, 18.16933564,
16.16087747, 13.14333856, 21.41787055, 9.52972023, 9.71313571])
b_cit
np.float64(17.007102876817726)