Instructions
This notebook is meant to support the activity on map projections, but can be used for any simple surface.

There are two sections:
	1. Code which computes the metric tensor ((Subscript[g, ij])) of your surface.  This section will not compile until you fill in some missing code! In this section, you can leave undetermined parameters (e.g., the radius of Earth) in your surface, since there’s no plotting.
	2. A section which plots your surface, along with some (u^1)-curves and (u^2)-curves.  In this section, you’ll need to specify all your parameter values (e.g., assume Earth’s radius is 1) in addition to specifying a rectangular domain.  That is, set lower and upper bounds for each of (u^1) and (u^2).  This section also requires you to specify the number of (u^1)- and (u^2)-curves you want to see.

There are no custom functions defined in this notebook.  Instead, the two sections are really just two examples.  You may edit the examples directly or, if you’re less confident in your editing skills, copy+paste the code and then make edits.

Part 1: The metric tensor
This section computes the metric tensor ((Subscript[g, ij])) of a surface, as well as the determinant g.  You’ll need to finish writing the code before it works.  Also, whenever you change the surface, you’ll need to recompile the ensuing cells.  (Or you could just copy all of the code into a single cell.)

First, we define a surface.  It’s okay to leave undetermined parameters, since we’re not plotting.  For example, we have a cylinder of radius RR:

Clear[RR];
surfaceX[u1_,u2_]:={RR*Cos[u1],RR*Sin[u1],u2};

Now we can define (Subscript[x, 1]) and (Subscript[x, 2]), the columns of dx.  Note that the following cell won’t compile until you’ve defined surfaceX.

x1[u1_,u2_]:=D[surfaceX[uu1,u2],uu1]/.uu1->u1;
x2[u1_,u2_]:=D[surfaceX[u1,uu2],uu2]/.uu2->u2;

Next we want to define the coefficients (Subscript[g, ij]) of the metric tensor.  The first value, (Subscript[g, 11]), is defined for you in the following cell, but you need to define (Subscript[g, 12]) and (Subscript[g, 22]). This cell won’t compile until you make edits!

g11[u1_,u2_]:=x1[u1,u2].x1[u1,u2];
g12[u1_,u2_]:=(**mimic the previous line to define**);
g22[u1_,u2_]:=(**mimic the previous line to define**);

Now we can assemble these coefficients into a matrix ((Subscript[g, ij])) and compute the determinant g.  (The following code refers to this determinant as gg for Mathematica reasons.)

gMatrix[u1_,u2_]:={{g11[u1,u2],g12[u1,u2]},{g12[u1,u2],g22[u1,u2]}};
gg[u1_,u2_]:=Det[gMatrix[u1,u2]];

We can ask Mathematica to do some simplifying before showing us the result:

MatrixForm[Simplify[gMatrix[u1,u2]]]
Simplify[gg[u1,u2]]

As a reality check (to make sure your edits were good), the cylinder defined above should have (Subscript[g, 11])=(RR^2), (Subscript[g, 12])=0, and (Subscript[g, 22])=1.

Part 2: Plots
This section plots your surface in 3D, as well as some (u^1)-curves and (u^2)-curves on the surface.

Again, we start by defining the surface.  This time, we can’t leave any undetermined parameters, since we’re plotting.  For instance, we need to fix a radius on our cylinder:

surfaceX[u1_,u2_]:={2*Cos[u1],2*Sin[u1],u2};

Next, we specify the domain of our surface.  This includes picking lower and upper bounds for (u^1) and (u^2), and also determining how many of each type of curve you want to see.

u1min=-Pi;u1Max=Pi;u1Steps=16;
u2min=-3;u2Max=3;u2Steps=7;

Finally, the following cell will plot your surface, plus the (u^1)-curves and (u^2)-curves.  The number of (u^1)-curves you’ll see is equal to u2Steps, because that’s how many different fixed values we set for (u^2).  (Remember that we get a (u^1)-curve by holding (u^2) constant.)  The (u^1)-curves are in white, while the (u^2)-curves are in navy blue.  (And the surface is supposed to be Tech gold.)  No edits needed for this cell, provided you’ve compiled the previous cells.

Show[
ParametricPlot3D[surfaceX[u1,u2],{u1,u1min,u1Max},{u2,u2min,u2Max},Mesh->None,PlotStyle->RGBColor[(179/255),(163/255),(105/255),1],Ticks->None,PlotRange->All],
Table[ParametricPlot3D[surfaceX[u1Val,u2],{u2,u2min,u2Max},PlotStyle->RGBColor[0,(48/255),(87/255)]],{u1Val,u1min,u1Max,(u1Max-u1min)/u1Steps}],
Table[ParametricPlot3D[surfaceX[u1,u2Val],{u1,u1min,u1Max},PlotStyle->White],{u2Val,u2min,u2Max,(u2Max-u2min)/u2Steps}]
]

Your code
Type your code below (or just copy the code from above and substitute as needed).
Remember that you can compile a code cell using ‘Shift+Enter’.
Warning: Don’t type code directly into this cell, as it only accepts text.  Type your code in a new cell below.