Sunday 31 March 2013

Finding Square Root in Scala

Scala
After completing the Algorithms I course by Robert Sedgewick, I am now taking the Functional Programming Principles in Scala by Martin Odersky. 

The following is a Scala snippet for finding the square root:

A graphical representation of Newton's method for finding the nth root.

Newton's method updating rule 
The higher order terms O(h^2) have been dropped in the f(x+h) approximation, since it is a linear approximation.








The updating rule x_(n+1):








Happy Easter! :)

No comments:

Post a Comment