Initialization: The Bisection Method Is Initialized by Specifying The Function F (X), The
Initialization: The Bisection Method Is Initialized by Specifying The Function F (X), The
Initialization: The Bisection Method Is Initialized by Specifying The Function F (X), The
One of the first numerical methods developed to find the root of a nonlinear equation f
(x) =0 was the bisection method (also called binary-search method). Since the method
is based on finding the root between two points, the method falls under the category of
bracketing methods. Given a closed interval [a, b] on which f (x) changes sign, we
divide the interval in half and notethat f must change sign on either the right or the left
half (or be zero at the midpoint of [a, b].) We then replace [a, b] by the half-interval on
which f changes sign. This process is repeated untilthe interval has total length less
than . In the end we have a closed interval of length less than on which f changes sign.
The Intermediate Value Theorem (IVT) guarantees that there is a zero of f in this
interval. The endpoints of this interval, which are known, must be within of this
zero.
The method is based on the following algorithm:
Initialization: The bisection method is initialized by specifying the function f (x) , the
interval [a,b], and the tolerance > 0. We also check whether f(a) = 0 or f(b) = 0, and if so
return the value of a or b and exit.
There are various methods available for finding the roots of given equation such as
Bisection method, False position method, Newton-Raphson method, etc. Here in our
experiment our instructor are about to explain Bisection method for finding the roots of
given equation. He also explain that NI labVIEW have a capable program for Bisection
method. Bisection method is very simple but time-consuming method. In this method,
we first define an interval in which our solution of the equation lies. As the name
indicates, Bisection method uses the bisecting (divide the range by 2) principle. In this
method, we minimize the range of solution by dividing it by integer 2.Following are the
steps to find the approximate solution of given equation using Bisection method:
Let us assume that we have to find out the roots of f(x), whose solution lies in the range
(a,b), which we have to determine. The only condition for bisection method is that f(a)
and f(b) should have opposite signs (f(a) negative and f(b) positive). When f(a) and f(b)
are of opposite signs at least one real root between ‘a’ and ‘b’ should exist.
x0=(a+b)/2
If f(x0) is negative the root lies between a and x0. If f(x0) is positive the root lies
between x0 and b.
In this taking midpoint of the range of approximate roots, finally, both values of range
converge to a single value, which we can take as an approximate root.
Here in our experiment we were able to create a VI of algorithm for bisection method, by
looking for the bisection method of the equation to find the roots of
“f(x)=5sin2x+cos2x+2x” and also we were asked to have a graph, upon following all the
given instructions given by our professor. As we conduct this experiment, we dragged
all the icon needed from the labVIEW tools palette to create a mathematical method of
bisection method. Here below are the work done example during our laboratory period:
Fig 1. Code
Fig 2. Output
EXERCISE PROBLEM
Here in our Numericals laboratory subject, we are not only limited to the given example
by our instructor, we are lucky that our instructor allows us to be able to explore the
surface of National Instruments LabVIEW upon exploring the internet and giving us a
task or problem. Here are the following exercise that I generated through the labVIEW
software:
1.) Modify the VI for testing the condition fxl=fxu<0 without using a mathscript node.
CODE:
OUTPUT:
2.) Modify the VI such that numeric values of 1 and 0 are used as the inputs for the case
selector. 1 means valid xl and xu while 0 means invalid xl and xu. A select function must
be used for this purpose.
CODE:
OUTPUT:
3.) Create a new VI that will perform the calculation of finding the roots of f(x)=x³+cos3x
by means of Bisection Method. The graph of f(x) will help as a guide in finding all the
roots of f(x). If the inputs for xl and xu are invalid values, the VI will display “Invalid
values for xl and xu. Input another values.”. The VI will not terminate but instead it will
continue running and accepting again in new values for xl and xu. Once valid values of
xl and xu are detected, the VI will find the root and terminate according to the required
setting of tolerance.
CODE:
OUTPUT:
If the xl and xu input is valid:
For my experiment analysis, we first analyzed some of the conventional root finding
methods and their limitations, by looking for the roots of “f(x)=5sin2x+cos2x+2x”. As I
read some of the example analysis in the internet they all configured that the bisection
always converges but is slow. Newton has quadratic convergence but may fail in some
of the cases. Secant is a good alternative to Newton but it oscillates in some of the
cases and fails to converge. It is explained that it is important that we safeguard
bisection to detect cases where we don’t have any roots. The question of guessing the
bound is more intuitive. The other method like Newton’s method have a disadvantage
that higher order roots can cause convergence to be slow,and the sequence may take
undesirable jumps between roots or take a very large step upon encountering an
reflection point. One case where it fails is when derivative of function f(x) is either zero
or infinite then it fails to converge. We have proposed a new method by combining
Bisection method with other methods. So, that we can find roots as well as the method
can be fast in solving. The multidimensional bisection method allows to solve
constrained minimization problem when the feasible region is in dimensional simplex.
This method does not require a differentiability of function and is guaranteed to
converge to the minimize for the class of strictly unimodal function. So as the given
example by our instructor, we used the mathscript inside the case structure and the
while loop and connecting each shift register from the mathscript node outside the
structure to make all the function works from the front panel.
The said code from the mathscript is the reference used to the problem/s part of the
experiment, and the other part were just adjusting the value given according to the
problem. Here is the mathscript code inside the while loop inside the case structure:
fxl=5*sin(2*xl)+5*cos(2*xl)+2*xl
xrnew=(xl+xu)/2
ea=abs((xrnew-xr)/xrnew*100)
xr=xrnew
fxr2=5*sin(2*xr)+5*cos(2*xr)+2*xr
test2=fxl*fxr2
if(test2<0)
xu=xr
else
xl=xr
end
and here is the Mathscript code used as the node connecting to the while loop:
fxl=5*sin(2*xl)+5*cos(2*xl)+2*xl
fxu=5*sin(2*xu)+5*cos(2*xu)+2*xu
test=fxu*fxl
As we proceed here in our experiment problem, at first part we are simply also having
almost the same code but the difference is we are not ask to use the Mathscript as the
node to Modify the VI for testing the condition fxl=fxu<0 so I just copy the same steps
and change the mathscript nodes using the Trigonometric functions palette, putting the
constant values, and putting the proper numeric operation/s. And I finally got the same
function as the for testing the condition fxl=fxu<0 with mathscript node.
For the next problem, we were asked to modify the VI such that numeric values of 1 and
0 are used as the inputs for the case selector. 1 means valid xl and xu while 0 means
invalid xl and xu. I used the same Mathscript code,but different values input, inside the
case structure. And there seems to be a small struggle for me, because at first I
struggle to understand the “A select function must be used for this purpose.” Which
lately I understood, through research more specifically, that it the select function is
important here because it returns the value wired to the t input or f input, depending on
the value of s. If s is TRUE, this function returns the value wired to t. If s is FALSE, this
function returns the value wired to f. So, I used the connector pane:
It is because it displays the default data types for this polymorphic function and as
asked by the problem also. The result of this part is discussed in the conclusion part.
And for the last part of this experiment’s given problem, we were asked to create a new
VI that will perform the calculation of finding the roots of f(x)=x³+cos3x by means of
Bisection Method. And make the message index displays asking to put another value if
the input in the given were invalid values and will accept and continue running if the
value in fxl and fxu inputted is acceptable. I used the same Mathscript code inside the
case structure and inside the while loop structure but with different values according to
the given, and the mathscript in the nodes connecting inside and is also inside the
another while loop structure . I notice in this part that if the value of either fxu or fxl is
having the same sign (“+” or “–“) , the value will become invalid, meanwhile if either is
having different sign, we will be able to have an acceptable value and make the solution
exist.
CONCLUSION
As for my conclusion, as we were able to met this experiment’s objective which enables
us to identify and understand Bisection Method through the LabVIEW program. And to
deeply understand it through the use of while loop functions, case structures, different
numerical operators, Mathscript and so on and so forth with different explanation from
lecture, example execution,internet, and numbers of exercise given. And ,as I
mentioned, we were able to create a useful VI program employing Bisection Method.
Since the method is based on finding the root between two points, the method falls
under the category of bracketing methods. Given a closed interval [a, b] on which ) (xf
changes sign, we divide the interval in half and note that f must change sign on either
the right or the left half (or be zero at the midpoint of [a, b].) We then replace [a, b] by
the half-interval on which f changes sign. This process is repeated until the interval has
total length less than . In the end we have a closed interval of length less than on which
f changes sign. The Intermediate Value Theorem (IVT) guarantees that there is a zero
of f in this interval. The endpoints of this interval, which are known, must be within of
this zero.
I am able to understand that Bisection method in labVIEW is pretty easy, but you just
properly put the proper codes in your MathScript. In this experiment, we were given a
proper code already we just need to change the value and identify whether the code
runs properly well in different problem. In part 1 of the problem, we don’t have a
problem in the code because, it is just the same as the given example, we just need to
employ it by changing the nodes instead of Mathscript. For part 2, we just change the
constant given and make values of 1 and 0 are used as the inputs for the case selector,
again with the same code as given from the example is executed in this part. And for
the last problem, we adjusted the code because there is different given equation, but it
is just the same as the reference.
And to conclude, this experiment helps us to get the basic idea of Mathscript, and with
that we were able to meet the experiment’s objective which are to be able to build and
modify labVIEW VI for bisection method, and to be able to apply the algorith for the
bisection method in finding the roots of an equation. And with saying these, I could say
that the experiment is useful and accurate to learn the Bisection Method in labVIEW for
us as a student.
REFERENCE
ECE 100 Fundamentals of Labview Programming (n.d.) Retrieve from:
https://www.academia.edu/29355306/ECE_100_Fundamentals_of_LabVIEW_Program
ming_WHILE_LOOP_FOR_LOOP_FUNCTIONS_AND_SHIFT_REGISTER_Activity_No
._4_I._INTENDED_LEARNING_OUTCOMES
Mathematical Modeling and Simulation using Labview and Labview Mathscript (2012)
Retrieve from:
https://www.asee.org/public/conferences/8/papers/4561/download+&cd=3&hl=en&ct=cl
nk&gl=ph