Technology (including Mathematica, TI calculators, Matlab,
Python, Octave, R) are useful in
Mathematics for at least three reasons:
- To check our work (e.g., verifying algebra work);
- To more quickly answer computation-extensive problems (e.g., Euler's method; constructing vector fields);
- To explore a problem to which we do not have a readily available procedure.
This project will help familiarize you with using Mathematica or Matlab to
visualize the parametric space curves that result from the intersection of two surfaces. You can download the free student version of
Mathematica from
https://depts.gpc.edu/servicedesk/StuDownloads/.
Surfaces
A 3-dimensional surface is the set of all points $(x,y,z)$ that are solutions to a given equation.
Space Curves
A space curve is the set of all position vectors $\vec{r}(t)=\left\lt f(t), g(t), h(t) \right\gt$, where $t$ is a parameter.
Use of Mathematica Functions
Executing Mathematica Code
To execute Mathematica code (including comments), hold down the SHIFT key and
press the ENTER key. Note: The cursor does NOT need to
be at the end of the code!
Mathematica Comments
Comments MUST be enclosed by (* *)
. For example,
(* This is a valid comment *)
This is NOT a valid comment
Use comments to label all parts of all questions AND annotate where needed. For example,
- Label:
(* Question 1a *)
- Annotation:
(* Question 1a plot of vector function v = t i + t^2 j + 1/t k on [-2,3] *)
Mathematica Functions
For additional Mathematica code necessary for this project see:
Hyperbolic functions:
- $\sinh(t)$:
Sinh[t]
- $\cosh(t)$:
Cosh[t]
- $\tanh(t)$:
Tanh[t]
- $\coth(t)$:
Coth[t]
- $\text{csch}(t)$:
Csch[t]
- $\text{sech}(t)$:
Sech[t]
- $\sinh^{-1}(t)$:
ArcSinh[t]
- $\cosh^{-1}(t)$:
ArcCosh[t]
- $\tanh^{-1}(t)$:
ArcTanh[t]
- $\coth^{-1}(t)$:
ArcCoth[t]
- $\text{csch}^{-1}(t)$:
ArcCsch[t]
- $\text{sech}^{-1}(t)$:
ArcSech[t]
- To raise a hyperbolic function to a power, e.g., $\sinh^2(t)$:
Sinh[t]^2
Parametrization of the Intersection of Space Curves
There are many ways to parametrize the space curve for the intersection of two surfaces. The common methods:
- Let one of the variables in the space curve be equal to the parameter
- Let $x=t$, or $y=t$, or $z=t$.
- Then use the equations for the surfaces to find the two remaining variables as functions of $t$.
- This method is easiest when there is at least one variable to the first power in the equations of a surface.
- Use $a\sin^2{(t)}+a\cos^2{(t)}=a^2$ if one of the surfaces is $x^2+z^2=a^2$, where $a$ is a constant:
- For example, $x^2+z^2=16$: Let $x=4\cos{(t)}$ and $z=4\sin{(t)}$.
- Then use the equations for the surfaces to find the the remaining variable as a function of $a\sin{(t)}$ and $a\cos{(t)}$.
- This method is easiest when at least one of the surfaces has traces that are circles.
- Use $a\sin^2{(t)}+a\cos^2{(t)}=a^2$ if one of the surfaces is $(y-b)^2+(z-c)^2=a^2$, where $a$, $b$, and $c$ are a constants:
- For example, $(y+2)^2+(z-3)^2=16$: Let $y+2=4\cos{(t)}$ and $z-3=4\sin{(t)}$.
- Then use the equations for the surfaces to find the the remaining variable as a function of $a\sin{(t)}$ and $a\cos{(t)}$.
- This method is easiest when at least one of the surfaces has traces that are circles.
- Use $a\sin^2{(t)}+b\cos^2{(t)}=c^2$ if one of the surfaces is $ax^2+by^2=c^2$, where $a$, $b$, and $c$ are a constants:
- For example, $4x^2+y^2=16$: Let $x=2\cos{(t)}$ [where $2=+\sqrt{c^2/a}=+\sqrt{16/4}$] and $y=4\sin{(t)}$ [where $4=+\sqrt{c^2/b}=+\sqrt{16/1}$].
- Then use the equations for the surfaces to find the the remaining variable as a function of $a\sin{(t)}$ and $b\cos{(t)}$.
- This method is easiest when at least one of the surfaces has traces that are ellipses.
- Use $a\sinh^2{(t)}-a\cosh^2{(t)}=a^2$ if one of the surfaces is $y^2-z^2=a^2$, where $a$ is a constant:
- For example, $x^2-y^2=9$: Let $x=3\cosh{(t)}$ and $y=3\sinh{(t)}$.
- Then use the equations for the surfaces to find the the remaining variable as a function of $a\sinh{(t)}$ and $a\cosh{(t)}$.
- You can employ the same methods to shift or scale hyperbolas as shown for circles and ellipses.
- This method is easiest when at least one of the surfaces has traces that are hyperbolas.
Project Requirements
Functions
Since the project will require the re-use of objects, you need to store the following objects into variables:
- Store graphs of surfaces into non-function variables
- Store graphs of space curves into non-function variables
- To make comments in code:
(* This is how to make comments in Mathematica code *)
Example
- Graph both surfaces $x+y=3$ and $y^2=z$ on $-6\le t\le 6$ and graph the space curve, $\left<3-t,t,t^2\right>$, $t\in [-3,3]$,
of the intersection of the surfaces.
- Store the graphs of the two surfaces into a non-function variable, $surfs$:
surfs=ContourPlot3D[{x+y==3,y^2==z},{x,-6,6},{y,-6,6},{z,-6,6},AxesLabel->{x,y,z},ContourStyle->Directive[Opacity[0.4]],Mesh->None]
- Store the graph of the vector function into a non-function variable, $sc$:
sc=ParametricPlot3D[{3-t,t,t^2},{t,-3,3}]
- NOTE: You may need to write a piecewise-defined parametric function if you used $\sqrt{\text{ }}$ in solving for the remaining variable.
- Store the plot for each piecewise function into its own variable, e.g., $sc1$, $sc2$, $sc3$, etc.
- Show both surfaces and the space curve on the same axes:
Show[{surfs,sc}]
- NOTE: If you used a piecewise-defined parametric function, e.g., $sc1$, $sc2$, $sc3$, and $sc4$, then you will need to use:
Show[{surfs,sc1,sc2,sc3,sc4}]
Mathematica Documentation
Label Your Work
Any time that you use Mathematica, label the document with your name and the date:
- Use comment code to label the document with your name:
(* Your Name *)
[using your own name!]
- Use comment code to label the project name:
(* Mini Computer Project 05 *)
- Use comment code to label the date:
(* 23/24 September 2015 *)
- Hit SHIFT-ENTER to enter each comment.
Work
Answer the following question, using the appropriate code shown above (label each question with
(* Question xx *)
replacing the xx with the appropriate numbers).
Annotate
all parts of questions using comment tags, e.g. (* Plot of vector function <3-t,t,t^2> *)
.
For each of the following pairs of surfaces:
- Find a parametrization of the intersection of the curves.
- Graph the surfaces and the space curve on the same axes, using appropriate values for domain.
- $z=x^3$ and $y=\sin{(x)}+z^2$
- $x^2+y^2=9$ and $y=x^2+z$
- $x^2+y^2+z^2=4$ and $x^2-y^2=2z$
- $x^2+y^2=9$ and $z=xy$
- Viviani's curve is the interection of $x^2+y^2+z^2=16$ and $(x-2)^2+y^2=4$
- Complete two more examples (one example cannot have any variable to the first power).
Submission (Make sure you read this section completely)
- Save the Mathematica as a notebook (.nb) file or Matlab as an (.m) file.
- Save the file as: LastName_FirstInitial_2633_MCP_05.nb or LastName_FirstInitial_2633_MCP_05.m
- Note: You do not need to type .nb as part of the filename.
- For example, Dr. Weber's submission would be: Weber_J_2633_MCP_05.nb.
- Annotate/label all questions.
- The project is due no later than the starting time of your class on 23/24 September 2015. No late assignments will be graded.
- If the submission requirements are not met, then the project will not be graded.
- You may receive feedback on a project that is submitted at least $24$ hours, in advance.
- Use comments at the end of the project to verify that your submission is your own work and that you received no assistance from other individuals.
- The project is worth a total of 2 points.