Math 4500/6500 Midterm Project

This notebook contains the midterm project for Fall 2013. The midterm project is a practical exam in which you’re confronted with the type of numerical analysis problem which you might encounter in real life. 

In such a context, you usually won’t know the definitions of the functions that you’re trying to work with; they will be experimental, or depend on user inputs that you can’t anticipate, or be the results of long and complicated codes.

Evaluate the cell below to load the functions you’ll need:

Needs["midtermProject`","http://www.jasoncantarella.com/downloads/MidtermProjectPackage.m"];

Rules.

1. You are allowed to use anything on the course webpage, or in your book to complete the midterm project, as well as any code you’ve developed for homework assignments.

2. You are not to discuss the exam with each other, share code, or otherwise assist each other. This exam is an individual project.

3. Attempting to hack the encryption on the files and trick Mathematica into giving up the function definitions is encouraged and rewarded. Attempting to hack my personal computer or webpage to scout for an unencrypted version of the information is off limits (it’s not so much that I’d mind the security test, but I’m worried that you’ll mess it up while trying to get in).

4. You may study the code in the class notebooks as you like, but you should not copy and paste it to do the projects below.

5. You are welcome to check your answers against Mathematica’s built-in functions for numerical integration, differentiation, rootfinding, and the like, but the answers I will grade must come from your own code.

1. Numerical Integration.

The package “midtermProject” defines a function called “IntegrationFunction”. Your mission is to integrate this function from 0 to π/4 numerically. You can evaluate this function with calls like:

midtermProject`IntegrationFunction[0.4]

You can count the number of evaluations of the function (since the package was loaded), with “IntegrationFunctionCalls[]” which updates every time the function is called:

midtermProject`IntegrationFunctionCalls[]

You can plot the integration function as usual:

Plot[midtermProject`IntegrationFunction[x],{x,0,π/4},Filling->Axis]

But you can’t display the source code for the function:

midtermProject`IntegrationFunction[x]

?midtermProject`IntegrationFunction

At least I don’t think you can. To test this hypothesis, I’m offering a bounty of one letter grade (on the midterm project) to anyone who can crack my clever encryption scheme and give me the formula for the function.

So... go for it: the current count of function calls is

starterCalls = midtermProject`IntegrationFunctionCalls[]

Your grade on this project will be based on the ratio of the number of correct digits in your integral to the number of function evaluations you need.

2. Numerical Differentiation.

Similarly, I’ve defined a sneaky function

midtermProject`DifferentiationFunction[1.0]

Your mission is to compute the first derivative of this function at x = 1.0. Again, your grade will be based on the ratio of the number of correct digits in your answer to the number of function evaluations that you use. 

You can look at the total number of function evaluations with:

midtermProject`DifferentiationFunctionCalls[]

The “hacker bonus” offer stands here, too. Tell me the function and get a bonus of one letter grade.

3. Root finding

There is a root of the function

Plot[midtermProject`RootFindingFunction[x],{x,0,1},Filling->Axis]

between 0 and 1. Where? Do your best job of finding the root of the function. As always, your grade depends on the ratio of correct digits to function evaluations, and as always, I’ll give a letter grade bonus if you can crack the encryption on the definition of the function. You can count function calls with

midtermProject`RootFindingFunctionCalls[]

4. Polynomial Interpolation

Here’s a weird function:

Plot[midtermProject`PolynomialInterpolatingFunction[x],{x,-1,1},Filling->Axis]

Your mission is to come up with a polynomial which interpolates this function over the interval [-1,1]. You can put the nodes wherever you like (and it’s ok to use Mathematica’s InterpolatingPolynomial to compute the interpolant for a given set of nodes). 

I will base your grade on the ratio “largest difference between your polynomial and the actual function” / “degree of the interpolating polynomial”.

Conclusion

Good luck, and enjoy the exam! You have until Thursday, November 7, at midnight to turn in the exam by email. Your exam should be completed by filling in your own code to this worksheet. 

Please rename the file

YourLastName_MidtermProject.nb

before emailing it me.