0% found this document useful (0 votes)
35 views1 page

Sorting, Finding Root of A Function Using Bisection and Regula Falsi Methods

This document provides instructions for solving problems related to sorting, finding roots of functions using bisection and regula falsi methods. It describes the general process for each method using mathematical formulas. It then lists 4 problems - the first asks to sort a list using a Python program, and the next 3 ask to find the root of a quadratic function using bisection, regula falsi, and then comment on the speed and accuracy of the two root-finding methods. The document provides details on testing corner cases for the root-finding algorithms.

Uploaded by

ManojKumar
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)
35 views1 page

Sorting, Finding Root of A Function Using Bisection and Regula Falsi Methods

This document provides instructions for solving problems related to sorting, finding roots of functions using bisection and regula falsi methods. It describes the general process for each method using mathematical formulas. It then lists 4 problems - the first asks to sort a list using a Python program, and the next 3 ask to find the root of a quadratic function using bisection, regula falsi, and then comment on the speed and accuracy of the two root-finding methods. The document provides details on testing corner cases for the root-finding algorithms.

Uploaded by

ManojKumar
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/ 1

CS1201 Work Sheet 1

Sorting, Finding root of a function using bisection and regula falsi methods
General Instructions: Create a folder using your ID number as the name of the folder. Keep all your files
within this folder. At the end of the work session, you tar and gzip this folder using tar cvfz <your
idnumber>.tgz <folder name> command and upload the zipped file. For nth problem, the program names
should be probn.py. If you need to create a text file to write your answers for nth problem, use probn.txt file
name. If multiple programs are to be submitted for nth problem, use the convention probnA.py, probnB.py
and so on. AND do not panic!

Instructions for the program: You must have the comments describing what the subsequent python codes
do in your program.

Bisection Regula Falsi


f (x) f (x)

L+R Rf (L)Lf (R)


C= 2
C= f (L)f (R)

C
L R x L C R x

Problems

1. Sorting: You know from the class that the sorting of a list can easily be performed using the swaping of
values. Write a program which will sort the following list in ascending order:

A = [4, 3, 1, 2, 7, 3, 8, 9] .

Your program must print the list after sorting along with the number of iterations it used.

2. Bisection: Find the root of a function of the form x2 16x + 15 using the bisection method using
a tolerance of 106 . The bracketing interval is [-20,14]. Your program should print the number of
iteractions needed, the exact root (you can easily solve the equation), the computed root (using bisection)
and their difference. Your program must have the following features:

It must check whether any of the bracketing points are root of the given function (check with
[15,20].
It must check whether you have a good bracketing interval (check with [2,4]).
It must check whether during iterations it has accidentally reached the exact root (check with
[0,2]).

3. Regula Falsi: Repeat the above using Regula Falsi method.

4. From the number of iterations and the difference between the exact and the computed value of the root,
comment on the speed and the accuracy of these methods.

IISER Kolkata 1

You might also like