# Introduction umerical analysis is the area of mathematics and computer science that creates, analyzes, and implements algorithms for solving numerically the problems of continuous mathematics. Such problems originate generally from real-world applications of algebra, geometry, and calculus, and they involve variables which vary continuously. The formal academic area of numerical analysis varies from highly theoretical mathematical studies to computer science issues involving the effects of computer hardware and software on the implementation of specific algorithms [5] . An algorithm is a procedure or formula for solving a problem. The word derives from the name of the mathematician, Mohammed ibn-Musa al-Khwarizmi. Given a set of data of points (?? 0 , ?? 0 ), (?? 1 , ?? 1 ), ? ? . . , (?? ?? , ?? ?? ) of a function ?? = ð??"ð??"(??) , where ð??"ð??"(??) is not known explicitly, it is required to compute the value of the definite integral ?? = ? ?? ???? ?? ?? (1) We derive a general formula for numerical integration using Newton's forward difference formula. Let the interval [??, ??] be divided into n equal subintervals such that ?? = ?? 0 < ?? 1 ? ? ? ? ? ? ? ? . < ?? ?? = ?? Clearly, ?? ?? = ?? 0 + ??. Hence the integral becomes ?? = ? ?? ???? ?? ?? ?? 0 Approximating ?? by Newton's forward difference formula, we obtain. [4] ?? = ? [?? 0 + ????? 0 + ? ??(???1) 2! ? ? 2 ?? 0 + ? ??(???1)(???2) 3! ? ? 3 ?? 0 + ? ]???? ?? ?? ?? 0 Since ?? = ?? 0 + ???, ???? = ? ???? and hence the above integral becomes ?? = ? ? [?? 0 + ????? 0 + ? ??(???1) 2! ? ? 2 ?? 0 + ? ??(???1)(???2) 3! ? ? 3 ?? 0 + ? ]???? ?? ?? ? ? ?? ???? ?? ?? ?? 0 = ???[?? 0 + ? ?? 2 ? ??? 0 + ? ??(2???3) 12 ? ? 2 ?? 0 + ? ]????(2) From this general formula, we can obtain different integration formula by putting ?? = 1,2,3 ? ? ? etc. Programming language C is very flexible and powerful. It originally designed in the early 1970s [3] . It allows us to maximum control with minimum command. It is recognized worldwide and used in a multitude of applications especially in Numerical Analysis. Along with other numerous benefits, we have used programming language C in this paper. Author ? ? ? ¥: Department of Mathematics, Pabna University of Science & Technology (PUST). e-mails: nl.nizhum@gmail.com, pust.pulok@gmail.com, bimaldu@gmail.com, rajpust09@gmail.com Author ?: Department of EEE, University of Information Technology & Sciences (UITS). e-mail: pr.aminul@gmail.com Already B. K. Datta et all in [1] and [2] have given the algorithms of numerical differentiation and numerical integration. In this paper we have developed a combined algorithm of numerical differentiation, numerical integration and finding roots numerically. The outline of this paper is as follows: Section 2 contains the brief description of the existing methods with methodology. In Section 3, we develop an algorithm, using the programming language C, which gives us the solution of a problem simultaneously regarding four popular existing numerical integration methods namely Trapezoidal rule, Simpson's 1/3 rule, Simpson's 3/8 rule and Weddle's rule or the solution of an ordinary differential equation simultaneously regarding four popular existing methods namely Euler, modified Euler, Runge-Kutta second and fourth order or N the solution of a problem simultaneously regarding two existing numerical methods namely Bisection method and False position method. Moreover, the simulator identifies the method that gives the best solution comparing with possible exact solution of the problem in each case. Conclusions are given at the end at Section 4. # II. # Existing Methods We give a brief description of the existing methods of Numerical Integration like Trapezoidal rule, Simpson's 1/3 rule, Simpson's 3/8 rule and Weddle's rule, methods of numerical differential equations like Euler, modified Euler, Runge-Kutta second and fourth order and numerical methods namely Bisection method and False position method in this section with their methodology [2] . a) Trapezoidal Rule Putting ?? = 1 in (2) all differences higher than the first will become zero and we obtain ? ?? ???? ?? 1 ?? 0 = ? ??? 0 + 1 2 ??? 0 ? = ? ??? 0 + 1 2 (?? 1 ? ?? 0 )? = ? 2 [?? 0 + ?? 1 ] For the next interval [?? 1 , ?? 2 ] and others we have the similar expression as ? ?? ???? ?? 2 ?? 1 = ? 2 [?? 1 + ?? 2 ] and so on. And for the last interval [?? ???1 , ?? ?? ] , we have ? ?? ???? ?? ?? ?? ?? ?1 = ? 2 [?? ???1 + ?? ?? ]. Combining all these expressions, we obtain the rule ? ?? ???? ?? ?? ?? 0 = ? 2 [?? 0 + 2(?? 1 + ?? 2 + ? ?? ???1 ) + ?? ?? ] This is known as Trapezoidal rule. # b) Simson's 1/3 Rule Putting ?? = 2 in (2) all differences higher than the first will become zero and we obtain ? ?? ???? = 2?[?? 0 + ??? 0 + 1 6 ? 2 ?? 0 ] ?? 2 ?? 0 = ? 3 [?? 2 + 4?? 1 + ?? 0 ] Similarly, ? ?? ???? ?? 4 ?? 2 = ? 3 [?? 2 + 4?? 3 + ?? 4 ] and finally ? ?? ???? ?? ?? ?? ?? ?2 = ? 3 [?? ???2 + 4?? ???1 + ?? ?? ] Combining all these expressions, we obtain ? ?? ???? ?? ?? ?? 0 = ? 3 [?? 0 + 4(?? 1 + ?? 3 + ? + ?? ???1 ) + 2(?? 2 + ?? 4 + ? + . . . +?? ???2 ) + ?? ?? ] This is known as Simson's 1/3 rule. # c) Simson's 3/8 Rule Putting ?? = 3 in (2) all differences higher than the first will become zero and we obtain ? ?? ???? ?? 3 ?? 0 = 3?[?? 0 + 3 2 ??? 0 + 9 12 ? 2 ?? 0 + 3 24 ? 3 ?? 0 ] = 3 8 ?[?? 0 + 3?? 1 + 3?? 2 + ?? 3 ] Similarly, ? ?? ???? ?? 6 ?? 3 = 3 8 ?[?? 3 + 3?? 4 + 3?? 5 + ?? 6 ] and so on. Summing up all these, we obtain ? ?? ???? ?? ?? ?? 0 = 3 8 ?[?? 0 + 3?? 1 + 3?? 2 + 2?? 3 + ? + 2?? ???3 + 3?? ???2 + 3?? ???1 + ?? ?? ] [13] This rule is known as Simson's 3/8 rule. # d) Weddle's Rule Putting ?? = 6 in (2) all differences higher than the first will become zero and we obtain ? ?? ???? ?? 6 ?? 0 = 3 10 ?[?? 0 + 5?? 1 + ?? 2 + 6?? 3 + ?? 4 + 5?? 5 + ?? 6 ] Similarly, we obtain the general form ?? ?? ?? 0 + 6(?? 3 + ?? 9 + ? ? + ?? ???3 ) + ?? 2 + ?? 4 + ? ? + ?? ?? ] This is known as Weddle's rule. # e) Euler Method In mathematics and computational science, the Euler method is a first-order numerical procedure for solving ODEs with a given initial value. It is the most basic explicit method for numerical ODEs [1] . # i. Procedure We consider the differential equation ?? ? = ð??"ð??"(??, ??)(3) with the initial condition ??(?? 0 ) = ?? 0(4) Suppose that we wish to solve the equation ( 3) with (4) for the value of ?? at ?? = ?? ?? = ?? 0 + ??? (?? = 1,2, ? ? ? ? . . ) Integrating (3) with ?? 0 to ?? 1 and?? 0 to?? 1 , we get ?? 1 ? ?? 0 = ? ð??"ð??"(??, ??)???? ?? 1 ?? 0 Or, ?? 1 = ?? 0 + ? ð??"ð??"(??, ??)???? ?? 1 ?? 0 (5) Assuming that ð??"ð??"(??, ??) = ð??"ð??"(?? 0 , ?? 0 ) in ?? 0 ? ?? ? ?? 1 , this gives Euler's formula ?? 1 ? ?? 0 + ? ð??"ð??"(?? 0 , ?? 0 )[since?? 1 ? ?? 0 = ?](6) Similarly for the range ?? 1 ? ?? ? ?? 2 , we have ?? 2 = ?? 1 + ? ð??"ð??"(??, ??)???? ?? 2 ?? 1 # Substituting ð??"ð??"(?? 1 , ?? 1 ) for ð??"ð??"(??, ??) where ?? 1 ? ?? ? ?? 2 , we have ?? 2 ? ?? 1 + ? ð??"ð??"(?? 1 , ?? 1 ) [ since?? 2 ? ?? 1 = ?] Proceeding in this way, we obtain the general formula ?? ??+1 = ?? ?? + ? ð??"ð??"(?? ?? , ?? ?? ), ?? = 0,1,2, ? ? ? ? ? f) Modified Euler's method i. Procedure We consider the differential equation ?? = ð??"ð??"(??, ??)(7) With the initial condition ??(?? 0 ) = ?? 0 (8) Suppose that we wish to solve the equation ( 7) with (8) for the value of y at ?? = ?? ?? = ?? 0 + ??? (?? = 1,2, ? ? ? ? . . ) Integrating (7) with ?? 0 to ?? 1 and ?? 0 to ?? 1 , we get ?? 1 ? ?? 0 = ? ð??"ð??"(??, ??)???? ?? 1 ?? 0 Or, ?? 1 = ?? 0 + ? ð??"ð??"(??, ??)???? ?? 1 ?? 0 (9) Now integrating (9) by means of trapezoidal rule to obtain ?? 1 = ?? 0 + ? ? 2 ? [ð??"ð??"(?? 0 , ?? 0 ) + ð??"ð??"(?? 1 ?? 1 )](10) We thus obtain the iterative formula ?? 1 (??+1) = ?? 0 + ? ? 2 ? [ð??"ð??"(?? 0 , ?? 0 ) + ð??"ð??"(?? 1 , ?? 1 ?? )] ;?? = 0,1, 2 , ..(11) Where ?? 1 ?? is the nth approximation to ?? 1 . The iterative formula (11) can be started by choosing ?? 1 0 from Euler's formula ?? 1 0 = ?? 0 + ? ð??"ð??"(?? 0 , ?? 0 ) g) Runge-Kutta method(Second order) i. Procedure We consider the differential equation ?? = ð??"ð??"(??, ??) ( With the initial condition ??(?? 0 ) = ?? 0 (13) Suppose that we wish to solve the equation ( 12) with (13) for the value of ?? at ?? = ?? ?? = ?? 0 + ??? (?? = 1,2, ? ? ? ? . . ) Integrating (12) with ?? 0 to ?? 1 and ?? 0 to ?? 1 , we get ?? 1 ? ?? 0 = ? ð??"ð??"(??, ??)???? ?? 1 ?? 0 Or ?? 1 = ?? 0 + ? ð??"ð??"(??, ??)???? ?? 1 ?? 0 (14) Now integrating (14) by means of trapezoidal rule to obtain ?? 1 = ?? 0 + ( ? 2 )[ð??"ð??"(?? 0 , ?? 0 ) + ð??"ð??"(?? 1 ?? 1 )](15) Substitute ?? 1 = ?? 0 + ? ð??"ð??"(?? 0 , ?? 0 )on the right side of equation (15), we obtain ?? 1 = ?? 0 + ? ? 2 ? [ð??"ð??" 0 + ð??"ð??"(?? 0 + ?, ?? 0 + ? ð??"ð??" 0 )(16) Where ð??"ð??"(?? 0 , ?? 0 ) = ð??"ð??" 0 , ?? 1 ? ?? 0 = ? Now set ?? 1 = ? ð??"ð??" 0 and ?? 2 = ? ð??"ð??"(?? 0 + ?, ?? 0 + ?? 1 ). # And hence equation (16) becomes ?? 1 = ?? 0 + ? 1 2 ? [?? 1 + ?? 2 ]. This is the Runge-Kutta second order formula. h) Runge-Kutta method (Fourth order) i. Procedure We mention the fourth order formulae defined by ?? 1 = ?? 0 + ?? 1 ?? 1 + ?? 2 ?? 2 + ?? 3 ?? 3 + ?? 4 ?? 4(17) Where ?? 1 = ?ð??"ð??"(?? 0 , ?? 0 ) ?? 2 = ?ð??"ð??"(?? 0 + ?? 0 ?, ?? 0 + ?? 0 ?? 1 ) ?? 3 = ?ð??"ð??"(?? 0 + ?? 1 ?, ?? 0 + ?? 1 ?? 1 + ?? 1 ?? 2 ) ?? 4 = ?ð??"ð??"(?? 0 + ?? 2 ?, ?? 0 + ?? 2 ?? 1 + ?? 2 ?? 2 + ?? 1 ?? 3 )(18) Where the parameters have to be determined by expanding both sides of (17) by Taylor's series and securing agreement of terms up to and including those containing ? 4 . The choice of the parameters is, again arbitrary and we have therefore several fourth order Runge-kutta formulae. If for example we set , ?? 2 = 1 ?? 1 = 1 2 ??2 ? 1?, ?? 2 = 0 ?? 1 = 1 ? 1 ?2 , ?? 2 = ? 1 ?2 , ?? 1 = 1 + 1 ?2 ?? 1 = ?? 4 = 1 6 , ?? 2 = 1 3 ?1 ? 1 ?2 ? , ?? 3 = 1 3 ?1 + 1 ?2 ? We obtain the method of Gill, whereas the choice ?? 0 = ?? 1 = 1 2 , ?? 0 = ?? 1 = 1 2 ?? 1 = ?? 2 = ?? 2 = 0, ?? 2 = ?? 1 = 1 ?? 1 = ?? 4 = 1 6 , ?? 2 = ?? 3 = 2 6 Leads to the fourth order Runge-Kutta formulae, whereas ?? 1 = ?ð??"ð??"(?? 0 , ?? 0 ) ?? 2 = ?ð??"ð??" ??? 0 + 1 2 ?, ?? 0 + 1 2 ?? 1 ? ?? 3 = ?ð??"ð??" ??? 0 + 1 2 ?, ?? 0 + 1 2 ?? 2 ? ?? 4 = ?ð??"ð??"(?? 0 + ?, ?? 0 + ?? 3 ) Then ?? 1 = ?? 0 + 1 6 (?? 1 + 2?? 2 + 2?? 3 + ?? 4 ) i) Bisection method The bisection method in mathematics is a rootfinding method which repeatedly bisects an interval and then selects a subinterval in which a root must lie for further processing. It is a very simple and robust method, but it is also relatively slow. Because of this, it is often used to obtain a rough approximation to a solution which is then used as a starting point for more rapidly converging methods. The method is also called the binary search method or the dichotomy method [4] . # i. Procedure The method is applicable when we wish to solve the equation 0 ) ( = x f for interval ] , [ b a and ) (a f the real variable , x where f is a continuous function defined on an and have opposite signs, so the method is applicable to this smaller interval. # j) False Position Method In problems involving arithmetic or algebra, the false position method or regulafalsi is used to refer to basic trial and error methods of solving problems by substituting test values for the unknown quantities. # i. Procedure The poor convergence of the bisection method as well as its poor adaptability to higher dimensions (i.e., systems of two or more non-linear equations) motivate the use of better techniques [6] . One such method is the Method of False Position. Here, we start with an initial interval ] , [ J e XIV Issue VII Version I function changes sign only once in this interval. Now we find an 3 x is given by of the problem. In other words, finding 3 ) ( ) ( ) ( ) ( 1 2 1 1 2 1 3 x f x f x f x x x x ? ? ? = Now, x is a static procedure in the case of the bisection method since for a given 1 x and 2 x , it gives identical 3 x , no matter what the function we wish to solve. On the other hand, the false position method uses the information about the function to arrive at 3 x . III. # Algorithm INPUT: Type your choice C. # If C==1 { INPUT: function ð??"ð??", limits ?? 0 and ?? ?? , number of division ??, direct result ??. Step-1: Compute ? = ?? ?? ??? 0 # ?? Step-2: Set ?? = 0 Step-3: While ?? ? ??, repeat Step-4 Step-4: Set ??[??] = ð??"ð??"(?? 0 + ???) Step-5: Set ?? = 1 Step-6: While ?? < ??, repeat Step-7 Step-7: Set ??????_1 = ??????_1 + 2??[??] If ??%2 = 0 Set ??????_2 = ??????_2 + 2??[??] Else Set ??????_2 = ??????_2 + 4??[??] If ??%3 = 0 Set ??????_3 = ??????_3 + 2??[??] Else Set ??????_3 = ??????_3 + 3??[??] ??_??????_1 = (?/2) * (??[0] + ??[??] + ??????_1) ??_??????_2 = (?/3) * (??[0] + ??[??] + ??????_2) ??_??????_3 = (3?/8) * (??[0] + ??[??] + ??????_3) If ??%6 = 0 Set ??????_4 = ??????_4 + 2??[??] Else if ??%3 = 0 Set ??????_4 = ??????_4 + 6??[??] Else Set ??????_4 = ??????_4 + ??[??] Else If(??%6 == 1||??%6 == 5) ??????_4 = ??????_4 + 5??[??] Else The false position method differs from the bisection method only in the choice it makes for subdividing the interval at each iteration. It converges faster to the root because it is an algorithm which uses appropriate weighting of the initial end points 1 x and 2 x using the information about the function, or the data ??????_4 = ??????_4 + ??[??]; ??_??????_4 = ? 3? 8 ? * (??[0] + ??[??] + ??????_4) Step-8: Set a= |??_??????_1 ? ??|, ?? = |??_??????_2 ? ??|, ?? = |??_??????_3 ? ??|, ?? = |??_??????_4 ? ??| If(?? < ?? ?????? ?? < ??) If(?? < ??) ??_??????_1 If(?? < ?? ?????? ?? < ??) If(?? < ??) ??_??????_2 Else ??_??????_4 If(?? < ?? ?????? ?? < ??) If(?? < ??) ??_??????_3 Else # ??_??????_4 OUTPUT: ??_??????_1, ??_??????_2, ??_??????_3 and t_??????_4 with message which sum is most accurate. STOP. } [2] Else If C==2 { INPUT: function ð??"ð??"(??, ??), initial condition (?? 0 , ?? 0 ), interval ?, value of ??, direct result ??. Step-1: Set n= (?? ? ?? 0 )/? ,?? 00 = ?? 0 , ?? 0?? = ?? 0 , ?? 02 = ?? 0 ?? 04 = ?? 0 , ?? 1 = ?? 00 + ?ð??"ð??"(?? 0 , ?? 00 ) Step-2: Set ?? = 1 Step-3: While ?? ? ??, repeat Step-4 to step-7 Step-4: Set ?? = 1 Step-5: While ?? ? ?? repeat step-10 Step-6: Set ?? 1 = ?? 0 + ?, ?? 10 = ?? 00 + 1 2 ?ð??"ð??"(?? 0 , ?? 0 ) + ð??"ð??"(?? 1 , ?? 1 ), ?? 1 = ?? 10 Step-7: Set ?? 1?? = ?? 0?? + ?ð??"ð??"(?? 0 , ?? 0?? ), ?? 11 = ?ð??"ð??"(?? 0 , ?? 04 ), ?? 22 = ?ð??"ð??"(?? 0 + IV. # Conclusion In this paper, we develop an algorithm incorporated with Numerical Integration (Trapezoidal rule, Simpson's 1/3 rule, Simpson's 3/8 rule and Weddle's rule.), Numerical Differentiation (Euler, modified Euler and Runge-Kutta second and fourth order) and finding Roots (Bisection method and False position method) numerically. We observed that the result obtained according to our procedure is completely identical with the hand calculation and save our time and labour. Moreover, Weddle's rule gives the best solution, the Runge-Kutta fourth order gives the best solution and the False position method gives the best solution in Numerical Integration, Numerical Differentiation and finding Roots numerically respectively. ![have opposite signs. In this case a and b are said to bracket a root since, by the intermediate value theorem, the f must have at least one root in the interval ) , ( b a . At each step the method divides the interval in two by computing the midpoint . Unless c is itself a root (which is very unlikely, but possible) there are now two possibilities: either have opposite signs and bracket a root. The method selects the subinterval that is a bracket as a new interval to be used in the next step. In this way the interval that contains a zero of f is reduced in width by % 50 at each step. The process is continued until the interval is sufficiently small. sets c as the new value for b , and if ) are opposite signs then the method sets c as the new a . (If 0 ) ( = c f then c may be taken as the solution and the process stops.) In both cases, the new](image-2.png "") ![we choose the new interval from the two choices depending on in which interval the function changes sign.](image-3.png "") 1 2 ?, ?? 04 +1 2 ?? 11 )?? 33 = ?ð??"ð??" ??? 0 +1 2 ?, ?? 04 +1 2 © 2014 Global Journals Inc. (US) x in this interval, which is given by the intersection of the x axis and the straight line passing through)) ( , ( 1 1 x f x and )) ( , ( 1 1 x f x. It is easy to verify that 3 Else ?? 1 ?? 4 Output: ?? 1?? , ?? 10 , ?? 1 ?? 2 and ?? 1 ?? 4 with message which method gives best solution. } [1] Else If C==3 { INPUT: function f end points ; , b a initial approximations ; , 1 0 p p tolerance TOL, maximum number of iterations N direct result r . Step-1: Set Step-3: Set Step-5: Set Step-8: OUTPU (failure) Step-9: Set Step-10: While N i ? do steps 11-14 Step-11: Set Step-13: . 1 ## + = i i Step-14: If * A Numerical Simulator for Solving Ordinary Differential Equations, IJSET BKDatta NRahman &R CBhowmik 2014 * A Numerical Simulator for Solving Numerical Integration BKDatta NRahman RCBhowmik URoy MRKabir &SPaul 2014 IJSET * Wiki Answers, wiki.answer com.5 * MGoyal Computer-based Numerical & Statistical Techniques New Delhi, India Infinity Science Press LLC 2007.3