Intermediate Python: Using NumPy, SciPy and Matplotlib
Intermediate Python: Using NumPy, SciPy and Matplotlib
Lesson 19 ? Odds and Ends
1
Lambda Operator
? Python also has a simple way of defining a one-line function.
? These are created using the Lambda operator.
? The code must be a single, valid Python statement.
? Looping, if-then constructs, and other control statements cannot be use in Lambdas.
>>> bar = lambda x,y: x + y >>> bar(2,3) 5 >>> cube_volume = lambda l, w, h: l*w*h >>> cube_volume(2, 4.5, 7) 63.0
2
Physical Constants
? The scipy.constants module contains many physical constants!
3
Physical Constants
R alpha N_A k sigma
molar gas constant fine-structure constant Avogadro constant Boltzmann constant Stefan-Boltzmann constant
Wien Wien displacement law constant
Rydberg Rydberg constant m_e electron mass m_p proton mass m_n neutron mass
c mu_0
speed of light in vacuum the magnetic constant
epsilon_0
the electric constant (vacuum permittivity),
h
the Planck constant
hbar
the Planck constant divided by 2.
G
Newtonian constant of gravitation
g
standard acceleration of gravity
e
elementary charge
Always verify that they are in the correct units!!! 4
Examples
>>> import scipy.constants as sc >>> sc.c 299792458.0 >>> sc.h 6.62606957e-34 >>> sc.G 6.67384e-11 >>> sc.g 9.80665 >>> sc.e 1.602176565e-19
>>> sc.R 8.3144621 >>> sc.N_A 6.02214129e+23 >>> sc.k 1.3806488e-23 >>> sc.sigma 5.670373e-08 >>> sc.m_e 9.10938291e-31
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- homework 6 numpy and matplotlib
- numerical computing in python
- an introduction to numpy and scipy دانشگاه صنعتی شریف
- cs229 python numpy
- intermediate python using numpy scipy and matplotlib
- cheat sheet numpy python copy anasayfa
- installing numpy scipy opencv theano for python in vs
- an introduction to numpy and scipy virginia tech
- guide to numpy scipy
- numpy scipy pandas cheat sheet
Related searches
- scipy and numpy pdf
- join in python using on
- create a matrix in python using for
- using numpy array
- python install numpy linux
- update python using pip
- using numpy in python
- using numpy in jupyter notebook
- integration in python using numpy
- python 2d numpy array
- python import numpy as np
- python using and in if statement