Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

tation to within e, 5.11 Determine the real root of x 80: (a) analytically and (

ID: 3599279 • Letter: T

Question

tation to within e, 5.11 Determine the real root of x 80: (a) analytically and (b) with the false-position method to within e, = 2.5%. Use initial guesses of 2.0 and 5.0. Compute the estimated error Ea and the true error after each 1.0% teration 5.2 Determine the real root of (x) 5r - 5x2 + 6r -2 (a) Graphically (b) Using bisection to locate the root. Employ initial guesses of 5.12 Given x0 and and iterate until the estimated error eg falls (x) = _206 _ 1.5x4 + 10x + 2 below a level of ,-10% 5.3 Determine the real root of (x)=-25 + 82x-90x2+ 44x 8r + 0.7x: (a) Graphically (b) Using bisection to determine the root to , 10%. Employ Use bisection to determine the maximum of this function. Emplo initial guesses ofx-0 and x, and perform iterations until the approximate relative error falls below 5%. 5.13 The velocity u of a falling parachutist is given by initial guesses of xi = 0.5 and x" = 1.0 (c) Perform the same computation as in (b) but use the false-1) nm position method and ' = 0.2% 5.4 (a) Determine the roots of f(x) =-12-21x+ 18x2 2.75x graphically. In addition, determine the first root of the function c- 15 kgs, computethe mass m so that the velocity is v 36 m/s with (b) bisection, and (c) false position. For (b) and ( a a 10 s. Use the false-position method to determine m to a level guesses of x1--1 and Xu-0, and a stopping criterion of 1% 5.5 Locate the first nontrivial root of sin x- x where x is in radi ans. Use a graphical technique and bisection with the initial interval an 82-k from 0.5 to 1 . Perform the computation until " is less than ,-2%. where g -9.81 m/s. For a parachutist with a drag coefficient ofe, = 0.1% 5.14 Use bisection to determine the drag coefficient needed so that parachutist has a velocity of 36 m/s after 4 s of free fall Note: The acceleration of gravity is 9.81 m/s2. Start with initial by substituting your final answer into guesses of 3 and x5 and terate until the approximate relative error falls below 2%. Also perform an error check by sub- the original equation 5.6 Determine the positive real root of In () 0.7 (a) graphi- stituting your final answer into the original equation. cally, (b) using three iterations of the bisection method, with initial guesses of x 0.5 andx2, and (c) using three iterations of the discharged from a cylindrical tank through a long pipe can be false-position method, with the same initial guesses as in (b) 5.7 Determine the real root of f(x) (0.8- 0.3x)/x: (a) Analytically (b) Graphically (c) Using three iterations of the false-position method and initial As depicted in Fig. P5.15, the velocity of water, v (m/s), computed as 2L guesses of 1 and 3, Compute the approximate error and the true error , after each iteration. Is there a problem with

Explanation / Answer

the required code is as follws :

graphical solving of the problem :

------------------------------------------------------------------------------------------------------------------------

#!usr/bin/env python

# importing numpy library to calculate the roots
import numpy
# roots.py

# storing the coeffecients as the array
coeffs = [0.7,-8,44,-90,82,-25]

roots = numpy.roots(coeffs)

# now array contains all the roots of the given equation

for root in roots :
   # if root is not complex then print the root ( real root )
   if type(root) != numpy.complex128:
       print root,


------------------------------------------------------------------------------------------------------------------

using the bisection method :

------------------------------------------------------------------------------------------------------------------

# define the bisection method
def bisection(eq,low,up,tol):
   # calculating the starting values of equation
   Fa = eq(low) #
   Fb = eq(up)
   if( Fa*Fb > 0): # bisection method is applied only when both the values are of opposite sign
       return -1
   while( up-low > tol ): # loop until tol is reached
       x = (low + up ) / 2.0
       f = eq(x)
       if( f* Fa > 0):
           low = x
       else:
           up = x
   return x # returning the root

def fun(x): # function deffinition
   return -25 + 82*x - 90 * x ** 2 + 44 * x ** 3 - 8* x ** 4 + 0.7 * x ** 5

# printing the roots
print bisection(fun,0.5,1.0,0.1)
       

----------------------------------------------------------------------------------------------------------

regulaFalsi method:

--------------------------------------------------------------------------------------------------------

# define the regula Falsi method
def regulaFalsi(low,high,tol):
   Fa = fun(low)
   while( high - low > tol ):
       # actual deffinition of Regula Falsi method
       p = (low * fun(high) - high* fun(low)) / (fun(high)- fun(low))
       Fp = fun(p)
       if(Fp == 0):
           return p
       if( Fa * Fp > 0 ):
           low = p
       else:
           high = p
   return p # return p after num of iterations


def fun(x): # function deffinition
   return -25 + 82*x - 90 * x ** 2 + 44 * x ** 3 - 8* x ** 4 + 0.7 * x ** 5

# printing the roots
print regulaFalsi(0.5,1.0,0.1)

------------------------------------------------------------------------------------------------------------

/* i have commented the code for you understanding */

/* in case any queries please comment */

/* thank you */

/* i have used the standard definitions for both the bisection and regular falsi methods */