0% found this document useful (0 votes)
30 views

Assignment Solutions

Uploaded by

saher.khkefat12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Assignment Solutions

Uploaded by

saher.khkefat12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Taylor Series:

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:

Use Taylor series expansions with n = 0 to 6 to approximate 𝑓 (𝑥 ) = sin(𝑥) at 𝑥𝑖+1 = 𝜋⁄3 on


the basis of the value of f (x) and its derivatives at 𝑥𝑖 = 𝜋⁄4.

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:

Approximation 𝜖𝑡 (%) 𝜖𝑎 (%)


Iteration-1 -0.500000000000000 11.8846718826622 NaN
Iteration-2 -0.250000000000000 44.0576640586689 100
Iteration-3 -0.375000000000000 16.0864960880034 33.3333333333333
Iteration-4 -0.437500000000000 2.10091210267059 14.2857142857143
Iteration-5 -0.468750000000000 4.89187988999579 6.66666666666667
Iteration-6 -0.453125000000000 1.39548389366260 3.44827586206897
Iteration-7 -0.445312500000000 0.352714104503998 1.75438596491228
Iteration-8 -0.449218750000000 0.521384894579300 0.869565217391304
Iteration-9 -0.447265625000000 0.0843353950376511 0.436681222707424
Iteration-10 -0.446289062500000 0.134189354733173 0.218818380743983
Iteration-11 -0.446777343750000 0.0249269798477612 0.109289617486339
Iteration-12 -0.447021484375000 0.0297042075949449 0.0546149645002731
Iteration-13 -0.446899414062500 0.00238861387359187 0.0273149412728763
Iteration-14 -0.446838378906250 0.0112691829870847 0.0136593361562628
Iteration-15 -0.446868896484375 0.00444028455674640 0.00682920166632521
False- Position Method:

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:

Approximation 𝜖𝑡 (%) 𝜖𝑎 (%)


Iteration-1 1.43935372411668 20.8322468197344 NaN
Iteration-2 1.27127150635191 6.72191960643985 13.2215830312362
Iteration-3 1.21753371738797 2.21068816218647 4.41365920273918
Iteration-4 1.19993568201211 0.733351411358840 1.46658155430044
Iteration-5 1.19412460764847 0.245517767668506 0.486638858827533
Iteration-6 1.19220035295647 0.0839785893614231 0.161403633812230
Iteration-7 1.19156256963589 0.0304373435096998 0.0535249542775264
Iteration-8 1.19135111456561 0.0126859104775866 0.0177491813868519

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:

Approximation 𝜖𝑡 (%) 𝜖𝑎 (%)


Iteration-1 0.652173913043478 27.8956895607116 NaN
Iteration-2 0.853632783388186 5.62240840431750 23.6001796399020
Iteration-3 0.895682159513965 0.973431790391763 4.69467608337725
Iteration-4 0.903012340800381 0.163007367578652 0.811747631258207
Iteration-5 0.904241266768405 0.0271373830038207 0.135906866141624
Iteration-6 0.904445897837549 0.00451338373007293 0.0226250204277387

You might also like