MTH 229 Projects

These projects are for using Julia within MTH 229. Most all sections have some self-grading questions at the end that allow you to test your knowledge of that material. The notes themselves should be copy-and-pasteable into a julia session.

Basics of types, order of operations, assignment and variables.

Shows how to define and call a function. Technical parts include ternary operator, multiple arguments, return values (tuples).

This demonstrates the use of the Gadfly package for plotting. This package has a very simple plot interface for graphing one or more functions.

As well, a discussion about arrays and mapping a function over an array is given. This will be useful later on with limits, ...

Finding zeros for polynomials, graphically find zeros, and using the bisection method. The latter introduces iterative programming and the idea of a tolerance.

The add-on Roots package implements a bisection-like algorithm.

Basics of limits.

Discussion on floating point representation and potential issues (subtracting like-sized objects!)

XXX I don't really like this -- and it needs questions

Explore forward difference and central difference with a bit on error analysis.

We end with a brief discussion on automatic differentiation, as implemented in the Roots add-on package.

Not yet written

Basics of Newton's method with a copy-and-paste function to do the work after the student explores a bit.

Discusses iterative algorithms, approximation, some analysis.

The fzero function of the Roots package is discussed.

A project on minimization and maximization. Some standard applied problems.

Basics of integration with applications including rectangle, trapezoid, simpson, and the quaggk function. Applications to volume and arc length.

XXX Need to do plotting -- readover

How to do some symbolic math in julia through the SymPy package.

Some additional resources

Julia is a young language, with the bulk of its development being done since its initial announcement. It has relatively few online resources. Some are compiled here. Many of these are linked to from a julia web brain.

  • The Julia manual provides a comprehensive overview

  • MIT Professor Steven G Johnson has some notes on using julia here and a cheat sheet here.

  • some blog posts are collected here.

  • At forio.com a tutorial is provided here.

  • A tutorial in IJulia format by Isaiah Norton is here, with the original file found here.

Before starting out with Julia it must be available.

Downloading julia

In order to get started with Julia it needs to be installed. If this is not done already, you have a bit of work to do. The simplest thing to do is to point your browser to julialang.org and follow the download link to install a binary.

Starting julia

Starting julia varies amongst the different operating systems. All have a console where commands are typed for julia to interpret and execute. This is known as the command line and though a long familiar means of interacting with computers, it is generally not familiar to the average student. We will need to learn to like the command line. Once done, you may think it is great, but it can a bit frustrating getting to that attitude.

Here is what the command line looks like on startup from a mac book pro within the terminal:

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.2.0-2143.r26d28c68
 _/ |\__'_|_|_|\__'_|  |  Commit 26d28c687d 2013-06-21 08:17:11
|__/                   |  x86_64-apple-darwin12.3.0

julia> 

The command line is the last line: a prompt beginning with julia>. Here is where you type an expression and then the enter key to ask julia to evaluate it.

A simple command is then typed into the computer followed by the enter key. This is then sent to julia's interpreter and an answer returned:

2 + 2
## 4

If you get 4, you are able to use julia.

IJulia An enhanced interface for using julia interactively

The command line is not the most comfortable learning experience for julia, rather it is suggested that the IJulia notebook interface be used. In the IJulia notebook, the command line is replaced by a cell where commands can be entered and executed in batches. The editing of commands is much easier and some features for integrated help are available.

Embedded Image

The above graphic is from the main web page for julia (julialang.com) and shows the IJulia notebook with some graphics provided by the Gadfly package.

Using IJulia will require a few additional installation steps:

  • download anaconda (https://store.continuum.io/cshop/anaconda/). It is big, but free. Install it, then within a terminal enter these commands:
conda update conda
conda update ipython
  • Start julia then enter these commands:
Pkg.update()
Pkg.add("IJulia")
Pkg.add("Gadfly")

The above commands form the basics of julia's package system. Like most computer languages, julia can be extended by user-contributed packages. The complete list of available packages is kept on the computer you are using julia at. This list is updated by the command Pkg.update(). New packages are made available for use by installing or adding them to your system via Pkg.add. Adding packages will automatically install any dependent packages. As well, external libraries should also be installed for you. This magic attempts to automatically identify what your computer system needs and acts accordingly.

The above commands need only be done when new packages are being installed. However, each time you wish to actual use an external package in a session, it must be added. This is done with the using command, as using Gadfly

Afterwards those commands are successful, the following command will start the notebook interface:

run(`ipython notebook --profile=julia`)

After all the installation, you can start the IJulia interface by simply starting julia, then issuing the above command.

Online versions of julia

You can use julia online (for now) at forio.

You can use a julia terminal at https://cloud.sagemath.com.