The Newton-Raphson method is one of the techniques used to numerically solve nonlinear equations. Numerically, this means solving equations with a specific numerical approach, the result of which will approximate the exact solution or even match the numerical result depending on the error used.

Suppose we want to find the root of a number, denoted as µ, then the equation is.

Furthermore, if µ = 67 we want to find the root of 67, and the equation is:

Using the syntax below, we will create a graph of the above equation.

func<- function(x) {x^2-67}curve(func, col = 'blue', lwd = 2, from = 0, n = 100, xlim=c(0, 9), ylab='f(x)')abline(a=0, b=0, lty = 5)

From the graph, we can see that the root x is at the point where f(x) = 0, which is between 8 and 9.

The solution for finding the root of the function using the Newton-Raphson method proceeds as follows, using xn as the initial guess.

The first derivative of f(x) is:

Using this formula, the following syntax is created:

`NR <- function(mu,x,iterasi){ #fungsi newton-raphson dengan tiga parameter `

#mu=sebarang nilai yang akan diakar,

#x=iterasi awal,

# iterasi=jumlah iterasi yang akan diinputkan

for(i in 1:iterasi){

x<- 0.5*(x+ mu/x) #formula newton-raphson

print(x) #mencetak output iterasi

}

}

From the output, it can be seen that we can use any number of iterations because the iterations will yield the same value if the difference |(xn+1) — xn| = 0. In other words, the iterations will produce a real root if |(xn+1) — xn| = 0. Therefore, if we return the function, we will immediately get the corresponding root value because the return function will call the value from the last iteration.

The syntax is as follows:

NR <- function(mu,x,iterasi){for(i in 1:iterasi){x<- 0.5*(x+ mu/x)}return(x)}

The iteration process, if done manually, is as follows:

So, it can be concluded that the root of 67 is 8.18535.