You are on page 1of 6

Ateneo de Naga University College of Engineering Department of ECE and CpE Numerical Methods Laboratory [ECEM428 LAB] EVALUATION

OF INFINITE SERIES Activity II OBJECTIVE To evaluate using MATLAB the function series expansion. THEORY/ DISCUSSION

GE41

with the application of the Maclaurin

In mathematics, functions can often be represented by infinite series. For example, the exponential function can be computed using

Thus, as more terms are added in sequence, the approximation becomes a better and better estimate of the true value of ex. Equation A is called a Maclaurin series expansion. Starting with the simplest version, ex = 1, add terms one at a time in order to estimate .

After each new term is added, compute the true and approximate percent relative errors Note that the true value is . . . . Add terms until the absolute value of the

approximate error estimate a falls below a pre specified error criterion s conforming to three significant figures. Chapra, Steven C. (2012). Applied numerical methods with matlab for engineers and scientists, 3rd Ed. New York McGraw-Hill. MATERIALS Computer Set
Course Code: ECEM428LAB

MATLAB Dangle
Score:

Name: MONTAEZ, JOHN JOSHUA F. Year: Fourth Year

Evaluation of Infinite Series Date: 27 November 2013

Page 1

PROBLEM The exponential function is given by the infinite series

1. Write a program to evaluate 2. Evaluate 3. Evaluate PROCEDURE if if

using infinite series.

1. Set the value of x and the number of significant figure (n) by letting the user enter values. 2. Set the initial values of the variables and formula for the specified percent tolerance . 3. Create a loop that will only stop when the value of is less than value of . 4. Display the value of the approximation using infinite series, the approximation error and the exact value of OUTPUT .

Name: MONTAEZ, JOHN JOSHUA F. Year: Fourth Year

Course Code: ECEM428LAB

Evaluation of Infinite Series Date: 27 November 2013

Score:

Page 2

Values Acquired when

has an

and two significant figures

Name: MONTAEZ, JOHN JOSHUA F. Year: Fourth Year

Course Code: ECEM428LAB

Evaluation of Infinite Series Date: 27 November 2013

Score:

Page 3

Enter Value of x: -10 Enter Number of Significant Figures: 2 Term Number: 1 True value of e^x: 4.539993e-005 Approximated Value of e^x: 1.000000 True Percent Relative Error: 2202546.579481 Aproximate Estimate Error: 100.000000 Term Number: 2 True value of e^x: 4.539993e-005 Approximated Value of e^x: 9.000000 True Percent Relative Error: 19823919.215326 Aproximate Estimate Error: 111.111111 Term Number: 3 True value of e^x: 4.539993e-005 Approximated Value of e^x: 41.000000 True Percent Relative Error: 90308409.758708 Aproximate Estimate Error: 121.951220 Term Number: 4 True value of e^x: 4.539993e-005 Approximated Value of e^x: 125.666667 True Percent Relative Error: 276799353.488071 Aproximate Estimate Error: 132.625995 Term Number: 5 True value of e^x: 4.539993e-005 Approximated Value of e^x: 291.000000 True Percent Relative Error: 640970054.628875 Aproximate Estimate Error: 143.184422 Term Number: 6 True value of e^x: 4.539993e-005 Approximated Value of e^x: 542.333333 True Percent Relative Error: 1194568761.605018 Aproximate Estimate Error: 153.657037 Term Number: 7 True value of e^x: 4.539993e-005

Approximated Value of e^x: 846.555556 True Percent Relative Error: 1864662598.784804 Aproximate Estimate Error: 164.063525 Term Number: 8 True value of e^x: 4.539993e-005 Approximated Value of e^x: 1137.571429 True Percent Relative Error: 2505667916.057798 Aproximate Estimate Error: 174.417793 Term Number: 9 True value of e^x: 4.539993e-005 Approximated Value of e^x: 1342.587302 True Percent Relative Error: 2957245227.495455 Aproximate Estimate Error: 184.729792 Term Number: 10 True value of e^x: 4.539993e-005 Approximated Value of e^x: 1413.144621 True Percent Relative Error: 3112658265.341494 Aproximate Estimate Error: 195.007070 Term Number: 11 True value of e^x: 4.539993e-005 Approximated Value of e^x: 1342.587302 True Percent Relative Error: 2957245227.495455 Aproximate Estimate Error: 205.255324 Term Number: 12 True value of e^x: 4.539993e-005 Approximated Value of e^x: 1162.623537 True Percent Relative Error: 2560848856.901771 Aproximate Estimate Error: 215.479109 Term Number: 13 True value of e^x: 4.539993e-005 Approximated Value of e^x: 925.052162 True Percent Relative Error: 2037562880.095917 Aproximate Estimate Error: 225.681944

Term Number: 14 True value of e^x: 4.539993e-005 Approximated Value of e^x: 680.852222 True Percent Relative Error: 1499676917.594612 Aproximate Estimate Error: 235.866805 Term Number: 15 True value of e^x: 4.539993e-005 Approximated Value of e^x: 466.222338 True Percent Relative Error: 1026922937.898623 Aproximate Estimate Error: 246.035950 Term Number: 16 True value of e^x: 4.539993e-005 Approximated Value of e^x: 298.494035 True Percent Relative Error: 657476965.763534 Aproximate Estimate Error: 256.191509 Term Number: 17 True value of e^x: 4.539993e-005 Approximated Value of e^x: 179.453698 True Percent Relative Error: 395272974.025314 Aproximate Estimate Error: 266.334848 Term Number: 18 True value of e^x: 4.539993e-005 Approximated Value of e^x: 101.692027 True Percent Relative Error: 223991696.438715 Aproximate Estimate Error: 276.467814 Term Number: 19 True value of e^x: 4.539993e-005 Approximated Value of e^x: 54.500042 True Percent Relative Error: 120044231.596857 Aproximate Estimate Error: 286.590731 Term Number: 20 True value of e^x: 4.539993e-005 Approximated Value of e^x: 27.706310

Name: MONTAEZ, JOHN JOSHUA F. Year: Fourth Year

Course Code: ECEM428LAB

Evaluation of Infinite Series Date: 27 November 2013

Score:

Page 4

True Percent Relative Error: 61027309.474497 Aproximate Estimate Error: 296.706244 Term Number: 21 True value of e^x: 4.539993e-005 Approximated Value of e^x: 13.396866 True Percent Relative Error: 29508461.061180 Aproximate Estimate Error: 306.811879 Term Number: 22 True value of e^x: 4.539993e-005 Approximated Value of e^x: 6.176075 True Percent Relative Error: 13603810.622475 Aproximate Estimate Error: 316.915530 Term Number: 23 True value of e^x: 4.539993e-005 Approximated Value of e^x: 2.720716 True Percent Relative Error: 5992676.506459 Aproximate Estimate Error: 327.001801 Term Number: 24 True value of e^x: 4.539993e-005 Approximated Value of e^x: 1.147454 True Percent Relative Error: 2527535.288730 Aproximate Estimate Error: 337.108999 Term Number: 25 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.464284 True Percent Relative Error: 1022552.959265 Aproximate Estimate Error: 347.144964 Term Number: 26 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.180411 True Percent Relative Error: 397482.339933 Aproximate Estimate Error: 357.347360

Term Number: 27 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.067548 True Percent Relative Error: 148685.082836 Aproximate Estimate Error: 367.084799 Term Number: 28 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.024289 True Percent Relative Error: 53599.147819 Aproximate Estimate Error: 378.107388 Term Number: 29 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.008510 True Percent Relative Error: 18645.220272 Aproximate Estimate Error: 385.401543 Term Number: 30 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.002800 True Percent Relative Error: 6266.630794 Aproximate Estimate Error: 403.978313 Term Number: 31 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.000970 True Percent Relative Error: 2037.319561 Aproximate Estimate Error: 388.521703 Term Number: 32 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.000246 True Percent Relative Error: 641.374102 Aproximate Estimate Error: 494.795310 Term Number: 33 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.000134

True Percent Relative Error: 195.717668 Aproximate Estimate Error: 283.071274 Term Number: 34 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.000019 True Percent Relative Error: 57.946505 Aproximate Estimate Error: 603.194029 Term Number: 35 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.000053 True Percent Relative Error: 16.660605 Aproximate Estimate Error: 63.952274 Term Number: 36 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.000043 True Percent Relative Error: 4.655712 Aproximate Estimate Error: 22.357204 Term Number: 37 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.000046 True Percent Relative Error: 1.265487 Aproximate Estimate Error: 5.847204 Term Number: 38 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.000045 True Percent Relative Error: 0.334837 Aproximate Estimate Error: 1.605701 Term Number: 39 True value of e^x: 4.539993e-005 Approximated Value of e^x: 0.000045 True Percent Relative Error: 0.086301 Aproximate Estimate Error: 0.420775.

Values Acquired when


Name: MONTAEZ, JOHN JOSHUA F. Year: Fourth Year Course Code: ECEM428LAB

has an

and two significant figures


Score:

Evaluation of Infinite Series Date: 27 November 2013

Page 5

ANALYSIS AND OBSERVATION The activity has an objective to make the students create a program that will evaluate the value of given a certain value of x. As stated in the program developed, it utilizes the while function of the MATLAB. It uses the concept of iteration and recursion of the process and value, respectively. In the procurement of the program the fundamental counterparts are visibly seen in the codes that were made that includes the formula to be used, proper initializing of values among the variables and the reasons behind the values assigned. Like for example, ea has a value of 100, it is primarily because in the start of the process there will be no point of comparison or point of relativistic edge as to whether it satisfy the stopping criterion (| | observed for other functions such the 20 terms and for ). Furthermore, the same algorithm will be , but the only drawback is the proper has

definition of the Maclaurin series expansion for other functions. The output for

has 39 terms that is only for a two significant figures. It is

observable that if we increased the value of x and the number of significant figures, there will be more terms to be added just to satisfy the stopping criterion. CONCLUSION In conclusion, therefore, very tedious processes like the repetitive procurement of the approximate estimate error which requires the previous values; it is difficult to compute it by hand. With MATLAB, the easiness of the determination of the approximate and even the true value of the function can be attained but only having an efficient and effective combination of the different built-in function of the MATLAB itself. With the primary goal of the study of Numerical Method, which is to be precise and accurate, the utilization of the MATLAB and its built-in functions will give help in the appreciation of the subject itself. The student can just program in MATLAB and verify his/her answers.

Name: MONTAEZ, JOHN JOSHUA F. Year: Fourth Year

Course Code: ECEM428LAB

Evaluation of Infinite Series Date: 27 November 2013

Score:

Page 6

You might also like