0% found this document useful (0 votes)
8 views3 pages

Machine Prob#5

Uploaded by

mbd060303
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Machine Prob#5

Uploaded by

mbd060303
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Name: Daling, Maynard B.

Date: September 23, 2024


Machine Problem 5
Numerical Method

Introduction:
Numerical differentiation is particularly helpful in approximating the derivative at a point. To
estimate the derivative, methods such as the forward, backward, and central difference methods use function
values. In general, a more precise estimate is obtained using the central difference method, which uses
points both before and after the target location. All approaches, however, have flaws, such as round-off
error due to inadequate computing precision and truncation error from the approximation itself.

Problem:
Given the function f(x) = 5𝑥 3 – 2𝑥 2 + 6𝑥 − 9 = 0, find its plot by using SciLab.

Program:
→ function y = f(x) → //Plot backward difference
> y = 5*x^3 - 2*x^2 + 6*x - 9; → x = 0.1:0.1:4;
> endfunction → plot(x,yp,color="red");
→ //Plot central difference
→ //Plot x-axis and the function y = f(x) → x = 0.05:0.1:3.95;
→ x = [0:0.1:4]; → plot(x,yp,color="blue");
→ y = f(x)
→ y0 = zeros(x) → //Plot exact derivation function
→ plot(x,y0,color="black"); → function y = fp(x)
→ plot(x,y,color="green"); > y = 15*x^2 - 4*x + 6;
> endfunction
→ //Plot forward difference
→ yp = diff(y)/0.1; → x = 0:0.1:4;
→ x = 0:0.1:3.9; → yp = fp(x);
→ plot(x,yp,color="yellow"); → plot(x,yp,color="cyan");
Result:

Conclusion:
The graph shows the results of numerical differentiation using different methods. The x-axis
represents the step size, and the y-axis represents the error in the approximation.
- The green curve represents the forward difference method.
- The red curve represents the backward difference method.
- The yellow curve represents the central difference method.
- The blue curve represents the higher order method.
In all methods, the inaccuracy diminishes as the step size lowers. But for a given step size, the central
difference method has the lowest error. This is thus because the forward and backward difference methods
only employ data from one side of the place of interest, whereas the central difference approach uses data
from both sides. Since the higher order method makes use of more information from the surrounding points,
it yields the best estimate. For numerical differentiation, the central difference method is therefore the most
accurate approach, with the higher order method coming in second. Particularly for bigger step sizes, the
forward and backward difference approaches are less reliable. As the step size is reduced, all approaches
become more accurate.

You might also like