In [5]:
#SOLUCION POR CRUCE DE 2 CURVAS
#AUTOR: Diego Javier Mena Amado
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import newton
#Definimos limites de barrido
x = np.linspace(0, 5.5, 1000)
y = np.linspace(0, 1, 1000)
#Se cargan los estilos para las curvas
style = {'family' : 'bold italic','color' : 'blue','weight' : 'normal','size' : 14}
style1 = {'family' : 'bold italic','color' : 'green','weight' : 'normal','size' : 14}
style2 = {'family' : 'bold italic','color' : 'red','weight' : 'normal','size' : 14}
style3 = {'family' : 'bold italic','color' : 'red','weight' : 'normal','size' : 10}
plt.title('PUNTO SOLUCION ENTRE DOS ECUACIONES', fontdict=style3)
plt.text(4, 0.2, r'$\ Diego \ Javier \ Mena $', fontdict=style)
plt.text(4.3, 0.8, r'$\ Punto \ de \ corte $', fontdict=style2)
plt.text(2.2, 0.85, r'$\ 1-exp(-x)$', fontdict=style)
plt.text(3, 0.5, r'$\ x/5$', fontdict=style1)
plt.plot(x, 1-np.exp(-x), x, x / 5)
def f(x):
return 1-np.exp(-x) - x/5
solvePoint = newton(f, 5.0)
plt.text(4.8, 0.75, 'X=%f'% solvePoint, fontdict=style3)
plt.show()
In [ ]: