[go: up one dir, main page]

0% found this document useful (0 votes)
64 views2 pages

Assignment 01 - SP22

This document contains instructions for an assignment on solving non-linear equations numerically. It includes 5 questions asking students to find roots of various equations using methods like bisection, false position, secant, Newton-Raphson, and iteration. Students are asked to write C++ programs to implement some of the methods. They are also asked to design a hybrid algorithm combining bisection and Newton-Raphson and use it to find the root of a quartic equation.

Uploaded by

Fatima Mahsud
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
0% found this document useful (0 votes)
64 views2 pages

Assignment 01 - SP22

This document contains instructions for an assignment on solving non-linear equations numerically. It includes 5 questions asking students to find roots of various equations using methods like bisection, false position, secant, Newton-Raphson, and iteration. Students are asked to write C++ programs to implement some of the methods. They are also asked to design a hybrid algorithm combining bisection and Newton-Raphson and use it to find the root of a quartic equation.

Uploaded by

Fatima Mahsud
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/ 2

COMSATS University, Islamabad

Islamabad Campus
Department of Computer Science

Read before Attempt


Assignment No. 1: Solution of Non- Linear Equations
Course code and Title: CSC475: Numerical Computing
Instructor: Shawana Jamil
Assigned Date March 1, 2022 Due Date: March 7, 2022
Total Marks: -- 10 CLO-1:
Instructions:
1. Read Chapter 5(Bracketing Methods) and Chapter 6(Open Methods) of the given book.
Numerical Methods for Engineers Seventh Edition by Steven C. Chapra and Raymond P.
Canale. 
2. This is an individual assignment. You will submit your work individually.
3. Try to consolidate your concepts and ideas from these questions.
4. Try to make solution by yourself and protect your work from other
students. If I found the solution files of some students are same, then I will
reward zero marks to all those students.
5. Deadline for this assignment is March 7, 2022. This deadline will not be extended.
Question # 1
a) Find the root of the equation cosx -5x +2 = 0 between 0.4 and 0.6 correct to four decimal places(4dp)
using Bisection method.

b) A new method for solving a nonlinear equation f(x) = 0 is proposed. The method is similar to the
bisection method. The solution starts by finding an interval [a, b] that brackets the solution. The first
estimate of the solution is the midpoint between x = a and x = b. Then the interval [a, b] is divided into
four equal sections. The section that contains the root is taken as the new interval for the next iteration.
Write a user-defined function(program) that solves a nonlinear equation with the proposed new
method. Name the function Xs = QuadSecRoot(Fun, a, b), where the output argument Xs is the
solution. The input argument Fun is a name for the function that calculates f(x) for a given x (it is a
dummy name for the function that is imported into QuadSecRoot), a and bare two points that bracket
the root.
The iterations should stop when the tolerance, is smaller than 10-6 xNs (xNs is the current estimate of
the solution).
Use the user-defined QuadSecRoot function to solve the equation cosx -5x +2 = 0
Question # 2
a) Find the root of the equation cosx = 5x - 2 between 0.4 and 0.6 correct to four decimal places using
method of false position (Regula Falsi method).
b) Write a computer program (in C++) to implement the method.

SP22 Page 1
Question # 3
a) Find the root of the equation 2coshx*sinx =1 using secant method, with an accuracy of 5 dp. Take 0.4
and 0.5 as the two starting values.
b) Write a computer program (in C++) to implement the method.
Question # 4
a) Find the root of the equation f(x) = x3 -2x -2, correct to 3dp, using Newton Raphson method.
b) Bisection algorithm and Newton-Raphson algorithm are discussed in class. Design a new algorithm to
compute the roots of nonlinear equations f(x)=0 by combining Bisection algorithm and Newton-
Raphson algorithm. Here is the Pseudocode:
Given f , f’, a , b , and δ=10-6 (tolerance)
Step 1 : for i=1 to 2
Step 2 : xi = (a+b) / 2
Step 3 : if f (xi ) = 0 or f (xi ) < δ , then step 10
Step 4 : if f (a) * f (xi) < 0 , then b= xi
Step 5 : else a = xi
Step 6 : end for
Step 7 : x = xi - [ f ( xi ) / f’(xi) ]
Step 8 : if f (x) < δ , then go to step 10
Step 9 : xi = x , and go to step 7
Step 10 : stop iteration .
Find the real root of quartic function f(x) = x4 +3x3 – 15x2 -2x + 9 with tolerance δ=10-6 using
i. Bisection Method
ii. Newton Raphson Methods
iii. Hybrid Algorithm
c) Compute the approximate percent relative errors for your solutions in part i, ii, and iii.

Question # 5
π
a) Find the root of the equation 2x -cosx -3 = 0 correct to 3dp, using iteration method. Take x0 ¿
2
b) Write a computer program (in C++) to implement the method.

SP22 Page 2

You might also like