SymCalc Ruby Examples
Not here for Ruby? You can choose another language
On this page, you will see some potential use-cases for SymCalc and more ways to work with it.
Let's get started!
Newton-Raphson method for solving roots
The Newton-Raphson method is an iterative algorithms that finds a zero of a function, and is used by computers to solve equations and estimate constants.
The method itself can be described like this: x[n] = x[n-1] - f(x[n-1]) / f'(x[n-1])
We'll implement the algorithm to estimate the square root of two with the highest possible prevision of a variable.
For this, let's start with an equation x = sqrt(2), and then rewrite it as x^2 = 2, then x^2 - 2 = 0. Now we can implement the Newton-Raphson method with SymCalc.