Created
July 17, 2014 08:26
-
-
Save Wesitos/e95243624a71fb52659a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division #no probs with division | |
#from math import exp | |
#A partir de ahora importaremos las funciones matematicas desde numpy | |
from numpy import exp | |
#Asi, la vida es bella | |
#e:epsilon, v:nu, d: delta, a: alpha | |
def QF(e,v,pd,d): | |
def foo (m,a): | |
expterm = 1-exp(-2*(a**2)/m) | |
f1 = expterm + pd | |
f2_2 = -2*((expterm/f1)*(1-d)*(2*v-1))**2 | |
f2 = 1 - exp(f2_2) | |
return (1-f1*f2)**m - e | |
return foo | |
#Wesitos was here | |
#La funcion que queremos es... | |
quantum_foo = QF(1E-6,0.98,4E-8,0.92) | |
if __name__ == "__main__": | |
import numpy as np | |
import matplotlib.pyplot as plt | |
#samples: Cantidad de puntos a usar | |
samples = (1000,1000) | |
ran_m = (1, 1.5E5) | |
ran_a = (1, 1E2) | |
#step: los pasos para cada valor | |
step_m = (ran_m[1]-ran_m[0])/samples[0] | |
step_a = (ran_a[1]-ran_a[0])/samples[1] | |
#Hacemos una rejilla de valores | |
M, A = np.meshgrid(np.arange(ran_m[0], ran_m[1], step_m), | |
np.arange(ran_a[0], ran_a[1], step_a)) | |
#Hallemos las imagenes de esos valores | |
F = quantum_foo(M,A) | |
#Grafiquemos el contorno | |
cs = plt.contour(M, A, F, [0]) | |
#La etiqueda de curva de nivel | |
plt.clabel(cs) | |
#Etiquetas de ejes | |
plt.xlabel("m") | |
plt.ylabel("alfa") | |
#Show yourself! | |
plt.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment