100% found this document useful (1 vote)
2K views

Lab Report On False Position Method: Assignment 3

The document is a lab report on the false position method for finding roots of equations. It introduces the false position method, which uses intervals based on opposite signs at endpoints like bisection, but is computationally based on the secant method. It presents the graphical representation and algorithm, showing how it iteratively finds a root by determining the x-value where a secant line through two initial points crosses the x-axis. It includes a C program implementing the method to find the root of a sample function between initial values within a set error tolerance or maximum number of iterations.

Uploaded by

Samixa Timalcena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views

Lab Report On False Position Method: Assignment 3

The document is a lab report on the false position method for finding roots of equations. It introduces the false position method, which uses intervals based on opposite signs at endpoints like bisection, but is computationally based on the secant method. It presents the graphical representation and algorithm, showing how it iteratively finds a root by determining the x-value where a secant line through two initial points crosses the x-axis. It includes a C program implementing the method to find the root of a sample function between initial values within a set error tolerance or maximum number of iterations.

Uploaded by

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

Assignment 3

Lab report on False Position Method

Submitted By:
Ayush Timalsina
Jaya Multiple Campus
BCA , 4th Semester
Contents:

1. Introduction
2. Algorithm
3. Program
4. Conclusion
5. Reference
Introduction:
False position method is a root-finding algorithm that is
qualitative similar to the bisection method in that it uses intervals based
on opposite signs at the endpoints to converge to a root, but is
computationally based on the secant method.
Graphically,
In the given figure,
Let us consider a function f(x) and suppose two initial values x0 and x1
such that f(x0) f(x1)<0
Or,
F(x0) & F(x1) have opposite sign. Also the co ordinate of point A&B
are A[x1 f(x1)] and B[x0 f(x0)].
Let us draw a secant line passing through the point A&B which
intersects at the point x2 in x-axis.
Now,
Equation of the line joining the point of A & B.
Using two point formula

y= f(x0)+ f(x1)-f(x0) (x-x0)


x1 - x0
After assuming that x2 as a root and by putting the value of x as x2 we
get,
In general,
X(x+1)= x(x-1) f(xn) – xn f(xn-1)
f(xn) – f(xn-1)
This process continues until we find the root of desired accuracy.
Algorithm:

1. Start
2. Read the value of x0 ,x1 and e where x0 &x1 are initial guesses
and e is an error.
3. Compute f(x0) and f(x1).
4. Check if f(x0) f(x1)< 0
Go to 5
Else
Initial guesses donot bracket the root
5. Determine the value of x using
Formula:
X= x0f(x1) – x1 f(x0)
f(x1) – f(x0)

6. Check whether f(x) f(x0)<0


If true,
x and x0 bracket the root
x1=x
else,
x0=x
7. Check f(x)<e
If true, go to step 8
If false, go to step 5

8. Stop
Program:
#include<stdio.h>
#include<math.h>
float f(float x)
{
return 4*exp(- x) * sin(x) - 1;
}
int regula (float *x, float x0, float x1, float fx0, float fx1, int *itr)
{
*x = x0 - ((x1 - x0) / (fx1 - fx0))*fx0;
++(*itr);
printf("Iteration no. %3d X = %7.5f \n", *itr, *x);
}
int main ()
{
int itr = 0, maxmitr;
float x0,x1,x2,x3,allerr;
printf("\nEnter the values of x0, x1, allowed error and maximum iterations:\n");
scanf("%f %f %f %d", &x0, &x1, &allerr, &maxmitr);
regula (&x2, x0, x1, f(x0), f(x1), &itr);
do
{
if (f(x0)*f(x2) < 0)
x1=x2;
else
x0=x2;
regula (&x3, x0, x1, f(x0), f(x1), &itr);
if (fabs(x3-x2) < allerr)
{
printf("After %d iterations, root = %6.4f\n", itr, x3);
return 0;
}
x2=x3;
}
while (itr<maxmitr);
printf("Solution does not converge or iterations not sufficient:\n");
return 1;
}
Output:
Conclusion:
Hence , The false position method is a root-
finding algorithm that combines features from the bisection method and
the secant method. It is represented graphically and systematically that I
have already mentioned above.
Reference:
https://mathworld.wolfram.com/
https://calculus.subwiki.org/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy