Numerical Methods for Partial Differential Equations I

Here's a start on a web page for the course. Gambit and Meroon are already built and installed on zorn.math.purdue.edu and zuse.math.purdue.edu, but if you want to install them on your own computer, you can.

We'll be using Gambit-C, a Scheme->C compiler. The current version is 4.0beta-12; the Gambit web site is here, and documentation is here. You'll want a copy of the Scheme standard documentation.

We'll also be using Meroon, an object-oriented extension to Scheme. I've packaged the sources here; to install, gunzip and untar the file and
> (load "make_meroon.scm")
into gsc. That will make a file "_meroon.o1" that you'll need to load into gsi or gsc when you want meroon. This is done automatically when you call "gsi++" ("gsi" plus Meroon), or "gsc++" ("gsc" plus Meroon). There's an entire directory of documentation for Meroon. Note: I changed Meroon so that field setters are of the form
(This-is-a-long-class-name-followed-by-a-long-field-name-set! obj value)
rather than
(set-This-is-a-long-class-name-followed-by-a-long-field-name! obj value)

You'll need "/pkgs/gcc-3.4.3/bin:/pkgs/Gambit-C/bin/gsc" early in your path; you should set the LD_LIBRARY_PATH environment variable to "/pkgs/gcc-3.4.3/lib:/pkgs/gcc-3.4.3/lib/sparcv9:/usr/openwin/lib:/usr/lib:/pkgs/Gambit-C/lib". See "~lucier/.cshrc" for how I set up my .cshrc file. (The relevant part starts at "case sparc-sun-solaris2.9:".)

The software we'll be working on in this course can be found here.

Example: Someone asked for an example.

Use emacs (or another editor that does parenthesis matching and automatic indentation of Scheme code) to create the following file called example.scm:

(define-class Node (Object)
  ((= position)
   (= left-interval mutable:)
   (= right-interval mutable:)))

(define-class Interval (Object)
  ((= left-node mutable:)
   (= right-node mutable:)))

(define-class Partition (Object)
  ((= nodes)
   (= intervals)))

(define (make-trivial-partition)
  (with-co-instantiation
   ((x0 Node
	left-interval: #f
	right-interval: x0-x1
	position: 0.0)
    (x1 Node
	left-interval: x0-x1
	right-interval: #f
	position: 1.0)
    (x0-x1 Interval
	   left-node: x0
	   right-node: x1))
   (instantiate Partition
		nodes: (list x0 x1)
		intervals: (list x0-x1))))

We can load the file or compile it; every time we call make-trivial-partition it creates a new trivial partition of [0,1]; you can use unveil, a procedure defined by Meroon, to see the strucure of a meroon object. (Gambit doesn't know how to print Meroon objects by default, that is why it prints #<meroon #k> where k is a number that is attached to an object whenever it is displayed in the REPL ("read-eval-print-loop"):

zorn-5% gsc++
[ Meroon V3 Paques2001+1 $Revision: 3.55 $ ]
loading /pkgs/Gambit-C/gambcext.scm
Gambit Version 4.0 beta 12

> (load "example")
"/export/users/lucier/programs/615current/example.scm"
> (define a (make-trivial-partition))
> a
#<meroon #2>
> a
#<meroon #2>
> (define b (make-trivial-partition))
> b
#<meroon #3>
> a
#<meroon #2>
> (compile-file "example")
#t
> (load "example")
"/export/users/lucier/programs/615current/example.o1"
> (define c (make-trivial-partition))
> c
#<meroon #4>
> (unveil c)
(a Partition <------------- [Id: 1]
 nodes: 
 (a List  <------------- [Id: 2]
 |List[0]: 
 |(a Node <------------- [Id: 3]
 | position: 0.
 | left-interval: #F
 | right-interval: 
 | (a Interval <------------- [Id: 4]
 | |left-node: <the Node referred above as 3>
 | |right-node: 
 | |(a Node <------------- [Id: 5]
 | | position: 1.
 | | left-interval: <the Interval referred above as 4>
 | | right-interval: #F end Node) end Interval) end Node)
 |List[1]: <the Node referred above as 5>
 | end List)
 intervals: 
 (a List  <------------- [Id: 7]
 |List[0]: <the Interval referred above as 4>
 | end List) end Partition)
#t
> (unveil a)
(a Partition <------------- [Id: 1]
 nodes: 
 (a List  <------------- [Id: 2]
 |List[0]: 
 |(a Node <------------- [Id: 3]
 | position: 0.
 | left-interval: #F
 | right-interval: 
 | (a Interval <------------- [Id: 4]
 | |left-node: <the Node referred above as 3>
 | |right-node: 
 | |(a Node <------------- [Id: 5]
 | | position: 1.
 | | left-interval: <the Interval referred above as 4>
 | | right-interval: #F end Node) end Interval) end Node)
 |List[1]: <the Node referred above as 5>
 | end List)
 intervals: 
 (a List  <------------- [Id: 7]
 |List[0]: <the Interval referred above as 4>
 | end List) end Partition)
#t

We also have the web sites from the course in 2000 and 2003.