## Newtons Method Assignment Help

We all know Isaac newton as one of the greatest scientists of all time. Most people know him because he proposed the law of gravity. But did you know that he was involved in so many scientific discoveries? There are a number of laws in physics that he came up with, which a reconsidered integral to most physics researches, this has made his name famous. Though he died centuries ago his theories still exist. Perhaps you would like to know more about the things that he came up with. But here we will focus on one of his mathematical discoveries used to find the root of an equation. It’s known as the newton’s method or Newton-Rhapson method. It’s named after two scientists who are believed to have contributed to its formulation. There is a lot that you will learn about this method.

## Newton’s method

Newton Rhapson method bears a lot of resemblance to the secant root finding method. However, the Newton method is considered superior to other root-finding methods as most practitioners consider it as a more accurate method. Root finding is the process of solving a function by equating it to zero. The values found are known as the roots of the equation.

Newton’s algorithm operates by finding the first initial guess of the equation. This value is then used to approximate the value of the tangent line. Once we have the tangent line, we then use it to compute the x-intercept, which will be a better approximation of the roots of the equation. If we do not find the roots, the process can be repeated a number of times until we find the root. The secret lies in how close the first root is to convergence.

### Steps in finding the roots of an equation.

Now that we understand how the Newton Rhapson method works, you can go ahead and find the solution to the equations. Here is a general guideline that you should follow.

- The first task is to verify if the equation is differentiable. An equation that is not differentiable will not yield the results. Therefore, you cannot go any further with the process of finding the solution if it’s not differentiable.
- Once you verified its differential, get its derivative.
- Guess the initial value to use.
- Use newton’s iteration formula to get the next value, which is a better approximation of the root.
- Then iterate the process from step 2 until you find the roots of the equation.

### Major problems with newton’s method

Though Newton’s method is considered as the most superior root finding method, it has its challenges, especially when you are computing it. Here are the difficulties associated with Newton’s method.

#### 1. Problems in finding the derivatives

Note that without finding the derivative, there might be no convergence. The effect of this is that we may not find the roots at all. Depending on the equation that we have, we might find it easy to arrive at the derivative or very complicated. At times, equations do not have a derivative at all. In real life, the analytical expression of the derivative might be extensive.

#### 2. Failure to converge

Newton’s method has its own challenges too. Most of the time, we believe the root-finding method will converge. But it’s not so in most cases. Here are some of the instances when the method might not converge.

- The initial starting point is crucial. If you have a bad starting point, there is a chance that the method might not converge. It might be that the value with which you start does not lie in the interval where the method converges. In such a case, the bisection method could be the best method. Another issue arises when the starting point is a stationary point. Sometimes the starting point enters an infinite circle, which prevents the method from converging.
- Derivative issues. Of course, from calculus, we know that a function that is non-differential will not converge. But the effect of this is largely felt if the function used is not differentiable.

#### 3. Stationary points

Sometimes, while calculating the roots of a function, we encounter stationary points. But the stationary points have a zero derivative and we won’t be able to find the roots of the equation.

#### 4. Slow convergence

The process of finding the convergence might be slow, especially where we have a multiplicity of values larger than 1. Again, if the roots are close together, it might need a number of iterations before the roots are found.

### Applications of newton’s method

#### Optimization problems

In its basic form, optimization is finding the maximum and the minimum of a function. In a real-life scenario, you could be asked to find the value that optimizes the profits of the business. This is quite complex but uses the same idea. Various methods can be used to calculate the optimum values. Newton’s method is one way that can be used to calculate the maximum and minimum values.

Solving the transcendental equation.

These types of equations have transcendental functions. Transcendental functions are functions that cannot be written in polynomial forms. Solving such solutions can be very hard. Examples are log(x) and sin(x) because they are not polynomials.

#### Newton method in MatLab.

Most statistical software is good at finding the roots of an equation using newton’s method. However, most of the time, in your academic life, you will be using Matlab as it has been incorporated into the academic curriculum of so many institutions.

Generating the roots in Matlab requires you to have good knowledge of creating user-defined functions. It’s not a complex one, and you could make it within no time. In most of the other cases, the function prompts the user to enter the equation and the first guess. In some cases, you can develop it to solve a specific equation. But in this case, you need not prompt the user to enter any equation or an initial guess.

## Where can I get quality assignment help?

Matlab assignment experts is a platform dedicated to helping students with their assignments. Contact us with that assignment which t you think you are short of time to solve, and we will help you submit it on time along with scoring a high grade. Our skilled experts possess in-depth knowledge of newton’s method and can help you solve any task which seems challenging to you. To them, it could just be a piece of cake. They always abide by the instructions issued with each assignment to ensure you get the grade that you always desire.

For years we have been serving clients from different parts of the world. They have complimented us for the excellent services that we offer. Others have gone to become our brand ambassadors. Giving you high-quality assignment solutions is in our DNA. We do not disappoint our clients.

For any Matlab related assignments, do not hesitate to contact us. We will be more than willing to help you. Our generous experts are always on the lookout for challenging assignments where they can offer help at an affordable cost.

Use the email [email protected] to contact us for any kind of assignment help. Remember to use the subject line ‘help with newton’s method assignment.’ Immediately after we receive the email we shall contact you detailing what you are required to do next. Once everything is sorted out, we shall start working on the assignment solution. On the other hand, you could click on the ‘submit your assignment’ button on our web page to avail of assignment help from us. Follow the steps that follow to get us working on the assignment solutions. It generally takes very little time to complete the process.

This sample MatLab assignment solution showcases the derivation of newton’s method using MatLab. It has been used to solve problems in chemical reaction engineering subjects. In this example, two stirred tank reactors are connected in series. One compound is being converted into another in two reactors. The unconverted compound and the product are being separated in a separation unit and the unconverted compound is being recycled back. The expert states that the total cost of the system is a function of conversion factors in two reactors. The tutor has demonstrated to find out optimal conversion factors in two reactors for which the total cost of the system is minimum. The cost function in terms of two conversion factors is given as follows,

The expert has derived a version of Newton’s method for solving this problem and has compared it with the solution obtained by fminsearch. He has also calculated the Hessian.

**SOLUTION : –**

clc

clear

format long

% Function Definition (Enter your Function here):

syms X Y;

f = (X/(Y*(1+X)^2))^0.6+((1-X/Y)/(1-Y)^2)^0.6+6*(1/Y)^0.6;

% Initial Guess (Choose Initial Guesses):

x(1) = 0.2;

y(1) = 0.4;

e = 10^(-8); % Convergence Criteria

i = 1; % Iteration Counter

% Gradient and Hessian Computation:

df_dx = diff(f, X);

df_dy = diff(f, Y);

J = [subs(df_dx,[X,Y], [x(1),y(1)]) subs(df_dy, [X,Y], [x(1),y(1)])]; % Gradient

ddf_ddx = diff(df_dx,X);

ddf_ddy = diff(df_dy,Y);

ddf_dxdy = diff(df_dx,Y);

ddf_ddx_1 = subs(ddf_ddx, [X,Y], [x(1),y(1)]);

ddf_ddy_1 = subs(ddf_ddy, [X,Y], [x(1),y(1)]);

ddf_dxdy_1 = subs(ddf_dxdy, [X,Y], [x(1),y(1)]);

H = [ddf_ddx_1, ddf_dxdy_1; ddf_dxdy_1, ddf_ddy_1]; % Hessian

S = inv(H); % Search Direction

% Optimization Condition:

while norm(J) > e

I = [x(i),y(i)]’;

x(i+1) = I(1)-S(1,:)*J’;

y(i+1) = I(2)-S(2,:)*J’;

i = i+1;

J = [subs(df_dx,[X,Y], [x(i),y(i)]) subs(df_dy, [X,Y], [x(i),y(i)])]; % Updated Jacobian

ddf_ddx_1 = subs(ddf_ddx, [X,Y], [x(i),y(i)]);

ddf_ddy_1 = subs(ddf_ddy, [X,Y], [x(i),y(i)]);

ddf_dxdy_1 = subs(ddf_dxdy, [X,Y], [x(i),y(i)]);

H = [ddf_ddx_1, ddf_dxdy_1; ddf_dxdy_1, ddf_ddy_1]; % Updated Hessian

S = inv(H); % New Search Direction

end

% Result Table:`

Iter = 1:i;

X_coordinate = x’;

Y_coordinate = y’;

Iterations = Iter’;

T = table(Iterations,X_coordinate,Y_coordinate);

% Plots:

fcontour(f, ‘Fill’, ‘On’);

hold on;

plot(x,y,’*-r’);

grid on;

% Output:

fprintf(‘Initial Objective Function Value: %d\n\n’,subs(f,[X,Y], [x(1),y(1)]));

if (norm(J) < e)

fprintf(‘Minimum succesfully obtained…\n\n’);

end

fprintf(‘Number of Iterations for Convergence: %d\n\n’, i);

fprintf(‘Point of Minima: [%d,%d]\n\n’, x(i), y(i));

fprintf(‘Objective Function Minimum Value after Optimization: %f\n\n’, subs(f,[X,Y], [x(i),y(i)]));

disp(T)

% Cost = @(X,Y) (X./(Y.*(1+X)^2)).^0.6+((1-X./Y)/(1-Y).^2)^0.6+6*(1/Y).^0.6;

v=[0.2,0.4];

w=fminsearch(@two_var,v);

function b = two_var(v)

x = v(1);

y = v(2);

b = (x./(y.*(1+x)^2)).^0.6+((1-x./y)/(1-y).^2)^0.6+6*(1/y).^0.6;