Create a file
Hello, world.
Put on the first line of your file the line
#!/bin/sh
(no spaces before the "#").
Do an
kepler> hello.sh
Hello, world
Check out the Python Programming Language Official Website. [Note: We will focus on Python 2, as it seems to be the Departmental default.] Go through the tutorial. http://docs.python.org/2/tutorial/ http://www.python.org/doc/essays/ppt/sd99east/sld004.htm
Create a file
python hello.py
such that it simply prints out
Hello, world.
Write a python script
Run through the matplotlib python plotting tutorial. Start off by plotting y=sin(x*x) in domain x=[0...10]
Then create a two column text file
Hints: start off your script with something like this
import matplotlib as plt
from pylab import *
import numpy as np
x, y = loadtxt('init.dat', unpack=True, usecols=[0,1])
That'll get things started with data loaded into arrays x and y
from your text datafile.
Other things that might help: plot(x,y) plotted the connected the
dots; matplotlib axis function helped adjust the domain and range
(try "plt.axis"); xlabel(), ylabel(), and title() functions set the axis
labels and title, respectively (ok pretty obvious); and
finally savefig('filename.png') saved the figure to the specified file
using a formation (PNG) indicated by the file extension (.png).
Write a python script that generates 10000 realizations of a normal variate. Plot a histogram of it. Estimate the mean, variance, skewness and kurtosis from your sample.
Focusing only on the kurtosos, examine a variate
X = np.sum(np.random.univariate(-1,1,N))Try with N = 1,3,10,30... to see how many terms are needed for the statistics of X to be approximately Gaussian?