0% found this document useful (0 votes)
13 views26 pages

Week 4 - Non Linear Equation

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)
13 views26 pages

Week 4 - Non Linear Equation

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/ 26

4 5 6

0 Non Linear 2
1 Equation 3
Week 4
Presented by :
Francesco Arthurito Santara Sepia Wulandari

7 8 9
Contents

Elements of Vector
Inline & Differential Eq.
Polynomial Functions
Solving with Open Method
Solving with Closed Method
Tip: Dont be disencouraged to ask
your practicum assistants if you dont
understand something

Bagian Favorit (Problems)


How: Good Luck
Elements of Vector
For an array that is defined in MATLAB to
represent coefficients of each term of a
polynomial equation

polyder (f)
poly2sym (f) polyval (f,c)
“fzero”
The ‘fzero’ function in MATLAB is a function that
finds the roots of a non-linear equation of a with inline command
single variable in form f(x) = 0.

Take an example of a non-linear equation having with m-file


only one variable.
F(x)=Cosx-x=0
By using calculator, we can solve it and the
answer is:
X = 0.7391
We have to find the roots of variable ‘x’ in the
above equation. Root is the value of ‘x’ where 4 is the initial guess and
function f(x) is equal to zero that’s why it is also ‘f’ or ‘fun’ is the function
called ‘finding a zero’ or ‘fzero’.
Matlab File For
Defining Functions
Functions provide more flexibility, primarily
because you can pass input values and return
Example output values. For example, this function named
fact computes the result of a polynomial
equation and returns the result (y).

This type of function must be defined within a


Save on separate Matlab file file, not at the command line. Often, you store a
(e.g."fun.m") function in its own file. In that case, the best
practice is to use the same name for the
function and the file (in this example, fact.m),
since MATLAB® associates the program with
the file name. Save the file either in the current
folder or in a folder on the MATLAB search path.
Inline
Create a non linear equation using the
“inline” function. You can use this
function in the same file.

Differentiate a function or symbolic


expression using the “diff” function

Diff
Solving Non-Linear Equations
An equation where one of the equations does not contain a
linear form is called a non-linear system of equations. Solving
non-linear equations aims to find the roots of the equation. The
root of an equation is the value on the x-axis where the function
curve intersects with the y-axis.

In numerical mathematics, this process is iterative!


Close Method
Graphic Method
Bisection Method Methods
Regula Falsi Method

Open Method
Methods Fixed Point Iteration Method
Newton Raphson Method
Secant Method
Close Method (1) Graphic Method
Close Method (2) Bisection Method

Bisection method is a popular solution


finding method of mathematics.

This method is applicable to find the


solution of any polynomial equation
f(x) = 0, provided that the solution lie
within the interval [a, b] and f(x) is
continuous in the interval.
PROCEDURES Bisection Method
5 4
Close 0 Regula Falsi Method.
Method (3)
In mathematics, a method of
2
solving an equation in one

3
variable is the false position
method or regula falsi method.

In simple words, the method is


described as the trial and error
approach of using “false” or
“test” values for the variable
and then altering the test value
according to the result.

9
5 4
Close 0 Regula Falsi Method.
Method (3)
2
3

8 9
0 5
Open Method
1
Fixed Point Iteration
6
2 Newton-Raphson Method
7
3
Secant Method 8
9
Open Method Fixed Point Iteration

This method finds the Examples


roots of the equation by
making the function f(x) f(x) = x - e^(-x) = 0 f(x) = x^2 - x - 1 = 0
x - e^(-x) = 0 x^2 - x - 1= 0
be the implicit function x = e^(-x) x = 1/(x-1)
form f(x) = 0, then x = e^(-x) = g(x) in this 1/(x-1) = g(x) in this
g(x). The iteration case case
used is in the form of an
equation;
Open Method Newton-Raphson Method (1)

The Newton-Raphson
method is a method of
finding the roots of a
function f(x) with a one
point approach, where
the approach is made
with a tangent /
gradient line.
Open Method Newton-Raphson Method (2)

1. Determine initial point x0

2. Find x1 using the following


formula

3. Iterate until desired error


Open Method Secant Method

The Secant method is 1. Determine x0 and x1


a root-finding
procedure in numerical 2. Find x2 using the following
analysis that uses a formula
series of roots of
secant lines to better
approximate a root of a
function f(x)
3. Iterate until desired error
PROBLEMS
Press D for drumroll
Problem 1
Create a program that can find the root value or extreme value
of a single variable non-linear equation inputted by the user by
entering the number of components of the equation in the form
of an array.

the user cannot input an array with an element that is 0


the maximum number of elements of the array is 5
use elements of vector (poly2sym,polyder,polyval, inline) for
root and extreme value finding procedure.
Output

NOTE
to use inline, the function in the
inline syntax must be defined as
poly2sym first, ex:
inline(f) with f=poly2sym('x^2+3')
1 5
0
1 Problem 2
IQAir wants to estimate of the amount
of air pollutants resulting from the
combustion reaction at a coal-based
6
2
help find the approximate
PLTU around Jakarta which is one of
the causes of air quality in Jakarta
getting worse. if the combustion
value of the pollutant (x)
from the equation using the
regula falsi OR bisection
7
reaction equation is known to be method as well as the
desired number of iterations
nonlinear with the function is :
3 and pollutant limit values
[a,b]

9
1 5
0 OUTPUT
1
6
2 7
3

9
Problem 3
The monsters are distributed around him in a randomized
manner, but can be represented with the equation

Mr. Satoru is stuck in a train


The humans distributed around him can also be
station with a bunch of
represented with the equation
monsters (which he needs to
kill) and humans (which he
needs to save). He can
expand a “sure-kill” domain Mr. Satoru’s judgement on the radius in which he would expand
that kills anyone within its him domain can be represented with the following equation
perimeters, with him as the
center, but he must consider
the optimal amount of
monsters killed and humans Where M(x) represents the amount of monsters, H(x) represents
saved. . the amount of humans, R(x) represents the Mr. Satoru’s
judgement, and x represents the radius from Mr. Satoru.
Problem 3
Optimize the radius of Mr. Satoru’s domain using the Newton
Raphson method, and Secant Method until the error is < 10^-3!
(Hint : To optimize a function, differentiate it first and find its root)

Output
5
0
1 6
Thank You!
2 Press C for confetti
7
3 bit.ly/AbsensiResponsiWeek4 8
4 9

You might also like