From Richard Palais Wed Aug 27 11:15:40 2003
To: Math32
From: Richard Palais
Subject: Welcome
Dear Math 32a Students,
This is a message to welcome the students who have registered
for Math 32a, my course on the differential geometry of curves
and surfaces. We will have our first meeting in Goldsmith 226
this Friday at 10:40 am.
I have created a website for the course at:
http://rsp.math.brandeis.edu/Math32/
and I would like to invite you to visit it and become familiar
with its structure, since it contains a lot of information about
the course, how it will be run, where you can find various useful
lecture notes and other resources, and it will also be the place that
you can check the details of various homework exercises and projects that
I plan to assign during the course. (I have had my own server and have
managed my own web-sites for many years, so I decided against using the
Web-CT system, with which I am anyway not familiar.)
Please keep the above URL private---i.e., do not create any links
to it from any other web pages. (There are a number of reasons for this,
not the least of which is that I don't want the spam robots harvesting our
email addresses.)
Please do not hesitate to write if you have questions.
I am looking forward to working together these next few months!
Dick Palais
----------------------------------------
Richard S. Palais
Home: 68 Lexington Street, Weston, MA 02493-2146
VOICE: 781 899 4951 FAX: 781 642 6266
MOBILE: 781 354 3984
Office: Dept. of Math. Brandeis Univ. Waltham, MA 02254-9110
VOICE: 781 736 3050 FAX: 781 736 3085
EMAIL:palais@brandeis.edu
WWW Home Page URL: http://rsp.math.brandeis.edu
---------------------------------------------------------------------------------
--
From Richard Palais Thu Aug 28 07:52:29 2003
To: Math32
From: Richard Palais
Subject: For my records
To Math 32a Students:
It will be helpful to me in organizing the material for
the course and in preparing my lectures if I know a little
about your backgrounds, so I hope you won't mind answering
a few questions about yourself. Please use return email.
Your Name?
Your Year? (Freshman, sophomore,...?)
Your major?
What courses have you taken in the Math department?
What Math oriented courses have you taken in other departments?
Have you studied any mathematical topics on your own, outside of
assigned class works? If so please list them. (Include any topics
from reading courses.)
Many thanks. See you in class,
R. Palais
---------------------------------------------------------------------------------
--
From Richard Palais Sun Aug 31 23:59:41 2003
To: Math32
From: Richard Palais
Subject: First assignment
To Math 32a Students
I would like to ask you to download the first assignment from the
Math 32 website. You can find a link on the Homework, Projects, and
Assignments page at:
http://rsp.math.brandeis.edu/math32/
or get it directly at:
http://rsp.math.brandeis.edu/Math32/Assignments/Assignment1.pdf
Notice that it is in PDF format, and part of what I am interested in is whether
you are all able to download this file successfully.
Note that the first exercise of this assignment is due on Tuesday and the
rest on Friday.
R. Palais
---------------------------------------------------------------------------------
--
From Richard Palais Thu Sep 04 00:53:08 2003
To: Math32
From: Richard Palais
Subject: Various administrative matters.
To Math 32a Students.
1) My office hours. I will be available in my office (Goldsmith 206)
during the hour just prior to the time we meet---i.e., from 9:30
to 10:30 am Tuesday and Friday. I realize this isn't a good time
for several of you, so please feel free to ask me to arrange some
other time to meet with you. Also, if you remind me on Friday,
perhaps we can work out some other regular time.
2) There will definitely be a TA for the course---one who will be able
to help answer your questions about the mathematical and also the
programming aspects of the course. However all the details will
probably not be worked out before the weekend so I will let you
know about this next Tuesday.
3) The computer clusters in the Goldfarb classroom and in the Hughes
classroom (Gerstenzang basement) have Matlab installed, and it will
be installed in the Farber classroom computers very soon. We will use
one of these classrooms next Tuesday for our first full instruction
session in the use of Matlab. In the meantime, please start looking at
the "Getting Started with Matlab" material on the resources page of
the course website (or if you prefer start reading any of the large
number of good elementary textbooks on Matlab). You are free to use
the computers in any of the above mentioned clusters anytime that there
is no class being held there. It is very important to actually sit down
at a computer and practice using the program---you cannot learn to
program just be reading notes! Working through one or more of the
various tutorials while sitting at the computer is a good way to get
going for most people.
R. Palais
---------------------------------------------------------------------------------
--
From Richard Palais Sat Sep 06 00:36:25 2003
To: Math32
From: Richard Palais
Subject: Answers to exercises in First Assignment.
Cc:
Bcc:
X-Attachments:
Message-Id:
I've posted answers to the exercises in the first assignment at:
http://rsp.math.brandeis.edu/Math32/Assignments/Assignment1Answ.pdf
R. Palais
P.S. Most of you who passed in answers did quite well.
---------------------------------------------------------------------------------
--
From Richard Palais Wed Sep 10 14:01:55 2003
To: Math32
From: Richard Palais
Subject: TA Office Hours, Assignment 2 etc.
Cc:
Bcc:
X-Attachments:
Message-Id:
To Math 32a Students:
1) As I mentioned to you yesterday, the TA for the course is:
Anna Varvak
Goldsmith 111
x6095
Office Hours: Mon, Tues 12pm-1pm
2) As I also mentioned in class, I have posted the lecture notes
for the first two lectures:
http://rsp.math.brandeis.edu/Math32/LectureNotes/Lecture1.pdf ,
http://rsp.math.brandeis.edu/Math32/LectureNotes/Lecture2.pdf ,
and I have also posted my notes for the first computer lab:
http://rsp.math.brandeis.edu/Math32/LectureNotes/FirstSteps.m
3) Finally, I have now posted the second assignment:
http://rsp.math.brandeis.edu/Math32/Assignments/Assignment2.pdf
Although I have put on a due date of next Friday, if you would like
to work on it over the week-end and pass it in on Tuesday, that's OK
too.
---------------------------------------------------------------------------------
--
From Richard Palais Sat Sep 13 10:18:33 2003
To: Math32
From: Richard Palais
Subject: An Invitation, New Lecture Notes, and an explanation of yesterdays error :-(.
Cc:
Bcc:
X-Attachments:
Message-Id:
To Math 32a Students:
1) I would like to invite you all to a cookout at my home. I was
originally hoping to make it for tomorrow, but the weather report
looks too unpromising, so tentatively lets think about having it next
Sunday. I live just a couple of miles from Brandeis, and an easy walk
from the Kendall Green Commuter rail station---the next one west of
Roberts, but perhaps enough of you have cars to provide rides for
everyone. We can discuss it in class this week. Of course our TA
Anna Varvak and our Matlab expert Izi Aviyente are also invited.
2) I have now posted the lecture notes for lectures 3 and 4. The URLs are:
http://rsp.math.brandeis.edu/Math32/LectureNotes/Lecture3.pdf
http://rsp.math.brandeis.edu/Math32/LectureNotes/Lecture3.pdf
I have also posted my notes for the first Matlab instruction session,
last Tuesday evening in Farber classroom. The URL is:
http://rsp.math.brandeis.edu/Math32/LectureNotes/FirstSteps.m
There are links to all my lecture notes for the course at:
http://rsp.math.brandeis.edu/Math32/Course%20Lecture%20Notes.html
and you should get in the habit of checking there every so often.
3) The lecture notes for the fourth lecture have a correction to the
mistake I made in class yesterday. That mistake was really worse than
it looked like. Please read the notes for lecture 4 carefully, since
I have fallen a little behind and would like to review it very rapidly
on Tuesday.
Here is a discussion of the error and its (easy) fix.
Recall that I defined the orthogonal group O(V) of an inner-product
space V to be the set of all norm-preserving maps f:V --> V, and I
stated a theorem to the effect that norm-preserving maps were linear,
but I got hung up during the proof. Well, no wonder!---that "theorem"
is WRONG. (The easiest counter-example is for the one-dimensional
space V = R, the real numbers. The map f(x) = |x| is clearly norm
preserving but just as clearly NOT linear.
The correct definition of the orthogonal group O(V) is that it is
the set of all DISTANCE PRESERVING maps f:V --> V such that f(0) = 0.
(Distance preserving means || f(v) - f(w) || = || v - w ||. While it is
clear that a distance preserving map that leaves the origin fixed IS
norm preserving, the converse is false as the above counter-example
shows.) With this new definition of O(V) it is easy to show that orthogonal
transformations really are linear (see the notes).
Sorry about that!
R. Palais
---------------------------------------------------------------------------------
--
From Richard Palais Sat Sep 13 20:49:10 2003
To: Math32
From: Richard Palais
Subject: Help with Matlab
Cc:
Bcc:
X-Attachments:
Message-Id:
To Math 32a Students:
Our Matlab Consultant, Izi Aviyente, will be having
Office Hours each Friday from 1:40 pm--2:40 pm in the
"Masters Room" (Volen 104). If you have any questions
about Matlab, or if you are having problems with your
Matlab projects, that will be a good opportunity for
you to get some help. If Izi's office hour gets to
busy---as is likely to happen later in the semester
when I assign some more difficult projects---then
he has expressed a willingness to have a second
such hour on Tuesdays.
Izi will also be helping me out in the Matlab
instructional computer labs on Tuesday evenings
in the Farber classroom, and you will have a chance
to meet him this Tuesday.
R. Palais
---------------------------------------------------------------------------------
--
From Richard Palais Thu Sep 18 14:28:28 2003
To: Math32
From: Richard Palais
To Math 32a Students:
http://rsp.math.brandeis.edu/Math32/Assignments/MatlabProject1.pdf
---------------------------------------------------------------------------------
--
From Richard Palais Thu Sep 18 15:37:57 2003
To: Math32
From: Richard Palais
Subject: Cookout Sunday afternoon
Cc:
Bcc:
X-Attachments: :DeskStar:424188:LocalMap.JPG: :DeskStar:424188:Map1.jpg: :DeskStar:424188:Map2.jpg: :DeskStar:424188:RailSched.pdf:
Message-Id:
Math 32a Students:
It looks like the weather will be perfect Sunday afternoon,
so I am confirming the cookout invitation for 3:30 PM on 9/21.
The attached train schedule shows a train leaving Roberts
at 3:23 pm and arriving at Kendall Green at 3:28 pm. (It is
about a ten minute walk from Kendall Green Station to our
home.) Remind me tomorrow that we should discuss possible
car pooling.
Our home at 68 Lexington Street in Weston is on the
west side of the street, just opposite a large old
red house (dating from the 1700s!). I have attached
a few maps. The star marks our home and the crosses
mark Roberts and Kendall Green stations. It's about
a ten minute walk from the Kendall Green station to
our home.
See you tomorrow,
R. Palais
---------------------------------------------------------------------------------
----
From Richard Palais Fri Sep 19 17:55:57 2003
To: Math32
From: Richard Palais
To Math 32a Students:
I have posted the third exercise set (due in a week) at:
http://rsp.math.brandeis.edu/Math32/Assignments/Assignment3.pdf
The notes for todays lecture are at:
http://rsp.math.brandeis.edu/Math32/LectureNotes/Lecture5
I am also posting my Matlab notes called "Second Steps" at:
http://rsp.math.brandeis.edu/Math32/LectureNotes/SecondSteps.m
These are an edited version of the notes from last Tuesdays lab.
I have still not got them in a form that satisfies me, but several
of you asked for them so I am posting them in preliminary form.
(In particular, the final topic, on function M-Files is missing.)
I'll let you know when the final version is available.
Finally, I have posted the First Matlab Project (on Gram-Schmidt).
This is the original assignment plus some addenda. Several of you
have already passed in this project, and you might want to look this
over and consider if you want to revise your first version in the
light of the addenda there and the remarks I made in class today.
http://rsp.math.brandeis.edu/Math32/Assignments/MatlabProject1.pdf
If you have not passed in this assignment you might want to also
read through "Second Steps" before finishing writing your version
of the GramSchmidt function M-file. But please, try to have it done
by Monday evening, so Izi and I can look them over in time for the
Tuesday evening meeting. Remember that the plan is to discuss the
project and your various answers at the Tuesday evening Lab session
and I hope as many of you as can will come.
See you all Sunday afternoon,
R. Palais
---------------------------------------------------------------------------------
--
From Richard Palais Fri Sep 19 23:22:47 2003
To: Math32
From: Richard Palais
Subject: Assignment 2 Answers
To Math 32a Students:
I have posted the answers to the second assignment exercises at:
http://rsp.math.brandeis.edu/Math32/Assignments/Assignment2Answ.pdf
R. Palais
---------------------------------------------------------------------------------
--
From Richard Palais Mon Sep 22 10:32:04 2003
To: Math32
From: Richard Palais
Subject: revised Matlab notes
Cc:
Bcc:
X-Attachments:
Message-Id:
To Math 32a Students:
I have revised my first and second sets of Matlab notes and
posted the revisions at:
http://rsp.math.brandeis.edu/Math32/LectureNotes/FirstSteps.m
and
http://rsp.math.brandeis.edu/Math32/LectureNotes/SecondSteps.m
These notes should now be better for self-help. The idea is to
go through the notes, reading the comments and entering the commands
in a Matlab Command Window, and be sure you understand what the responses
from Matlab mean and why you are getting them before going on to the next
topic.
While the notes are "improved" they are not really in final form, and I
hope eventually to publish them. So please, if you spot any errors or if you
find some parts difficult to understand, or if you have some suggestions for
improvements, please write to me with your comments.
Tomorrow in the evening session in Farber Classroom we will discuss the
various solutions to Matlab Project #1. Please try to finish up (and test)
your GramSchmidt function M-File, and send it as an attachment to both
me and Izi Aviente before this evening.
R. Palais
---------------------------------------------------------------------------------
--
From Richard Palais Wed Sep 24 14:14:32 2003
To: Math32
From: Richard Palais
Subject: various
Cc:
Bcc:
X-Attachments:
Message-Id:
To Math 32a Students:
1) At the computer lab last night, several of you requested that
I postpone the due date for Assignment 3 until next Tuesday,
and I agreed to that. We also agreed that future assignments
would be due on Tuesdays too, so asto give you time to work
on them over a week-end.
2) I edited my notes from last night in which I discussed one way
of going about solving the first Matlab project (on implementing
GramSchmidt as a Matlab function M-File). I have put these revised
notes on our web-site at:
http://rsp.math.brandeis.edu/Math32/Assignments/Project1Discussion.m
In addition to my own suggested solution, I also posted the code from
several other solutions submitted by class members that had some
interesting twist on how to go about things.
R. Palais
---------------------------------------------------------------------------------
--
From Richard Palais Wed Sep 24 15:43:58 2003
To: Math32
From: Richard Palais
Subject: Assignment
Cc:
Bcc:
X-Attachments:
Message-Id:
Math 32a Students:
I have posted Assignment Number 4. The URL is:
http://rsp.math.brandeis.edu/Math32/Assignments/Assignment4.pdf
It isn't due until October 6 (a week from next Tuesday), but just in
case you would like to get a head start...
R. Palais
---------------------------------------------------------------------------------
--
From Richard Palais Fri Sep 26 22:24:39 2003
To: Math32
From: Richard Palais
Subject:
Cc:
Bcc:
X-Attachments:
Message-Id:
To Math 32a Students:
I have posted the notes for "Lecture 6". The URL is:
http://rsp.math.brandeis.edu/Math32/LectureNotes/Lecture6.pdf
(This covers material from both lectures of this week.)
R. Palais
---------------------------------------------------------------------------------
--
To: Math32
From: Richard Palais
To Math 32a Students;
I have put my notes from last weeks (i.e., the third) Computer Lab
online. (This is a discussion of different ways to go about solving
the first Matlab project.)
You can find it at:
http://rsp.math.brandeis.edu/Math32/LectureNotes/Project1Discussion.m
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject:
To Math 32 Students:
Anna made up an answer sheet for the third assignment (the one
that was due today), and I have posted it on the web-site. The URL is:
http://rsp.math.brandeis.edu/Math32/Assignments/Assignment3Answ.pdf
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: Lecture Notes and 2nd Matlab project
To Math 32a Students:
Preparing the notes for my recent lectures took substantially
longer than I had expected. Sorry. The notes for the last couple
of lectures are now available on the course web-site. The URL is:
http://rsp.math.brandeis.edu/Math32/LectureNotes/Lecture7.pdf
Actually, these notes go beyond where I left off on last Friday
and cover material I will lecture on next Friday as well. Moreover,
the final three pages of these notes are an exposition of numerical
integration (the Trapezoidal Rule and Simpson's Rule) which you
perhaps (I hope) already saw in your basic calculus course. The
last of these three pages explains the Second Matlab Project, which
involves implementing the Trapezoidal Rule and Simpson's Rule as
Matlab code and doing some experiments with it. You can also find
the same material from those three pages at:
http://rsp.math.brandeis.edu/Math32/Assignments/MatlabProject2.pdf
Please make an effort to understand this material before the Computer Lab
Tuesday evening, since I would like to begin discussing it then.
(But don't worry if you have difficulty in understanding the material.
It will all be discussed in class and you will have plenty of opportunity
to ask questions about it.) BTW, we will only BEGIN to discuss the second
project this Tuesday. It will not be due until a week later.
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: Notes for Matlab lecture
To Math 32a Students:
I have posted the notes for the fourth Matlab Computer Lab on
our web-site. The URL is:
http://rsp.math.brandeis.edu/Math32/LectureNotes/MoreAboutM-Files.m
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject:
To Math 32a Students:
Several students have asked me to delay posting the answers
to Assignment 4, to give them more time to work on it, and your
TA, Anna Varvak also feels that is a good idea. I am agreeable,
and we can discuss the timing further tomorrow.
BTW, Exercise 4, the proof of the Chain Rule, is admittedly
fairly difficult. Do your best with it, but don't feel bad if
you cannot get it.
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: Midterm take-home
To Math 32a Students:
I hope the subject line did not panic anybody. All that
is happening is that I am combining what would have been
Assignments 4 and 5 and I am calling it a "take-home midterm
exam". You will have until Friday October 24 to complete the
exam, and I would like everyone to please hand it in at
class-time on the twenty-fourth.
You will find the exam at:
http://rsp.math.brandeis.edu/Math32/Assignments/MidTerm.pdf
Please do NOT put off working on it until the last moment!
There are fifteen problems, all of them asking you to prove
something---except for Problem 8, which asks you to write a
Matlab function that implements the Banach Contraction Principle
(aka, Successive Approximations). Each problem builds on the
previous problems, so take them in order. The first few are quite
easy and they gradually get a little harder (but there are lots of
hints.) I think the best way to proceed for most of you will be
to first read over all of the problems carefully, and then try
to do a few problems each day. Perhaps try to do a problem
first without looking at the hints. If you do not see how to
do a the problem after thinking about it, read any hints over
and think about it some more and then try again.
I have tried quite hard to make it an interesting exam that will
will not only be challenging and enjoyable, but will also teach you
some interesting mathematics. If you do not understand something
about what a question means, don't hesitate to ask me or Anna either
in person or by email.
Although I do not mind you conferring with each other on the
other assignments, I would like you all to work out the problems
on the midterm on your own.
Please look over the exam before the class on Tuesday and we can
discuss any questions you may have then.
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: Re: Midterm take-home
To Math 32a Students:
Sally LeGore pointed out that I made an error in
the message I just sent you---I should have said
"Assignments 5 and 6", not "Assignments 4 and 5".
Of course Assignment 4 is the one that is supposed
to be handed in either already or very shortly.
Sorry,
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: ODE Lecture Notes
To Math 32a Students:
I have posted the notes for this morning's lecture on ODE.
They are at:
http://rsp.math.brandeis.edu/Math32/LectureNotes/Lecture8.pdf
Please note that this is a preliminary version. I will let you
know when I have posted the final version.
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: Answers to Fourth Assignment problems
To Math 32a Students:
The answers to the Assignment 4 problems have been
placed on our web-site. The URL is:
http://rsp.math.brandeis.edu/Math32/Assignments/Assignment4Answ.pdf
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: Matlab notes
To Math 32a Students:
Rather than post new notes for last Tuesday's Computer lab,
I have revised and updated the notes from the preceding week,
correcting the error I mentioned to you on Tuesday.
The revised notes are at:
http://rsp.math.brandeis.edu/Math32/LectureNotes/MoreAboutM-Files.m
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: ODE Lecture Notes
Cc:
Bcc:
X-Attachments:
To Math 32a Students:
The final version of my lecture notes on ODE is
now posted on the course web-site at:
http://rsp.math.brandeis.edu/Math32/LectureNotes/Lecture8.pdf
This includes all the material through todays lecture, including
the material on numerical integration (Euler's Method and Runge-Kutta).
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: Answers to Fourth Assignment problems
Cc:
Bcc:
X-Attachments:
To Math 32a Students:
The answers to the Assignment 4 problems have been
placed on our web-site. The URL is:
http://rsp.math.brandeis.edu/Math32/Assignments/Assignment4Answ.pdf
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: Matlab notes
Cc:
Bcc:
X-Attachments:
To Math 32a Students:
Rather than post new notes for last Tuesday's Computer lab,
I have revised and updated the notes from the preceding week,
correcting the error I mentioned to you on Tuesday.
The revised notes are at:
http://rsp.math.brandeis.edu/Math32/LectureNotes/MoreAboutM-Files.m
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: ODE Lecture Notes
Cc:
Bcc:
X-Attachments:
To Math 32a Students:
The final version of my lecture notes on ODE is
now posted on the course web-site at:
http://rsp.math.brandeis.edu/Math32/LectureNotes/Lecture8.pdf
This includes all the material through todays lecture, including
the material on numerical integration (Euler's Method and Runge-Kutta).
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: A couple of typos in the midtrm exam
Cc:
Bcc:
X-Attachments:
To Math 32a sudents:
Chandni has pointed out that there are a couple of typos in the
midterm exam. Namely, in problems 13 and 15 there is a small f denoting
a function that should be an upper case F.
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: Amazing speedup of Trapezoidal!
Cc:
Bcc:
X-Attachments:
To Math 32a Students
I did some more experimenting with Nick Dufresne's
vectorized versions of Trapezoidal Rule and
Simpson's rule. The results are pretty amazing,
particularly as concerns Trapezoidal. The ELAPSED
time is about 1/5000 the elapsed time for the
unvectorized version, and it is even in the
same ballpark as Simpson's when used to compute
pi to 10 decimal places.
I think that the speedup of the vectorized Trapezoidal
with respect to the unvectorized version is real and shows
how expensive looping is. On the other hand, I think that
the comparison of Trapezoidal and Simpson's is fake.
I am sure that Trapezoidal for n = 100000 takes longer
by a very large factor than Simpson's with n = 14,
however there is a fixed "startup" time for running
any M-File, and this is big enough to swamp the
much smaller compute times of both Trapezodal and
Simpson's. That is, if F is the fixed startup time
and T and S are the computing times for Trapezoidal
and Simpson's, then If F is much larger than T,
And S is only a small fraction of T, F + T = F(1 + T/F)
and F+ S = F(1 + S/F) differ only by the factor
(1+ S/F)/(1 + T/F) which will be close to 1 if T/F
is small, even if S/F is very, very small.
Izi, does that seem right to you, or do you have a
better explanation?
Anyone else have a competing theory?
Anyway, here are Nick's M-Files, and below them
the "shootout". Congratulations Nick!
R. Palais
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function thesum = TrapezoidalRule (f,a,b,n)
delta = (b-a)/n;
arguments = [a:delta:b];
%calculate all the values of the function
%in summing all n parts of the trapezoidal method we count internal points
%twice so we will multiply by 2
values = 2*feval(f,arguments);
%since we have calculated the value of the endpoints twice we need to
%subtract the values and we need to multiply by 0.5*delta = 1/2*(b-a)/n
thesum = 0.5*delta*(sum(values)-feval(f,a)-feval(f,b));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function thesum = SimpsonsRule (f,a,b,n)
delta = (b-a)/n;
arguments = [a:delta:b];
midpointArgs = [a+delta/2:delta:b-delta/2];
%calculate all the values of the function.
%in summing all n parts of the trapezoidal method,
%we need to count internal pointstwice so we multiply by 2.
values = 2*feval(f,arguments);
%in the formula all midpoint values are multiplied by 4
midpointValues = 4*feval(f,midpointArgs);
%since we have calculated the value of the endpoints twice we need to
%subtract the values and we need to multiply by (1/6)*delta = 1/6*(b-a)/n
thesum = (1/6)*delta*(sum(midpointValues)+sum(values)-feval(f,a)-feval(f,b));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Shootout
f = inline('4./(1+ x.^2)','x'); % must be vectorized for third versions!
a = 0;
b = 1;
n=100000;
tic, A = TrapezoidalRule3(f,a,b,n); toc % elapsed_time = 0.07617
Error = abs(A-pi) % 1.664046678229170e-11
n=14;
tic, A = SimpsonsRule3(f,a,b,n); toc % elapsed_time = 0.002523
Error = abs(A-pi) % 8.234657400407741e-11
n = 100000;
tic, A = TrapezoidalRule2(f,a,b,n); toc % elapsed_time = 49.330224
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: Interesting experiment!
Cc:
Bcc:
X-Attachments:
To Math 32a Students:
Well, I have done some more experiments, and
they seems to confirm our suspicion that while the
Trapezoidal rule is indeed acting like a second
order method for our function 1/(1 + x^2), on
the other hand Simpson's Rule is NOT behaving
like a fourth order method, but rather like a
sixth order method!
I have to admit that this has me baffled.
R. Palais
P.S. I have posted my edited notes of the
Computer Lab session last night in which we
discussed the second computer project. It is at:
http://rsp.math.brandeis.edu/Math32/Assignments/Project2Discussion.m
and contains the "Shootout" from my previous message
and also the results below from my experiments on
how errors depend on the number of subdivisions.
R. Palais
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%%% Let's check how the errors vary as a function
%%% of the number n of subdivisions.
%%% First Trapezoidal:
%
n = 5;
A = TrapezoidalRule1(f,a,b,n);
Error5 = abs(A-pi) % 0.00666653977880
n=10;
A = TrapezoidalRule1(f,a,b,n);
Error10 = abs(A-pi) % 0.00166666468263
%
% Since Trapezoidal is a quadratic method, the ratio
% of Error5 to Error 10 should be about (10/5)^2 = 4
%
ratio = Error5/Error10 % 3.99992862887449
%
%%%% Now Simpson's
%
n = 5;
A = SimpsonsRule1(f,a,b,n);
Error5 = abs(A-pi) % 3.965057793209326e-08
n=10;
A = SimpsonsRule1(f,a,b,n);
Error10 = abs(A-pi) % 6.200080449048073e-10
%
% Since SimpsonsRule1 is a fourth order method, the ratio
% of Error5 to Error 10 should be about (10/5)^4 = 16
% BUT,IN FACT:
ratio = Error5/Error10 % 63.95171523650308 ~ (10/5)^6
%
n = 20;
A = SimpsonsRule1(f,a,b,n);
Error20 = abs(A-pi) % 9.687362023669266e-12
%
ratio = Error10/Error20 % 64.00174200055011 ~ (20/10)^6
% So, the conclusion seems nearly inescapable that for
% the present function, Simpson's is behaving as a
% sixth order method !!!!
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: Third and Fourth Matlab projects
Cc:
Bcc:
X-Attachments:
To Math 32a Students
Recall that the third Matlab project (on successive approximation)
was assigned as part of the Midterm exam, and the fourth project is
an exercise at the end of the notes for "Lecture 8"---the section of
the notes on the IVP for first order ODEs. I have now posted each of
these as separate pdf files, with just the exposition that is relevant
to each project. They are located at:
http://rsp.math.brandeis.edu/Math32/Assignments/MatlabProject3.pdf
and
http://rsp.math.brandeis.edu/Math32/Assignments/MatlabProject4.pdf
Of course you will need to complete Project 3 before Friday when
the Midterm is due. Please try to work on Project 4 over the weekend,
since I would like to discuss both of these projects during the
Computer Lab next Tuesday evening.
R. Palais
---------------------------------------------------------------------------------
---
To: Math32
From: Richard Palais
Subject: Programming groups
To Math 32a Students
Recall that we discussed dividing up into groups to
carry out the upcoming more complex Matlab projects,
and we decided that the size of a group should not
be greater than three, to avoid logistical problems.
Since Lacra and Chandni live in the same suite they
asked to be together in one group. That left twelve
other members of the class---enough for four more
groups, and on the advice of Izi I would like to
propose the following groupings.
Group 1: Chandni Valiathan and Lacra Bintu
Group 2: * Nicholas DuFresne, Gregory Berlinrut, Dina Shapiro
Group 3: * Steve Gindi, Steve Dupree, Qaiser Saify
Group 4: * David Diamondstone, Matthew Roberts, Ilya Bronshtein
Group 5: * Simon Slutsky, Nicholas Lee, Margaret Jones
The first named person in each of the latter four groups is
our recommendation for the group leader, who will be in charge
of setting up meetings, and seeing to it that the group submits
its projects on time.
There is of course considerable arbitrariness in these choices.
If two people in different groups both agree that they would like
to switch to the other's group let me know and I will make the change.
Also, if when a group first gets together and discusses things, if
the group leader would prefer not to have that responsibility and
can convince someone else in the group to accept the job, that is OK,
but let me know about it.
R. Palais
---------------------------------------------------------------------------------
---
---------------------------------------------------------------------------------
---