0% found this document useful (0 votes)
143 views8 pages

Numerical Methods in Engineering Lab (ME-319) : Manuals

This document provides algorithms for numerical integration and linear regression. It introduces numerical methods and their importance in engineering. It then provides pseudocode for the Trapezoidal, Simpson 1/3rd, and Simpson 3/8th rules for numerical integration of functions. Finally, it provides an algorithm to fit a linear regression line to data using the method of least squares.

Uploaded by

ajayinstyle
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views8 pages

Numerical Methods in Engineering Lab (ME-319) : Manuals

This document provides algorithms for numerical integration and linear regression. It introduces numerical methods and their importance in engineering. It then provides pseudocode for the Trapezoidal, Simpson 1/3rd, and Simpson 3/8th rules for numerical integration of functions. Finally, it provides an algorithm to fit a linear regression line to data using the method of least squares.

Uploaded by

ajayinstyle
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

NUMERICAL METHODS IN ENGINEERING LAB (ME-319)

MANUALS

INTRODUCTION
Numerical Analysis is the study of the appropriate methods for solving mathematical,scientific and engineering problems by means of basic arithmetic operations.Scientists and engineers are widely using numerical methods.A major advantage of numerical methods is that a numerical solution can be obtained even the problem has no analytical solution.eg.We have to find a root of non-linear equation 2x 5x 3 = 0 .The analytical solution of above problem is not possible,But there are many numerical methods to solve this problem. Numerical analysis requires a large number of repetitive arithmetic operations. Handling of these is possible only if we use a computer to carry out these operations.With the advent of high speed computers and increasing demand for numerical solutions to various problems,numerical techniques have become indispensable tools in hands of engineers and scientists.Much research work is going on creating new methods and adapting existing methods. Numerical methods have great application in the field of computers.Numeical analysis may be regarded as process to develop and evaluate for computing required mathematical numerical results from the given numerical data.It incorporates three broad steps in process Given data is called input information Algorithm The results,called output information

Computers have changed ,almost revolutionized field of numerical methods. With make use of programming language we can reduce the labour of calculations.We can use Pascal,Cobal,Fortran,C,C++ and Matlab like programming languages. We will use C++ for programming of numerical methods.C++ is a general purpose programming language designed by Bjarne Stroutstrip.We are using Turbo C++ software and Microsoft visual C++ 6.0. C++is powerful language used for many purposes like writing operating systems,business and scientific applications.The program written in C++ are efficient and fast.

ALOGORITHM: Trapezoidal rule


The function f(x) is to be integrated from a to b by dividing the integration range in to n intervals. Begin Read: a ,b ,n Set h = (b-a)/n Set sum = (f(a)+f(b))/2 For i=1 to (n-1) by 1 do Set sum = sum +f(a+i*h) Endfor Set integral = h * sum Write : value of integral = , integral End

ALOGORITHM: Simpson 1/3rd rule


The function f(x) is to be integrated from a to b by dividing the integration range in to n intervals. Begin Read: a ,b ,n Set h = (b-a)/n Set s = f(a)+f(b) Set s2 = 0 Set s4 = 0 For i=1 to n by 2 do Set s4 = s4 +f(a+i*h) Endfor For i = 2 to (n-1) by 2 do Set s2 = s2 +f(a+i*h) Endfor Set integral = (h/3) * (s + 2 *s2 + 4 *s4) Write : value of integral = , integral End

ALOGORITHM: Simpson 3/8 rule


The function f(x) is to be integrated from a to b by dividing the integration range in to n intervals. Begin Read: a ,b ,n Set h = (b-a)/n Set s1 = f(a)+f(b) Set s2 = 0 Set s3 = 0 For i=1 to n by 3 do Set x = a + i*h Set s3 = s3 +f(x+h)+f(x) Endfor For i = 3 to n by 3 do Set s2 = s2 +f(a+i*h) Endfor Set integral = (3h/8) * (s1 + 2 *s2 + 3 *s3) Write : value of integral = , integral End

ALOGORITHM: Fitting a regression line y on x


Two one-dimensional arrays named x and y each of size n are used to store the data points at which function is tabulated. Begin Read: n For i = 1 to n by 1 do Read: xi ,yi End for Set sx = 0 Set sx2 = 0 Set sy = 0 Set sxy = 0 For i=1 to n by 1 do Set sx = sx + xi Set sx2 = sx2 + xi* xi Set sy = sy + yi Set sxy = sxy + xi + yi Endfor Set denom = n*sx2 sx*sx Set a2 = (n*sxy sx*sy)/denom Set a1 = (sy*sx2 sx*sxy)/denom Write : value of a2 and a1 End

You might also like