CS465 Homework 2

This homework has separate handouts for the written part:

and the programming part:

Some reasonable parameter values (used in images below):

Using the framework

To help make it easier for you to compile the framework in your favorite IDE, we have eliminated all packages from the code, so that all the .java files sit in a single directory.

You still need the support libraries. The documentation for the support libraries can be found here. Unlike the brush assignment, this assignment does depend on the vecmath library.

Implementation hints

There are some hints we've given to some people, so I'll post them here.

Generally, when you're evaluating a complicated expression and also keeping track of its derivative, you should break the function evaluation down into manageable steps, giving names to the intermediate results. Then you can also compute the derivatives in the same steps, computing the derivatives of the intermediate results and using them in the chain rule down the line. This is vastly easier to debug than one huge formula that could have a typo anywhere.

For instance, suppose I want to evaluate sin(cos^2(sin(x)) + exp(x^3)). I could write out the whole derivative in one step, like this:

y = sin(cos^2(sin(x)) + exp(x^3)) dy_dx = cos(cos(sin(x))^2 + exp(x^3)) * (3 * exp(x^3) * x^2 - 2 * cos(sin(x)) * sin(sin(x)) * cos(x))

but I had to resort to Mathematica before I got that right. On the other hand I could rewrite the formula in steps, like this:

a = cos(sin(x)) da_dx = -sin(sin(x)) * cos(x) b = exp(x^3) db_dx = exp(x^3) * (3 * x^2) y = sin(a^2 + b) dy_dx = cos(a^2 + b) * (2 * a * da_dx + db_dx)

and this one is easy to verify by reading it through step by step.

Helpful pictures

Here are pictures of all the maps (with unspecified cameras) to help you understand what the surfaces are supposed to look like.

Cornell CS465 Fall 2003 (cs465-staff@cs.cornell.edu)