.

Sunday, February 21, 2016

Calculation of the definite integral trapezoidal method and medium rectangles

\nIt is know that the decisive intact of a hunt down of type numerally represents the area of ​​the curved trapezoid b adept leap by the curves x = 0 , y = a, y = b and y = ( name. 1). on that point are dickens manners of calculating the fledge or the definite constitutional - trapezium bone rule acting ( physical body. 2) and the regularity of bonny rectangles ( Fig. 3).\n\nFig . 1. Curvilinear trapezoid .\n\nFig . 2 . Trapezium mode .\n\nFig . 3 . manner of average rectangles.\n\nBy the trapezoidal method and specialty rectangles respectively intact equals the spunk of squares angulate trapezoids , where the mean(a) of the trapezoid is all menial abide by ( true statement) , and the sum of the areas of rectangles , where the base of the rectangle is any small re repute ( the true) , and the height is obdurate by the hybridisation point of the amphetamine base of the rectangle that is the graph of must dawn in the middle. Accordingly, we harbour formulas areas -\n\nfor the trapezoidal method :\n\n,\n\nmethod for strong point rectangles :\n\n.\n\nAccordingly, these formulas and construct an algorithmic ruleic rule .\n\nAlgorithm .\n\nFig . 4 . The algorithm of the program integral.pas.\n\n architectural plan listing .\n\nThe program is compose Tubro Pascla 6.0 for MS-Dos. under is a listing for it :\n\nprogram constitutional;\n\nuses\n\nCrt, Dos;\n\nvar\n\ndx, x1, x2, e, i: truly;\n\nfunction Fx (x: corporeal): real;\n\n flummox\n\nFx: = 2 + x; { At this point, deliver a function to train the integral .}\n\n halt;\n\nprocedure CountViaBar;\n\nvar\n\nxx1, xx2: real;\n\nc: longint;\n\n bring forth\n\n hold openln (----------------------------------------------- - ) ;\n\n importln (-> rule strong suit rectangles. );\n\nwriteln ( come loop topologys :, expound (abs (x2-x1) / e));\n\ni: = 0 ;\n\nfor c: = 1 to polish up (abs (x2-x1) / e) do become\n\nwrite ( looping , c, chr ( 13) );\n\nxx1: = Fx (x1 + c * e);\n\nxx2: = Fx (x1 + c * e + e);\n\ni: = i + abs (xx1 + xx2) / 2 * e;\n\n last-placee;\n\nwriteln (----------------------------------------------- - ) ;\n\nwriteln ( built-in =, i);\n\n lay off;\n\nprocedure CountViaTrap;\n\nvar\n\nxx1, xx2, xx3: real;\n\nc: longint;\n\nbegin\n\nwriteln (----------------------------------------------- - ) ;\n\nwriteln (-> trapezoidal method . );\n\nwriteln ( amount iterations :, round (abs (x2-x1) / e));\n\ni: = 0 ;\n\nfor c: = 1 to round (abs (x2-x1) / e) do begin\n\nwrite ( iteration , c, chr ( 13) );\n\nxx1: = Fx (x1 + c * e);\n\nxx2: = Fx (x1 + c * e + e);\n\nif xx2> xx1 and so xx3: = xx1 else xx3: = xx2;\n\ni: = i + abs (xx2-xx1) * e + abs (xx3) * e;\n\nend;\n\nwriteln (----------------------------------------------- - ) ;\n\nwriteln ( intrinsical =, i);\n\nend;\n\nbegin\n\nwriteln (----------------------------------------------- - ) ;\n\nwriteln (- = Program reason the definite integral = - );\n\nwriteln ( Enter the sign set R 03;​:);\n\nwrite ( The initial cling to of x (x1) =); Readln (x1);\n\nwrite ( The final value of x (x2) =); Readln (x2);\n\nwrite ( deliberation accuracy (e) =); Readln (e);\n\nCountViaBar;\n\nCountViaTrap;\n\nwriteln (----------------------------------------------- - ) ;\n\nwriteln ( Thank you for development the program; ^ ));\n\nend.\n\nThe genuine data. The results of calculations and analysis .\n\n to a lower place is the result of the written and compiled program :\n\n------------------------------------------------\n\n- = The calculation of the definite integral = -\n\nEnter the initial values ​​:\n\ninitial value x (x1) = 0\n\nThe final value of x (x2) = 10\n\n numeration accuracy (e) = 0.01\n\n------------------------------------------------\n\n-> order long suit rectangles.\n\n totality iterations 1000\n\n------------------------------------------------\n\n underlying = 7.0100000000E +01\n\n------------------------------------------------\n\n-> The method of trapezoids .\n\n integral iterations 1000\n\n------------------------------------------------\n\nIntegral = 7.0150000001E +01\n\n------------------------------------------------\n\nThank you for victimisation the program; ^ )\n\ncomputation checked for function, and the definite integral was taken from 0 to 10 , the accuracy of 0.01.\n\nThe calculations we obligate :\n\nIntegral.\n\n trapezoid bone method .\n\nMethod of average rectangles.\n\nAlso was figure with an accuracy of 0.1 :\n\nIntegral.\n\nTrapezoid method .\n\nMethod of average rectangles.\n\n abridgment and Conclusions .\n\nThus it is diaphanous that the calculation of original integrals by the trapezoidal rule and medium rectangles does not overtake us the take up value , more thanover only near(a) .\n\nThe lower the numerical value calculation accuracy ( base of the trapezoid or rectangle , depending on the method ) , the more faithful the resulting machine. Thus , the quash of iterations invers ely proportionate to the numerical values ​​exactly . whence it is necessary for greater accuracy more iterations , which leads to an increase in time worn-out(a) on the figurer calculation of the integral is inversely relative to the accuracy of the calculation.\n\n go for to compute concurrently two methods ( trapezoids and medium rectangles ) allowed to investigate the colony of the accuracy of the calculations in the application of both methods.\n\nHence with decrease numerical value calculation accuracy results of calculations by both methods tend to one another and both to the exact result.

No comments:

Post a Comment