# Setting up Newton Raphson integral with matlab

• MATLAB
• Moly
In summary, the conversation discussed using the Newton Raphson method to find the root of an equation involving an integral. The integral was evaluated using the trapazoidal rule and the simplified version of the equation was given. The speaker was struggling with integrating for x and solving for y, but another person pointed out that the integral can be solved exactly and then Newton's Method can be applied. The speaker then mentioned they still had a question to post later.

#### Moly

Hi All.

I have an equation that i want to numerically find the root of by using Newton Raphson. However the equation involves an integral which i am using the trapazoidal rule to evaluate. And here is the simplified version of it:
$$1 = e^{-cy} \int_0^1 e^{-y(1-x)} dx$$

So i am supposed to integrate for x and then solve the resulting equation for values of y. How do i do that??

If i just wanted to do the integration, i would have used "syms" and found the result in terms of y... but i am totally stumped with this... please... SOS!

Well, look inside the integral. The variable is x, y is a constant inside the integral. We can easily solve that integral exactly, no need to approximate that integral.

After that, you will have on the RHS some exponential terms divided by y, which is easy to apply Newtons Method to.

Thanks Gib.
I figured where i went wrong.. i still have a question that i will post later today

## 1. What is the Newton-Raphson method?

The Newton-Raphson method is an algorithm used to find the roots of a given function. It is an iterative process that uses the derivative of the function to approximate the roots.

## 2. How do you set up Newton-Raphson integral in Matlab?

To set up Newton-Raphson integral in Matlab, you will need to define the function you want to find the roots of, its derivative, and an initial guess. Then, you can use a loop to iteratively update the guess using the Newton-Raphson formula until the desired accuracy is achieved.

## 3. What are the advantages of using the Newton-Raphson method?

The Newton-Raphson method is a fast and efficient way to find the roots of a function. It often requires fewer iterations compared to other methods, making it a popular choice for numerical analysis. It also has a quadratic convergence rate, which means that the number of accurate digits doubles with each iteration.

## 4. What are the limitations of the Newton-Raphson method?

The Newton-Raphson method may fail to converge if the initial guess is not close enough to the root or if the function has multiple roots. It also requires the function to be differentiable, which may not be the case for some functions. Additionally, it can be computationally expensive for more complex functions.

## 5. How can I improve the performance of the Newton-Raphson method in Matlab?

To improve the performance of the Newton-Raphson method in Matlab, you can adjust the initial guess or use a different method if the function is not suitable for this approach. You can also try using a faster convergence criterion or parallelizing the code for faster execution.