Skip to content

MANE 3351

Lecture 2

Classroom Management

Agenda

  • Questions
  • Review 1st day
  • Introduction to Python
  • Discuss lab today
  • Call roll

Resources

Handouts


Assignments

  • Create free GitHub account

Git

git

Source


GitHub

gitHub

  • Source
  • Most laboratories will be distributed through gitHub
  • Classroom material will also be available through gitHub
  • Easiest approach is download on PC or Mac using gitHub Desktop (pre-installed on Raspberry Pi)

GitHub Desktop

gitHub Desktop

  • Source
  • Graphical interface that makes using GitHub very easy to use
  • Downloading lecture materials
    • First use: clone repository
    • Subsequent uses: pull repository (will update local material)
  • Please do not push
  • Demonstrate using Standard Normal Case 1 from github.com/douglastimmer/MANE3351_Fall2024

Python with Jupyter Notebook

  • Standard Normal Case 1
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as sct
import math

a=0.5

x=np.linspace(-4,4,500)
y=sct.norm.pdf(x,0,1)
y2=0.0*x
maske =(x<a)

plt.plot(x,y,'b')
plt.fill_between(x,y,color='#666666',where=maske)
plt.plot(x,y2,'b')
plt.show()

answer=sct.norm.cdf(a,0,1)
print ("%8.6f" % (answer))

First 4 Lines

  • Imports allow external packages to be used
  • Most standard packages are included in the Anaconda installation
  • Matplotlib "is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. Matplotlib can be used in Python scripts, the Python and IPython shells, the Jupyter notebook, web application servers, and four graphical user interface toolkits"
  • NumPy "is the fundamental package for scientific computering with Python. It contains amont other things: 1). a powerfull N-dimensional array object, 2). sophisticated (broadcasting) functions, 3. tools for integrating C/C++ and Fortran code, and 4). usefull linear algebra, Fourier transform, and random number capabilities."
  • SciPy "is a Python-based ecosystem of open-source software for mathematics, science, and engineering. In particular, these are some of the core packages: NumPy, SciPy library, Matplotlib, IPython, Sympy, and pandas."
  • Math "provides access to the mathematical functions defined by the C standard."

Python Libraries


Numpy Linspace

Numpy Linspace

  • Source
  • Experiment with endpoint

scipy.stats.norm

scipy stats norm

Source


Matplotlib

matplotlib

Source