Spring 2006 Math 496/896 Section 006 Home Page

Welcome to the Math 496, Section 006: Inverse Theory, home page. You're probably here for information, so let's start with the vital statistics of the course.

Essential Information

Inverse Theory Resources

Lots of information can be found on the WWW. Go to your favorite search engine (like the Yahoo site listed on my home page) and try searching on "Tikhonov regularization". See how many web pages you hit and visit a few interesting looking sites. As we cover specialized topics, try searching on them with keywords such as "trust region method".


Notes and FAQ

1/9/06: Programming odds & ends...
Here's a question I've answered for another student in a different class that might be helpful to you. It identifies a problem with understanding of how MATLAB functions work:

I have a question about the Euler function for matlab. One of it's arguments is function name. What exactly would the function name be? We have an ODE we're trying to solve. So what is our function? Also if we define a function, we have to give it points to evaluate at.

Well, functions are variables, and like all variables they have names and content. In Matlab names are just strings of characters (strings for short). Now notice that the comments of the function Euler say that the function has to have a certain format, namely it has to have arguments t,y, in that order. If you are solving a vector system, then y must be a vector; otherwise it is a scalar. In our exercise, it is just a scalar. For example, if I wanted to create a function represents the rhs of the ode dy/dt = t*sin(y), I would create a "function file" by using my favorite editor (Matlab has one, just type "edit" while you are in the command mode and the editor may pop up with a prompt asking if you want to create a new file. If so, hit the OK button, and you're off and running. Another option is to use your own favorite plain text editor.) In any case, the next thing that I would do is save the empty file and give the future function file a name like "fcn.m". You must use the extension ".m". Here would be the contents of the file, the first line of which must start with "function...":

function retval = fcn(t,y)
% description: FYI, the percent sign is a comment symbol
% in both matlab and octave. and in fact whatever I put
% here will appear right up to the first blank line
% whenever I type "help fcn". Matlab and octave first see
% if the function is already in memory. They then search
% the current directory, then their own special function file
% directories for a name that matches "fcn.m". Then they open
% the file to see if its first line is "function x = fcn(xx,xxx)".
% the arguments of the function are xx and xxx, and the return value
% is whatever name follows "function". If so it is a function file
% and the programs will then print out all comment lines up to the
% first blank.

% This line won't appear in your help request, and in fact you don't
% need to type any comment lines at all. I like to remind myself of
% syntax by putting a brief help description in my functions.
% "retval" is just my favorite name for a returned value. You can use
% anything else. Also, the parameter list for the function, "xx,xxx"
% is important only inside the function. These are dummy variables or
% placeholders, just like the dummy variable of a definite integral.

retval = t*sin(y);

end % this last end is optional in matlab (or octave in a function file.)

Whew! That's all there is to it. Notice that the only mandatory lines in this file are the first line and the line "retval = t*sin(y)". Now if I invoke the function interactively in Matlab, say by typing "fcn(2,4*pi)", I'll get the return value of 2*sin(4*pi), which will be a specific number (in this case, 0.) BTW, Matlab has lots of builtin functions like sin, cos, ln, exp, etc, and builtin variable names like pi, eps, etc.
And finally, for the answer you've been waiting for, the name of the function I just defined is 'fcn'. NB: don't use double quotes in Matlab, only single. This is how you pass a function as a parameter in Matlab/Octave. Just say, for example, to solve the ode with IC y(0)=1 from 0 to 3 in steps of size 0.1, just type

myanswer = Euler('fcn',0,1,0.1,30)

Here's another question I got from a student visit to my office: "Did you have a copy of an explicit trapezoidal method somewhere?"
Well, actually, yes, but I forgot that it's somewhat hidden. Look at the Theta function that I defined. It implements the theta method, but it uses fixed point iteration to make the method explicit. I set the iteration number, "iterlim", to 2 which, if you pass the parameter theta=0.5, gives you the explicit trapezoidal method.

Finally, I'm going to offer a few tips to novice programmers that might make their life a little easier. Feel free to use or not use them or misuse them.

A few practical programming tips...

  • Use the Matlab help files and the command line "help." Sometimes, they're pretty useful.
  • Have a look at my tutorial files, whose URL is listed above under Numerical PDE Resources, and see if they help you.
  • Create and use at least one "standard directory". For example, I have a subdirectory in my Math942 directory called ODEMethods. I'm keeping all the .m files for this course in that directory. When I run Octave from a terminal, I first change to that directory. You can run Matlab by icon and and use menus to set the Matlab path to this directory. In this way, when you issue a command like "fcn(2,3) and you have put the file fcn.m in this directory, Matlab will find the function.
  • Recycle, recycle, recycle. When I'm going to create a new function, say "gcn.m" and it's somewhat like the function file "fcn.m", I load up the file fcn.m and immediately Save As to "gcn.m". I then edit the file to make the necessary changes that I need for gcn. You should do the same thing with function files you create or I've given you.
  • Use script files to automate your work. A script file is a .m file that is not a function file, but has commands for Matlab to carry out. The first line of a script file should not start with "function ...", in contrast to a function file. Commands are then executed as though you typed them at the command line prompt. For instance, suppose I want to run Euler repeatedly using step sizes 1, 1/2, 1/4, 1/8, ..., 1/128, record the values of y(3) in an array, and then do a loglog plot of stepsize versus absolute value of y(3) (can't do loglog of negative numbers). I would write a script to do the work for me called, say, "EulerTest.m". The file would look like this:

    % script: EulerTest.m
    % description: does some calculations for an exercise.
    % This script file *must* be run from a directory where the
    % function files "Euler.m" and "fcn.m" live.
    disp('Running calculations for Euler');
    % start the experiment
    numdivides = 7; % remove the semicolon if you want to see a result
    h = 0.5.^(0:numdivides); % array of stepsizes
    results = zeros(1,numdivides+1); % initialize an array to hold results
    for kk = (1:numdivides+1)
      msteps = round(3/h(kk)); % number of steps to get to 3
      temp = Euler('fcn',0,1,h(kk),msteps);
      results(kk) = temp(msteps+1);
    loglog(h,results); % the loglog plot

    Run the script by just saying its name to Matlab "EulerTest" and pressing Enter. When it's done, you'll have a few new variables in your workspace, one of which is "results". (Type "who" and see its name.) Now do with it what you will.
    BTW, Octave fans, here's an advantage of Octave over Matlab: you can include function definitions in Octave files, just like you can do in C or Fortan, etc. Then you could have a script portion of the file at the bottom that runs like a "main". Unfortunately, Matlab requires separate files for each function except for subfunctions (private functions) that get used by the main function sharing the name of the file and are invisible to everything else.
  • About debugging something you've written...well, this is a big subject. Just for the record, Matlab has a pretty fancy debugger built in. For a quick and dirty solution (sometimes!) to what ails your program, try removing semicolons to actually see intermediate output, and also try sprinkling temporary extra display comments in the code you're debugging at key points, so you can see where your code is going. Use "disp()"
  • One of the concepts you should make sure you understand is the idea of a "local" variable versus a "global" variable. Global variables are just that: visible to everyone and everything. Functions are global variables. So, if in my function definition of a function, say gcn, I make a reference to an already created function "fcn(t,x)" then this reference will work correctly. However, all other user variables are local by default (it is possible to declare them as global, but it takes an extra step.) This means that they are recognized only in the environment in which they were created. If I create a variable "xtmp" in a script file, then reference "xtmp" inside a function I create, then I really have two separate variables because the function environment is different from the user environment, which is where the script variables live -- remember, running a script is like typing in the same commands at the keyboard.

1/9/06:About significant digits...
I've been asked to explain what significant digits of an approximation to a number mean. Here goes: to get the number of significant digits, first *subtract* (rather than just looking at the numbers) the two (may as well be larger - smaller,) then find the position of the leading digit of the error relative to the position of leading digit of the exact answer. (We're thinking in fixed point representation in this discussion.) If the difference in that position is less than 5, then number of significant digits is one less than that position, else two less.

For example if 1.006 and .996 are used to approximate 1, calculate 1.006 - 1 = 0.006. Notice I put the zero in front of the decimal to start counting from the right position. There is nonzero digit at the 4th position, counting from the (base 10) position of the leading digit of 1, and the size of this digit is greater than 5, so this approximation has 2 significant digits. On the other hand, 1 - .995 = 0.005, which again has a nonzero digit in the 4th position, and the size of the digit is at most 5, so .995 has 3 significant digits as an approximation to 1. BTW, it's also perfectly correct to say that each answer has one significant digit, though this doesn't give all the available information. Hope this helps.

Class Policy Statement

Course: Math 496, Mathematics Seminar

   Topic: Inverse Theory

Place/Time: 12 AvH, 3:30-4:45 TR, Spring 2006

Preq: Math 314 (Linear Algebra) and 221 (Differential Equations), or permission.

Objectives: To help students achieve competence in the following areas:

  • Understanding of mathematical formulations of inverse problems and parameter identification.
  • Understanding of inverse theory philosophy and methodology.
  • Implementation of algorithms for illustration of inverse problems and their solutions (mainly via Matlab platform).
  • Interpretation of results obtained by theoretical analysis and computation (consistent with Hamming's dictum: The purpose of computing is insight, not numbers.)
Instructor: Dr. Thomas Shores

Telephone: Office 472-7233 Home 489-0560

Email: tshores1@math.unl.edu

Web Home Page: http://www.math.unl.edu/~tshores1/

Office Hours: Monday 3:30-5:00, Tuesday 11:00-1:00, Thursday 12:00-1:30, Friday 8:00-9:30, and by appointment. Office: 229 AvH

Class Attendance: Is required. If absent, it is incumbent upon the student to determine what has been missed as soon as possible. It is advisable to consult with the instructor.

Homework/Projects: Homework will be assigned in class and collected in accordance with the syllabus, and will be usually returned within one week. Although collaboration in solving problems is encouraged, it is strictly forbidden to copy someone else's homework. In some cases I will allow teams of two to turn in a single solution for certain problems. The official programming language for this course is Matlab. Prior experience in Matlab is not required. Current information about the course will be available through this lab account and the web (via the 384H homepage or my home page). Using the web is strongly recommended for keeping track of current activities in the course.

Reading Assignment: Read the sections of the texts as, or before, they are covered in class lectures. This is a standing assignment throughout the semester.

Grade: One midterm will be given and will account for 130 points. The final exam will count 130 points. Each exam may have a take home component. In-class exams are closed book with calculators. Homework will count 240 points. The final grade will be based on these 500 points.

Final Exam: Will be comprehensive. To be given on Monday, May 1, 8:30-10:30 am in 12 AvH.

Grades of "I", "W" or "P": These grades will be given in strict accordance with University policy. (See any Schedule of Classes for the relevant information and dates.)

Keep This Information!!!

Syllabus for Math 4/896, Section 001, Spring 2006

  • TEXT: Parameter Estimation and Inverse Problems, Richard Aster, Brian Borchers and Clifford Thurber, Elsevier, 2005.
    ISBN: 0-12-065604-3
  • The times listed below are approximate, and may be adjusted as the semester progresses. The two sources for material are the class textbook (ABT) and my own prepared notes (NT). Assignments are due on Tuesday if they are listed first below, and Thursday otherwise. Unless otherwise stated, you should turn in hardcopy of your work. The specifics of each assignment will be given in class and posted on the web as the course progresses.


    1 Jan 9-13 NT Introduction
          Matlab & Matrices

    2 Jan 16 (no class) Martin Luther King Day
      Jan 17-20 NT Matlab & Statistics

    Friday, January 20, is the last day to withdraw from the course and not have it appear on your transcript.

    3 Jan 23-27 ABT Asgn 1 due
          Ch 2

    4 Jan 30-Feb 3 ABT  
          Ch 2

    5 Feb 6-10 ABT Asgn 2 due
          Ch 3

    6 Feb 13-17 ABT  
          Ch 4

    7 Feb 20-24 ABT Asgn 3 due
          Ch 4

    8 Feb 27-Mar 3 ABT Asgn 4 due
          Ch 5

    Friday, March 3, is the last day to change your grade option to or from ``Pass/No Pass''.

    9 March 6-10   Review

    10 Mar 13-17 (no class) Spring Break

    11 Mar 20-24 ABT  
          Ch 5

    12 Mar 27-31 ABT Asgn 5 due
          Ch 7

    13 Apr 3-7 ABT  
          Ch 8

    Friday, April 7, is the last day to withdraw from the course and receive a grade of W.

    14 Apr 10-14 ABT Asgn 6 due
          Ch 9

    15 Apr 17-21 ABT  
          Ch 10

    16 Apr 24-28 ABT Asgn 7 due
          Ch 10

    Final Exam: The final exam is a comprehensive exam to be given on Monday, May 1, 8:30 - 10:30 am in 10 AvH.

    Department Grading Appeals Policy: The Department of Mathematics does not tolerate discrimination or harassment on the basis of race, gender, religion or sexual orientation. If you believe you have been subject to such discrimination or harassment please contact the department. If, for this or any other reason, you believe that your grade was assigned incorrectly or capriciously, appeals may be made to (in order) the instructor, the department chair, the departmental grading appeals committee, the college grading appeals committee and the university grading appeals committee.