Python for Scientific Computing and Education

Source Code

  1. Introduction: Basic Python
  2. Data Analysis
  3. Easy Demo
  4. Education


Python Tutorial

Python for Scientific Computing and Education Tutorial Visual with Audio - June 8, 2010


Useful Links




Python Bootcamp


Software Carpentry: Introductory material on Python

If you need help with a Python problem, but don't know where to find the answer, maybe we can be of service. Contact us at


Source Code

  1. Introduction: Basic Python

    Download Zip File 1

    • Hello World
    • print "Hello World"
    • 3D Contour
    • from mpl_toolkits.mplot3d import axes3d
      import matplotlib.pyplot as plt
      fig = plt.figure()
      ax = axes3d.Axes3D(fig)
      X, Y, Z = axes3d.get_test_data(0.05)
      cset = ax.contour(X, Y, Z, 16, extend3d=True)
      ax.clabel(cset, fontsize=9, inline=1)
    • 3D Radial
    • # By Armin Moser
      #Courtesy of Matplotlib examples:
      from mpl_toolkits.mplot3d import Axes3D
      import matplotlib
      import numpy as np
      from matplotlib import cm
      from matplotlib import pyplot as plt
      step = 0.04
      maxval = 1.0
      fig = plt.figure()
      ax = Axes3D(fig)
      # create supporting points in polar coordinates
      r = np.linspace(0,1.25,50)
      p = np.linspace(0,2*np.pi,50)
      R,P = np.meshgrid(r,p)
      # transform them to cartesian system
      X,Y = R*np.cos(P),R*np.sin(P)
      Z = ((R**2 - 1)**2)
      ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
      ax.set_zlim3d(0, 1)
    • 3D Surface
    • #Courtesy of Matplotlib examples:
      from mpl_toolkits.mplot3d import Axes3D
      from matplotlib import cm
      import matplotlib.pyplot as plt
      import numpy as np
      fig = plt.figure()
      ax = Axes3D(fig)
      X = np.arange(-5, 5, 0.25)
      Y = np.arange(-5, 5, 0.25)
      X, Y = np.meshgrid(X, Y)
      R = np.sqrt(X**2 + Y**2)
      Z = np.sin(R)
      ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
    • Basic Conditionals
    • list2=[1,2,"cat","dog"]
      if "goat" in list2:
          print "We have a goat!"
      elif "weasel" in list2:
          print "We have a weasel!"
          print "We have nothing!"
    • Basic Function
    • def mid(x,y):
      print mid(0,10)
      print mid(0,11)
    • Basic Function 2
    • def mid(x,y):
      print mid(0,10)
      print mid(0,11)
    • Basic Import
    • import math
      print math.sin(3)
      from math import sin
      print sin(3)
      #Uncomment the "help(math)" below to see all the function in the math module
    • Basic Lists
    • #A simple list
      print list1
      #A list of mismatched things
      print list2
      #An empty list
      print empty
      #We can add things to lists
      print list1
      #Lists are indexable
      print list1[1]
      #We can "slice" lists to get subsequences
      print list1[2:4]
      print list1[:4]
      #We can even index from the end of the list
      print list1[-1]
      print list1[-2:]
      #We can see if something is in a list
      "dog" in list1
      "dog" in list2
    • Basic Math
    • #Subtraction
      print 5-12
      print 5.0-12.0
      #Divide two integers
      print 5/12
      #Divide two floating point numbers
      print 5/12.0
      print 5.0/12
      print 5.0/12.0
      #Python supports big integers
      print 2**65
      print 2**128
      #and complex numbers
      print 3+4j
      print 3+4j - 1+2j
      print (3+4j) - (1+2j)
    • FizzBuzz
    • #this is the fizzbuzz test
      for i in range(16):
          if i % 3 == 0 and i % 5 == 0:
              print 'fizzbuzz'
          elif i % 3 == 0:
              print 'fizz'
          elif i % 5 == 0:
              print 'buzz'
              print i

  3. Data Analysis

    Download Zip File 2

    • Basic Arrays
    • Basic Stats
    • Make Data
    • Read Data

  5. Easy Demo

    Download the Python demo


  7. Education

    Download Zip File 4


Annual Meeting Slides Available
The presentations from the annual meeting are posted on Arkansas Science & Technology Authority's site.

pyArkansas Registration Open
The 5th annual gathering of enthusiasts and users of the Python programming language, will be held on October 27, 2012 at University of Central Arkansas in Conway.

UAPB Offers CS Master's Degree
Starting this fall, the Computer Science Unit at the University of Arkansas at Pine Bluff will offer a Master’s of Science degree in Computer Science & Technology (CS&T;)--the first of its kind for the institution.