Securing Higher Grades Costing Your Pocket? Book Your Assignment at The Lowest Price Now!


Get assignment help service to meet the high expectations of your professors

GET ASSIGNMENT HELP

Project 1 / Functions - A Newton Scanner

Project 1

Please develop the function ScanForRoots to scan a given function f(x) for it’s roots using the newton’s algorithm.

The Interface

The program should read the following input parameters from an input file. The file’s format is given as follows.

  • [max number of roots to find]
  • [lower bound: lb] [upper bound: up] [step width: sw]
  • [precision eps] [stepwidth h] [max iteration: ix]

The program should search the root of a function with the starting position x0. The starting position x0 should be taken from the interval which is described by the parameters ub, lb and sw read from the input file. The found roots of the function should be saved in an dynamical array, which should be a parameter of the function ScanForRoots The size of the array should be set by a parameter, which is read from the input file.

An example data file is given below.

  • 10
  • -10. +10. 0.1
  • e-7 0.01 100


In the project a reasonable interval should be selected to be able to check the quality of the developed software.

The Function ScanForRoots

So the interface to ScanForRoots is the following.

integer function ScanForRouts(f,lb,ub,sw,eps,h,maxit,roots)

Parameter

Type Comment

f

function function to analyse

lb

real(8)

lower bound of search interval

ub

real(8)

upper bound of search interval

sw

real(8)

step width for the starting position x0

eps

real(8)

precision for the newton algorithm

maxit

integer

maximal number of iteration for one root search

roots

real(8)

one indexed array for the found roots

The return value of ScanForRoots should give the number of found roots. The roots should not be stored multiple.

The main program which should call ScanForRoots should do the following.

  • open, read and close the input file ScanForRoots.inp.
  • call ScanForRoots1 to search for the function’s roots.
  • write a little report which gives a list of the found roots
Assignment Help Features
Assignment Help Services
  • Assignment Help
  • Homework Help
  • Writing Help
  • Academic Writing Assistance
  • Editing Services
  • Plagiarism Checker Online
  • Proofreading
  • Research Writing Help
QR Code Assignment Help
elearningfeeds