Advertisement
Charmander

script

Apr 5th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. alias newton {
  2.   tokenize 126 $1-
  3.   var %count 1
  4.   var %guess $3
  5.   while (%count <= 5) {
  6.     var %funct $calc($replace($1,x,$+(*,$chr(40),%guess,$chr(41))))
  7.     var %deriv $calc($replace($2,x,$+(*,$chr(40),%guess,$chr(41))))
  8.     var %guess $calc(%guess - (%funct / %deriv))
  9.     echo -a %guess
  10.     inc %count 1
  11.   }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement