411 REFERENCE · Wikibooks
The Science of Programming/Slippery Slopes
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
In Chapter X of CME, SPT states that
the derivative (at a given point)
can be viewed as the slope of the tangent to a curve (at that point).
Let's use our software to examine slopes.
Consider parabolas of the form:
The h variable induces a rightward shift of the parabola
if h is positive and a leftward shift if h is negative.
The v variable induces an upward shift
if positive and a downward shift if negative.
Thus, these curves
bottom out at the point .
For and ,
we get:
Plotting the parabola yields:
center
We can see from the plot that when ,
the curve bottoms out and the tangent at the point should
be horizontal, having a slope of
zero. To the right of that point, the slope rises to
the left, so the derivative in that area should be
positive. To the left of the bottom point, the slope
rises to the left, so the derivative in that area
should be negative.
To confirm our intuition, we shall encode the parabola
as a sum of terms:
var y = term(1,:x,2) minus term(6,:x,1) plus term(10,:x,0);
and take the derivative:
var y' = y . diff(:x);
Let's look at y and its derivative at :
sway> y . value(2)
INTEGER: 2
sway> y . value(3)
INTEGER: 1
sway> y . value(4)
INTEGER: 2
sway> y' . value(2)
INTEGER: -2
sway> y' . value(3)
INTEGER: 0
sway> y' . value(4)
INTEGER: 2
Just as we suspected.
Solving problems
Let's take a break from programming and use the software
we've been given to solve some problems given in CME.
Questions
Footnotes
Working on the Chain Gang Peaks and Valleys