Assignment Solutions
Assignment Solutions
Question 1:
Use the Taylor series to estimate 𝑓 (𝑥 ) = e−x at 𝑥𝑖+1 = 1, for 𝑥𝑖 = 0.2. Employ the Taylor series
iterations until the approximate relative error 𝜖𝑎 fall below 0.02%.
Solution:
Approximation 𝜖𝑡 𝜖𝑎
Iteration-1 0.818730753077982 122.554092849247 NaN
Iteration-2 0.163746150615596 55.4891814301507 400.000000000000
Iteration-3 0.425739991600551 15.7281282816083 61.5384615384616
Iteration-4 0.355874967337896 3.26315430819410 19.6319018404908
Iteration-5 0.369847972190427 0.535102209766377 3.77804014167651
Iteration-6 0.367612291414022 0.0726188331073036 0.608162683517845
Iteration-7 0.367910382184209 0.00841063927585486 0.0810226578596741
Iteration-8 0.367876314667616 0.000849871853652409 0.00926058983265374
Question 2:
Use Taylor series expansions to predict 𝑓(2.5) for 𝑓 (𝑥 ) = ln 𝑥 using point at 𝑥𝑖 = 2. Compute
the true percent relative error 𝜖𝑡 for each approximation until the approximation relative error 𝜖𝑎
fall below 0.02%.
Solution:
Approximation 𝜖𝑡 (%) 𝜖𝑎 (%)
Iteration-1 0.693147180559945 24.3529202633970 NaN
Iteration-2 0.943147180559945 2.93099643503528 26.5069975453434
Iteration-3 0.911897180559945 0.479493152268754 3.42692144094701
Iteration-4 0.917105513893279 0.0889217789485896 0.567909935599782
Iteration-5 0.916128951393279 0.0176560206546615 0.106596620324553
Iteration-6 0.916324263893279 0.00365953926599355 0.0213147798979152
Iteration-7 0.916283573789112 0.000781202384137875 0.00444077634158208
Question 3:
Solution:
Approximation 𝜖𝑡 (%) 𝜖𝑎 (%)
Iteration-1 0.707106781186548 18.3503419072274 NaN
Iteration-2 0.892226903609813 3.02548859547035 20.7480991297503
Iteration-3 0.867994736249956 0.227398925818022 2.79174127997006
Iteration-4 0.865880080723337 0.0167804616893450 0.244220368812794
Iteration-5 0.866018484603905 0.000798958148695011 0.0159816312271949
Iteration-6 0.866025731414146 0 0.000836789252035521
Iteration-7 0.866025415212398 0 3.65118323201557e-05
Bisection Method:
Question 1:
Determine the positive real root of ln 𝑥 4 = 0.7 using the bisection method, with initial guesses
of 𝑥𝑙 = 0.5 and 𝑥𝑢 = 2. Compute the true percent relative error 𝜖𝑡 for each approximation until
the approximation relative error 𝜖𝑎 fall below 0.02%.
Solution:
Approximation 𝜖𝑡 (%) 𝜖𝑎 (%)
Iteration-1 1.25000000000000 4.93619879113499 NaN
Iteration-2 0.875000000000000 26.5446608462055 42.8571428571429
Iteration-3 1.06250000000000 10.8042310275353 17.6470588235294
Iteration-4 1.15625000000000 2.93401611820014 8.10810810810811
Iteration-5 1.20312500000000 1.00109133646742 3.89610389610390
Iteration-6 1.17968750000000 0.966462390866356 1.98675496688742
Iteration-7 1.19140625000000 0.0173144728005342 0.983606557377049
Iteration-8 1.18554687500000 0.474573959032911 0.494233937397035
Iteration-9 1.18847656250000 0.228629743116188 0.246507806080526
Iteration-10 1.18994140625000 0.105657635157827 0.123102174805088
Iteration-11 1.19067382812500 0.0441715811786465 0.0615132253434488
Iteration-12 1.19104003906250 0.0134285541890561 0.0307471558880804
Iteration-13 1.19122314453125 0.00194295930573904 0.0153712148383461
Question 2:
Given 𝑓 (𝑥 ) = −2𝑥 6 − 1.6𝑥 4 + 12𝑥 + 1 Use bisection to determine the maximum of this
function. Employ initial guesses of 𝑥𝑙 = 0 and 𝑥𝑢 = 1, and perform iterations until the
approximate relative error 𝜖𝑎 falls below 0.05%.
Solution:
Approximation 𝜖𝑡 (%) 𝜖𝑎 (%)
Iteration-1 0.500000000000000 44.7200286632123 NaN
Iteration-2 0.750000000000000 17.0800429948184 33.3333333333333
Iteration-3 0.875000000000000 3.26005016062145 14.2857142857143
Iteration-4 0.937500000000000 3.64994625647701 6.66666666666667
Iteration-5 0.906250000000000 0.194948047927780 3.44827586206897
Iteration-6 0.890625000000000 1.53255105634684 1.75438596491228
Iteration-7 0.898437500000000 0.668801504209528 0.869565217391304
Iteration-8 0.902343750000000 0.236926728140874 0.432900432900433
Iteration-9 0.904296875000000 0.0209893401065471 0.215982721382289
Iteration-10 0.905273437500000 0.0869793539106165 0.107874865156419
Iteration-11 0.904785156250000 0.0329950069020347 0.0539665407447383
Iteration-12 0.904541015625000 0.00600283339774379 0.0269905533063428
Question 3:
Determine the roots of 𝑓(𝑥 ) = −13 − 20𝑥 + 19𝑥 2 − 3𝑥 3 use bisection, use initial guesses of
𝑥𝑙 = −1 and 𝑥𝑢 = 0 and a stopping criterion of 0.01%.
Solutions:
Question 1:
Determine the positive real root of ln 𝑥 4 = 0.7 using the False-Position method, with initial
guesses of 𝑥𝑙 = 0.5 and 𝑥𝑢 = 2. Compute the true percent relative error 𝜖𝑡 for each
approximation until the approximation relative error 𝜖𝑎 fall below 0.02%.
Solution:
Question 2:
Given 𝑓 (𝑥 ) = −2𝑥 6 − 1.6𝑥 4 + 12𝑥 + 1 Use False-Position method to determine the maximum
of this function. Employ initial guesses of 𝑥𝑙 = 0 and 𝑥𝑢 = 1 and perform iterations until the
approximate relative error 𝜖𝑎 falls below 0.05%.
Solution: