Chap 48 Review
\[ \newcommand{\dnorm}{\text{dnorm}} \newcommand{\pnorm}{\text{pnorm}} \newcommand{\recip}{\text{recip}} \]
Exercise 1 The two graphs below show the same set of knot points. The interpolating function in one graph is a cubic spline; in the other it is a quadratic spline.
- Which plot shows the cubic spline?
question id: horse-wakes-stove-1
- What is it about the shapes of the two interpolating functions that motivated your answer to (1)?
Exercise 2 Referring to to the spline in XREF not implemented yet, explain what it means to say, “The cubic spline respects the monotonicity of consecutive knot points.”
Exercise 3 The dots plotted by the R code in ?lst-elephant-fight-ship show Johannes Kepler’s calculated distance of Mars from the Sun using Tycho Brahe’s observational data.
Three interpolating functions are drawn through the data points:
- A cubic spline
- A global polynomial
- A simple sinusoid with a period of 687 days.
- Which of the curves is the sinusoid?
question id: elephant-fight-ship-1
- Which of the curves is the global polynomial?
question id: elephant-fight-ship-2
- How smooth is the global polynomial? (There 28 data points.)
question id: elephant-fight-ship-3
- How smooth is the cubic spline? (There 28 data knots.)
question id: elephant-fight-ship-4
Just for interest: The observations are in small clusters of points separated by large gaps. This is because to make an observation, Mars had to be visible from Earth on at least two occasions separated by the orbital period of Mars: 687 days. There were no observations when Mars wasn’t visible from Tycho Brahe’s observatory in Denmark, as happens whenever the line segment between Earth and Mars passes near the Sun.
The sinusoidal oscillation in the orbital radius of Mars reflects the eccentricy of the orbit; it is an ellipse rather than a circle. Neither the cubic spline nor the global polynomial do a creditable job tracking the actual orbit of Mars. That is because neither method has a way to “discover” that the data are periodic, which is a huge hint about the sorts of functions that are appropriate.
Now, a trick. We will compute for each time a phase of that time in the 687 day orbit. This will collapse all the data down to the interval \(0 \leq t < 687\). Active R chunk 2 wil plot the data and the interpolating functions.
With the data spaced more evenly over the orbital cycle, both the cubic spline and the polynomial provide a smooth match to the data, while the sinusoid shows systematic deviations.
Exercise 4 These questions are just about R/mosaic code reading skills. They refer to the example about Kepler’s analysis of the orbit of Mars found in Exercise 3.
- The data are stored in an object named
Kepler
. What kind of object isKepler
?
question id: ash-fly-canoe-1
- There are two variables from Kepler’s data used in the code. What are their names?
time
and angle
distance
and angle
kepler.radius
and kepler.angle
kepler.distance
and kepler.angle
question id: ash-fly-canoe-2
- The object
connector
is defined on lines 2 and 3 of the sandbox code. What kind of R object isconnector
? (Hint, you may need to read further along in the code to figure this out.)
question id: ash-fly-canoe-3
- What kind of R object is
kepler.radius ~ kepler.angle
?
question id: ash-fly-canoe-4
- The R function
gf_point()
as used here has how many arguments?
question id: ash-fly-canoe-5
- What’s the give away that
polynomial
(as used here) is a function?
The name polynomial
is followed by open and close parentheses.
The name polynomial
begins with a p
.
The name polynomial
is an English verb.
question id: ash-fly-canoe-6
- Why are there quotation marks in
'red'
?
Because the color is only sort of red-ish, not pure red.
Because Mars is the “Red Planet”
Because the word is a literal set of characters, not the name of a function or other R object.
question id: ash-fly-canoe-7