Chapman Math: Slope of tangent line

Slope of tangent line

HomePage | RecentChanges | Preferences

The picture below requires Internet Explorer+[Adobe SVG viewer] or [SVG enabled Mozilla]

Move the pointer over the picture to see the slope of the tangent line to `y=x^3-x=x(x+1)(x-1)` at different positions


Here are the ASCIIsvg commands that produced the interactive picture:


<script>
function f(x) { return x*x*x-x }
function update() {
  stroke = "red"
  py = f(px)
  h = .01
  dy = f(px+h)-py
  m = dy/h
  if (m>=0) {
    path([[px-.5,py-.5*m],[px+.5,py+.5*m],[px+.5,py-.5*m],[px-.5,py-.5*m]],"tangent")
    text([px+.5,py],m.toFixed(1),right,"rise")
    text([px,py-.5*m],"1",below,"run")
  } else {
    path([[px-.5,py-.5*m],[px+.5,py+.5*m],[px-.5,py+.5*m],[px-.5,py-.5*m]],"tangent")
    text([px-.5,py],m.toFixed(1),left,"rise")
    text([px,py+.5*m],"1",below,"run")
  }
  px = getX()
}
</script>

HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited September 23, 2007 2:25 pm (diff)
Search: