You are on page 1of 3

Jupyter QtConsole 4.2.

1
Python 2.7.13 |Anaconda 4.3.0 (64-bit)| (default, Dec 19 2016, 13:29:36) [MSC v.1500 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.


? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

In [1]:

In [1]: from sympy import *

In [2]: import math as mp

In [3]: import matplotlib.pyplot as plt

In [4]: T = Symbol("T")

In [5]: E = Symbol("E")

In [6]: from scipy.integrate import quad

In [7]: e = -1.6*( 10**(-19))

In [8]: Tau = 1*(10**(-15)) #Relax. Time

In [9]: Kb = 8.617*10**(-5) # Boltzman constant

In [10]: M = 9.1*(10**(-31)) #mass of electron

In [11]: m = 0.26*M #effective mass of electron

In [12]: v = 2.3*(10**(5)) #velocity of electron

In [13]: h = 6.6*(10**(-34)) #plank constant

In [14]: pi = 3.14

In [15]: hc = h/(2*pi) # h bar

In [16]: Ef=0.56 #fermi energy

In [17]: L = (2*(pi)**(2)*(hc)**3)

In [18]: S = ((e**2)*Tau*(v**2)*(2*m)**(3/2))

In [19]: X = S/L

In [20]: F = 1/((exp(E - Ef)/Kb*T)+1) #fermi dis. function

In [21]: Deriv = -diff(F,E) # diff. of F w.r.t. energy

In [22]: New = X*Deriv * sqrt(E)

In [23]: print New


1.85582577950551e+32*sqrt(E)*T*exp(E)/(6628.86229370796*T*exp(E) + 1)**2

In [24]: for T in range(100,500,50):


...: sum = 1.85582577950551e+32*sqrt(E)*T*exp(E)/(6628.86229370796*T*exp(E) + 1)**2
...: print sum
...:
1.85582577950551e+34*sqrt(E)*exp(E)/(662886.229370796*exp(E) + 1)**2
2.78373866925826e+34*sqrt(E)*exp(E)/(994329.344056194*exp(E) + 1)**2
3.71165155901102e+34*sqrt(E)*exp(E)/(1325772.45874159*exp(E) + 1)**2
4.63956444876377e+34*sqrt(E)*exp(E)/(1657215.57342699*exp(E) + 1)**2
5.56747733851653e+34*sqrt(E)*exp(E)/(1988658.68811239*exp(E) + 1)**2
6.49539022826928e+34*sqrt(E)*exp(E)/(2320101.80279779*exp(E) + 1)**2
7.42330311802204e+34*sqrt(E)*exp(E)/(2651544.91748318*exp(E) + 1)**2
8.35121600777479e+34*sqrt(E)*exp(E)/(2982988.03216858*exp(E) + 1)**2
In [25]: def f(E):
...: return 1.85582577950551e+34*sqrt(E)*exp(E)/(662886.229370796*exp(E) + 1)**2
...:

In [26]: def trapez(f,a,b,n):


...: h = (b-a)/n
...: sum = 0
...: E = 0.5*h
...: for i in range (1,n):
...: sum = sum + h*f(E)
...: E = E + h
...: return sum
...: print trapez(f,0.0,2.0,1000)
...:
2.76264139481550e+22

In [27]: for T in range(100,500,50):


...: def f(E):
...: return 1.85582577950551e+32*sqrt(E)*T*exp(E)/(6628.86229370796*T*exp(E) + 1)**2
...:

In [28]: for T in range(100,500,50):


...: def f(E):
...: return 1.85582577950551e+32*sqrt(E)*T*exp(E)/(6628.86229370796*T*exp(E) + 1)**2
...: def trapez(f,a,b,n):
...: h = (b-a)/n
...: sum = 0
...: E = 0.5*h
...: for i in range (1,n):
...: sum = sum + h*f(E)
...: E = E + h
...: return sum
...: print trapez(f,0.0,2.0,1000)
...:
2.76264139481550e+22
1.84176177615348e+22
1.38132164946899e+22
1.10505747190511e+22
9.20881311215337e+21
7.89326889997491e+21
6.90661062750033e+21
6.13920968174412e+21

In [29]: import numpy as np

In [30]: x=np.arange(100,500,50)

In [31]: x
Out[31]: array([100, 150, 200, 250, 300, 350, 400, 450])

In [32]: y=([27.64, 18.42, 13.82, 11.05, 9.21, 7.89, 6.91, 6.14])

In [33]: plt.plot(x,y)
Out[33]: [<matplotlib.lines.Line2D at 0xac39e48>]

In [34]: plt.xlabel("Temp in K")


Out[34]: <matplotlib.text.Text at 0xab21198>

In [35]: plt.ylabel("(sigma)*10**21")
Out[35]: <matplotlib.text.Text at 0xab35c18>

In [36]: plt.title("Conductivity v/s Temperature")


Out[36]: <matplotlib.text.Text at 0xab359b0>

In [37]: plt.show()
In [38]:

You might also like