Spring 2006 Math 496/896 Section 006 Home PageWelcome 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.
Inverse Theory Resources
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...
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:
Telephone: Office 472-7233 Home 489-0560
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
Friday, January 20, is the last day to withdraw from the course and not have it appear on your transcript.
Friday, March 3, is the last day to change your grade option to or from ``Pass/No Pass''.
Friday, April 7, is the last day to withdraw from the course and receive a grade of W.
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.