Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias newton {
- tokenize 126 $1-
- var %count 1
- var %guess $3
- while (%count <= 5) {
- var %funct $calc($replace($1,x,$+(*,$chr(40),%guess,$chr(41))))
- var %deriv $calc($replace($2,x,$+(*,$chr(40),%guess,$chr(41))))
- var %guess $calc(%guess - (%funct / %deriv))
- echo -a %guess
- inc %count 1
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement