! newton
! NEWTON   TRU   First do split 10 ; mode 40   Show code
!                then run.
!                I modified code to show iterative method   x=(x+1)^(1/5)
!                Also told story about autopilots and starting guess.
! NEWTROD  TRU   Shows newton method geometrically written by Rod Smart
! NEWTSPIR TRU   Gives a spiralling convergence picture
! NEWTCHAT TRU   Starting too far away   chatters

def f(x) = x^3+x+1
def fp(x) = 3*x^2+1
let x = -1
do
  call printit(x,f(x))
  let x = x - f(x)/fp(x)
loop
end

sub printit(x,y)
   let fm$="###.##############    +#.#^^^^"
   print using fm$: x,y
   get key a
end sub



