Baixe resolucao do exercicios e outras Exercícios em PDF para Métodos Computacionais, somente na Docsity! Faculdade de Ciências e Tecnologia Métodos Computacionais para Equações Diferenciais Nelson Roldan Condori Colquehuanca 28 de março de 2023 2a Tarefa – Aproximação de Derivadas pelo Método de Diferenças Finitas Escreva um programa para resolver os PVIs abaixo utilizando as três fórmulas de diferenças (avançada, atrasada e centrada) e diferentes espaçamentos (valores de h). Plote um gráfico comparando a solução exata comas soluções aproximadas para cada PVI. Além disso, calcule o erro local e o erro relativo para cada aproximação. a. { y′=x−y. x∈[0,1]. y(0)=1 Solução exata: y(x) = x− 1 + 2e−x Começando a aproximar com, h = 0.1 . A = 11×5 table x Sol Euler Explicito Error Local Erro Relativo ___ _________________ _______________ ___________________ __________________ 0 1 1 0 0 0.1 0.909674836071919 0.9 0.00967483607191899 0.0106354882956816 0.2 0.837461506155964 0.82 0.0174615061559635 0.0208505179373721 0.3 0.781636441363436 0.758 0.0236364413634355 0.0302396870368602 0.4 0.740640092071279 0.7122 0.0284400920712785 0.0383993418338221 0.5 0.713061319425267 0.68098 0.0320813194252666 0.0449909685903653 0.6 0.697623272188053 0.662882 0.0347412721880527 0.0497994742622172 0.7 0.693170607582819 0.6565938 0.0365768075828188 0.0527673954762264 0.8 0.698657928234443 0.66093442 0.037723508234443 0.0539942462683748 0.9 0.713139319481198 0.674840978 0.038298341481198 0.0537038702466437 1 0.735758882342885 0.6973568802 0.0384020021428845 0.0521937323007241 T = 11×5 table x Sol Euler Implicito Error Local Erro Relativo ___ _________________ _________________ ___________________ ___________________ 0 1 1 0 0 0.1 0.909674836071919 0.918181818181818 0.00850698210989909 0.00935167355693076 0.2 0.837461506155964 0.852892561983471 0.0154310558275074 0.018425988196565 0.3 0.781636441363436 0.802629601803155 0.0209931604397198 0.0268579602085858 0.4 0.740640092071279 0.766026910730141 0.0253868186588625 0.0342768625822909 0.5 0.713061319425267 0.74184264611831 0.0287813266930433 0.0403630457984193 0.6 0.697623272188053 0.728947860107555 0.0313245879195017 0.0449018677677624 0.7 0.693170607582819 0.726316236461413 0.0331456288785942 0.0478174182748134 0.8 0.698657928234443 0.733014760419466 0.0343568321850233 0.049175470278918 0.9 0.713139319481198 0.748195236744969 0.0350559172637712 0.0491571791179233 1 0.735758882342885 0.771086578859063 0.0353276965161784 0.0480153177406218 C = 1 11×5 table x Sol Centrada Error Local Erro Relativo ___ _________________ ______________ ____________________ ____________________ 0 1 1 0 0 0.1 0.909674836071919 0.909 0.000674836071918983 0.000741843178638427 0.2 0.837461506155964 0.8382 0.000738493844036348 0.000881824225481255 0.3 0.781636441363436 0.78136 0.00027644136343552 0.000353670004117661 0.4 0.740640092071279 0.741928 0.00128790792872124 0.00173891197966272 0.5 0.713061319425267 0.7129744 8.69194252667294e-05 0.000121896143990516 0.6 0.697623272188053 0.69933312 0.00170984781194694 0.00245096154344752 0.7 0.693170607582819 0.693107776 6.28315828188342e-05 9.06437493619883e-05 0.8 0.698657928234443 0.7007115648 0.00205363656555668 0.00293940207727459 0.9 0.713139319481198 0.71296546304 0.00017385644119805 0.000243790289567162 1 0.735758882342885 0.738118472192 0.00235958984911511 0.00320701510473301 >> Figura 1: Gráfico de comparação com as soluções exatas e aproximadas. b. { y′=−2xy. x∈[−2.5,2.5]. y(−2.5)=e−6.25 Solução exata: y(x) = e−x2 Começando a aproximar, h = 0.05 . A = 101×5 table x Sol Euler Explicito Error Local Erro Relativo _____ _________ _______________ ___________ _____________ -2.5 0.0019305 0.0019305 0 0 -2.45 0.0024726 0.0024131 5.9495e-05 0.024062 -2.4 0.0031511 0.0030043 0.00014684 0.0466 -2.35 0.0039958 0.0037253 0.00027055 0.067708 -2.3 0.0050418 0.0046007 0.00044102 0.087474 -2.25 0.0063297 0.0056589 0.00067081 0.10598 -2.2 0.0079071 0.0069322 0.00097489 0.12329 2 -0.65 0.65541 1.0572 0.40177 0.613 -0.6 0.69768 1.1247 0.42698 0.612 -0.55 0.73897 1.1901 0.45114 0.6105 -0.5 0.7788 1.2527 0.47394 0.60856 -0.45 0.81669 1.3118 0.49509 0.60622 -0.4 0.85214 1.3664 0.51429 0.60352 -0.35 0.88471 1.416 0.53129 0.60052 -0.3 0.91393 1.4598 0.54585 0.59726 -0.25 0.93941 1.4972 0.5578 0.59378 -0.2 0.96079 1.5278 0.56698 0.59012 -0.15 0.97775 1.551 0.57329 0.58633 -0.1 0.99005 1.5667 0.57665 0.58245 -0.05 0.9975 1.5746 0.57707 0.57852 0 1 1.5746 0.57458 0.57458 0.05 0.9975 1.5667 0.56924 0.57067 0.1 0.99005 1.5512 0.56118 0.56682 0.15 0.97775 1.5283 0.55056 0.56308 0.2 0.96079 1.4983 0.53755 0.55949 0.25 0.93941 1.4618 0.52238 0.55607 0.3 0.91393 1.4192 0.50529 0.55287 0.35 0.88471 1.3712 0.48652 0.54992 0.4 0.85214 1.3185 0.46634 0.54726 0.45 0.81669 1.2617 0.44502 0.54491 0.5 0.7788 1.2016 0.42283 0.54292 0.55 0.73897 1.139 0.40002 0.54132 0.6 0.69768 1.0745 0.37684 0.54013 0.65 0.65541 1.0089 0.35353 0.5394 0.7 0.61263 0.94293 0.3303 0.53916 0.75 0.56978 0.87714 0.30736 0.53943 0.8 0.52729 0.81217 0.28488 0.54026 0.85 0.48554 0.74854 0.26301 0.54168 0.9 0.44486 0.68674 0.24188 0.54372 0.95 0.40555 0.62716 0.2216 0.54642 1 0.36788 0.57014 0.20226 0.54981 1.05 0.33204 0.51597 0.18393 0.55393 1.1 0.2982 0.46483 0.16664 0.55881 1.15 0.26647 0.41689 0.15042 0.56451 1.2 0.23693 0.37222 0.1353 0.57105 1.25 0.20961 0.33087 0.12125 0.57847 1.3 0.18452 0.2928 0.10828 0.58683 1.35 0.16162 0.25798 0.096354 0.59617 1.4 0.14086 0.22629 0.085436 0.60654 1.45 0.12215 0.19764 0.075486 0.61798 1.5 0.1054 0.17186 0.066459 0.63054 1.55 0.090491 0.14879 0.058303 0.6443 1.6 0.077305 0.12827 0.050967 0.6593 1.65 0.06571 0.1101 0.044394 0.6756 1.7 0.055576 0.094106 0.03853 0.69328 1.75 0.046771 0.08009 0.03332 0.71241 1.8 0.039164 0.067873 0.028709 0.73306 1.85 0.032631 0.057277 0.024646 0.75531 1.9 0.027052 0.048132 0.02108 0.77925 1.95 0.022315 0.040278 0.017963 0.80497 2 0.018316 0.033565 0.015249 0.83257 2.05 0.014958 0.027855 0.012896 0.86217 2.1 0.012155 0.02302 0.010865 0.89387 2.15 0.0098282 0.018947 0.0091186 0.9278 2.2 0.0079071 0.01553 0.0076231 0.96409 2.25 0.0063297 0.012678 0.0063479 1.0029 2.3 0.0050418 0.010307 0.0052653 1.0443 2.35 0.0039958 0.0083458 0.0043499 1.0886 2.4 0.0031511 0.0067305 0.0035794 1.1359 2.45 0.0024726 0.005406 0.0029334 1.1864 2.5 0.0019305 0.0043248 0.0023943 1.2403 C = 101×5 table 5 x Sol Centrada Error Local Erro Relativo _____ _________ _________ ___________ _____________ -2.5 0.0019305 0.0019305 0 0 -2.45 0.0024726 0.0024726 0 0 -2.4 0.0031511 0.003142 9.1016e-06 0.0028884 -2.35 0.0039958 0.0039807 1.5118e-05 0.0037834 -2.3 0.0050418 0.005013 2.8808e-05 0.0057139 -2.25 0.0063297 0.0062867 4.303e-05 0.006798 -2.2 0.0079071 0.007842 6.5093e-05 0.0082323 -2.15 0.0098282 0.0097371 9.1046e-05 0.0092638 -2.1 0.012155 0.012029 0.00012624 0.010386 -2.05 0.014958 0.014789 0.00016883 0.011287 -2 0.018316 0.018093 0.00022309 0.01218 -1.95 0.022315 0.022026 0.00028859 0.012933 -1.9 0.027052 0.026683 0.00036903 0.013642 -1.85 0.032631 0.032166 0.00046497 0.014249 -1.8 0.039164 0.038584 0.00057974 0.014803 -1.75 0.046771 0.046056 0.00071454 0.015277 -1.7 0.055576 0.054704 0.00087243 0.015698 -1.65 0.06571 0.064655 0.0010549 0.016054 -1.6 0.077305 0.07604 0.0012647 0.01636 -1.55 0.090491 0.088988 0.0015033 0.016612 -1.5 0.1054 0.10363 0.0017728 0.01682 -1.45 0.12215 0.12008 0.0020746 0.016984 -1.4 0.14086 0.13845 0.00241 0.017109 -1.35 0.16162 0.15884 0.0027795 0.017198 -1.3 0.18452 0.18134 0.0031838 0.017255 -1.25 0.20961 0.20599 0.0036224 0.017282 -1.2 0.23693 0.23283 0.0040948 0.017283 -1.15 0.26647 0.26187 0.0045994 0.017261 -1.1 0.2982 0.29306 0.0051345 0.017218 -1.05 0.33204 0.32634 0.0056972 0.017158 -1 0.36788 0.36159 0.0062847 0.017084 -0.95 0.40555 0.39866 0.0068929 0.016996 -0.9 0.44486 0.43734 0.0075176 0.016899 -0.85 0.48554 0.47738 0.008154 0.016794 -0.8 0.52729 0.5185 0.0087968 0.016683 -0.75 0.56978 0.56034 0.0094406 0.016569 -0.7 0.61263 0.60255 0.010079 0.016453 -0.65 0.65541 0.6447 0.010707 0.016337 -0.6 0.69768 0.68636 0.011319 0.016223 -0.55 0.73897 0.72706 0.011907 0.016113 -0.5 0.7788 0.76633 0.012466 0.016007 -0.45 0.81669 0.8037 0.012991 0.015907 -0.4 0.85214 0.83867 0.013477 0.015815 -0.35 0.88471 0.87079 0.013917 0.015731 -0.3 0.91393 0.89962 0.014309 0.015656 -0.25 0.93941 0.92477 0.014647 0.015592 -0.2 0.96079 0.94586 0.014929 0.015538 -0.15 0.97775 0.9626 0.015151 0.015496 -0.1 0.99005 0.97474 0.015311 0.015465 -0.05 0.9975 0.9821 0.015408 0.015447 0 1 0.98456 0.01544 0.01544 0.05 0.9975 0.9821 0.015408 0.015447 0.1 0.99005 0.97474 0.015311 0.015465 0.15 0.97775 0.9626 0.015151 0.015496 0.2 0.96079 0.94586 0.014929 0.015538 0.25 0.93941 0.92477 0.014647 0.015592 0.3 0.91393 0.89962 0.014309 0.015656 0.35 0.88471 0.87079 0.013917 0.015731 0.4 0.85214 0.83867 0.013477 0.015815 0.45 0.81669 0.8037 0.012991 0.015907 0.5 0.7788 0.76633 0.012466 0.016007 0.55 0.73897 0.72706 0.011907 0.016113 0.6 0.69768 0.68636 0.011319 0.016223 0.65 0.65541 0.6447 0.010707 0.016337 0.7 0.61263 0.60255 0.010079 0.016453 0.75 0.56978 0.56034 0.0094406 0.016569 0.8 0.52729 0.5185 0.0087968 0.016683 6 0.85 0.48554 0.47738 0.008154 0.016794 0.9 0.44486 0.43734 0.0075176 0.016899 0.95 0.40555 0.39866 0.0068929 0.016996 1 0.36788 0.36159 0.0062847 0.017084 1.05 0.33204 0.32634 0.0056972 0.017158 1.1 0.2982 0.29306 0.0051345 0.017218 1.15 0.26647 0.26187 0.0045994 0.017261 1.2 0.23693 0.23283 0.0040948 0.017283 1.25 0.20961 0.20599 0.0036224 0.017282 1.3 0.18452 0.18134 0.0031838 0.017255 1.35 0.16162 0.15884 0.0027795 0.017198 1.4 0.14086 0.13845 0.00241 0.017109 1.45 0.12215 0.12008 0.0020746 0.016984 1.5 0.1054 0.10363 0.0017728 0.01682 1.55 0.090491 0.088988 0.0015033 0.016612 1.6 0.077305 0.07604 0.0012647 0.01636 1.65 0.06571 0.064655 0.0010549 0.016054 1.7 0.055576 0.054704 0.00087243 0.015698 1.75 0.046771 0.046056 0.00071454 0.015277 1.8 0.039164 0.038584 0.00057974 0.014803 1.85 0.032631 0.032166 0.00046497 0.014249 1.9 0.027052 0.026683 0.00036903 0.013642 1.95 0.022315 0.022026 0.00028859 0.012933 2 0.018316 0.018093 0.00022309 0.01218 2.05 0.014958 0.014789 0.00016883 0.011287 2.1 0.012155 0.012029 0.00012624 0.010386 2.15 0.0098282 0.0097371 9.1046e-05 0.0092638 2.2 0.0079071 0.007842 6.5093e-05 0.0082323 2.25 0.0063297 0.0062867 4.303e-05 0.006798 2.3 0.0050418 0.005013 2.8808e-05 0.0057139 2.35 0.0039958 0.0039807 1.5118e-05 0.0037834 2.4 0.0031511 0.003142 9.1016e-06 0.0028884 2.45 0.0024726 0.0024726 3.6694e-15 1.484e-12 2.5 0.0019305 0.0019305 4.6848e-15 2.4268e-12 Figura 2: Gráfico de comparação com as soluções exatas e aproximadas. Começando a aproximar com, h = 0.1 . A = 51×5 table 7 -0.9 0.44486 0.41868 0.026177 0.058845 -0.8 0.52729 0.4967 0.030593 0.058019 -0.7 0.61263 0.57762 0.035002 0.057134 -0.6 0.69768 0.65843 0.039242 0.056247 -0.5 0.7788 0.73565 0.043152 0.055408 -0.4 0.85214 0.80556 0.04658 0.054662 -0.3 0.91393 0.86454 0.049392 0.054044 -0.2 0.96079 0.90931 0.051481 0.053582 -0.1 0.99005 0.93728 0.052766 0.053297 0 1 0.9468 0.0532 0.0532 0.1 0.99005 0.93728 0.052766 0.053297 0.2 0.96079 0.90931 0.051481 0.053582 0.3 0.91393 0.86454 0.049392 0.054044 0.4 0.85214 0.80556 0.04658 0.054662 0.5 0.7788 0.73565 0.043152 0.055408 0.6 0.69768 0.65843 0.039242 0.056247 0.7 0.61263 0.57762 0.035002 0.057134 0.8 0.52729 0.4967 0.030593 0.058019 0.9 0.44486 0.41868 0.026177 0.058845 1 0.36788 0.34597 0.021905 0.059544 1.1 0.2982 0.28029 0.017906 0.060049 1.2 0.23693 0.22265 0.014281 0.060277 1.3 0.18452 0.17342 0.011099 0.06015 1.4 0.14086 0.13247 0.0083907 0.059569 1.5 0.1054 0.099239 0.0061605 0.058449 1.6 0.077305 0.072924 0.0043803 0.056662 1.7 0.055576 0.052567 0.0030092 0.054145 1.8 0.039164 0.037179 0.001985 0.050685 1.9 0.027052 0.025798 0.0012536 0.04634 2 0.018316 0.017572 0.00074344 0.04059 2.1 0.012155 0.01174 0.00041469 0.034116 2.2 0.0079071 0.0077102 0.00019686 0.024897 2.3 0.0050418 0.0049555 8.6239e-05 0.017105 2.4 0.0031511 0.0031511 1.2187e-14 3.8676e-12 2.5 0.0019305 0.0019305 1.9469e-14 1.0085e-11 Figura 3: Gráfico de comparação com as soluções exatas e aproximadas. c. { y′=5y−1. x∈[0,2]. y(0)=1.2 Solução exata: y(x) = e5x + 0.2 Começando a aproximar com os seguintes dados, h = 0.1 . 10 A = 21×5 table x Sol Euler Explicito Error Local Erro Relativo ___ ________________ ________________ _________________ __________________ 0 1.2 1.2 0 0 0.1 1.84872127070013 1.7 0.148721270700128 0.0804454803745543 0.2 2.91828182845905 2.45 0.468281828459046 0.160464909143581 0.3 4.68168907033807 3.575 1.10668907033807 0.236386708666697 0.4 7.58905609893065 5.2625 2.32655609893065 0.306567255347932 0.5 12.3824939607035 7.79375 4.58874396070347 0.370583177772273 0.6 20.2855369231877 11.590625 8.69491192318768 0.428626166322905 0.7 33.3154519586923 17.2859375 16.0295144586923 0.481143538997077 0.8 54.7981500331442 25.82890625 28.9692437831442 0.528653682024346 0.9 90.2171313005218 38.643359375 51.5737719255218 0.571662733918292 1 148.613159102577 57.8650390625 90.7481200400766 0.61063314034957 1.1 244.89193226422 86.69755859375 158.19437367047 0.645976256579128 1.2 403.628793492735 129.946337890625 273.68245560211 0.678054836558721 1.3 665.341633044361 194.819506835937 470.522126208424 0.707188762644366 1.4 1096.83315842846 292.129260253906 804.703898174552 0.733661169878864 1.5 1808.24241445606 438.093890380859 1370.1485240752 0.757723916396109 1.6 2981.15798704173 657.040835571289 2324.11715147044 0.779602141708938 1.7 4914.96884029913 985.461253356934 3929.5075869422 0.79949796522068 1.8 8103.28392757538 1478.0918800354 6625.19204753998 0.817593472813476 1.9 13359.9268296619 2217.0378200531 11142.8890096088 0.834053146523916 2 22026.6657948067 3325.45673007965 18701.2090647271 0.849025868869191 T = 21×5 table x Sol Euler Implicito Error Local Erro Relativo ___ ________________ _______________ _________________ _________________ 0 1.2 1.2 0 0 0.1 1.84872127070013 2.2 0.351278729299872 0.190011731279988 0.2 2.91828182845905 4.2 1.28171817154095 0.439203012896717 0.3 4.68168907033807 8.2 3.51831092966193 0.751504612288974 0.4 7.58905609893065 16.2 8.61094390106935 1.13465281964152 0.5 12.3824939607035 32.2 19.8175060392965 1.60044544355834 0.6 20.2855369231877 64.2 43.9144630768123 2.16481640309038 0.7 33.3154519586923 128.2 94.8845480413077 2.84806426036046 0.8 54.7981500331442 256.2 201.401849966856 3.6753403143179 0.9 90.2171313005218 512.2 421.982868699478 4.67741395249881 1 148.613159102577 1024.2 875.586840897423 5.89171811019151 1.1 244.89193226422 2048.2 1803.30806773578 7.36368916306374 1.2 403.628793492735 4096.2 3692.57120650726 9.14843357569763 1.3 665.341633044361 8192.2 7526.85836695564 11.3127722558342 1.4 1096.83315842846 16384.2 15287.3668415715 13.9377322103165 1.5 1808.24241445606 32768.2 30959.9575855439 17.1215747059318 1.6 2981.15798704173 65536.2 62555.0420129583 20.9834709481577 1.7 4914.96884029913 131072.2 126157.231159701 25.6679615393091 1.8 8103.28392757538 262144.2 254040.916072425 31.3503658939959 1.9 13359.9268296619 524288.2 510928.273170338 38.2433436713118 2 22026.6657948067 1048576.2 1026549.53420519 46.6048535792115 C = 21×5 table x Sol Centrada Error Local Erro Relativo ___ ________________ ________ _________________ _________________ 0 1.2 1 0.2 0.166666666666667 0.1 1.84872127070013 0.909 0.939721270700128 0.508308789212041 0.2 2.91828182845905 1.709 1.20928182845905 0.414381440704645 11 0.3 4.68168907033807 2.418 2.26368907033807 0.483519737498203 0.4 7.58905609893065 3.927 3.66205609893065 0.482544344275787 0.5 12.3824939607035 6.145 6.23749396070347 0.503734867991739 0.6 20.2855369231877 9.872 10.4135369231877 0.513347857767784 0.7 33.3154519586923 15.817 17.4984519586923 0.525235316644918 0.8 54.7981500331442 25.489 29.3091500331442 0.534856560219949 0.9 90.2171313005218 41.106 49.1111313005218 0.544365915791846 1 148.613159102577 66.395 82.2181591025766 0.553236063340983 1.1 244.89193226422 107.301 137.59093226422 0.561843467002293 1.2 403.628793492735 173.496 230.132793492735 0.570159505969133 1.3 665.341633044361 280.597 384.744633044361 0.578266282967909 1.4 1096.83315842846 453.893 642.940158428458 0.58617863025737 1.5 1808.24241445606 734.29 1073.95241445606 0.593920597078306 1.6 2981.15798704173 1187.983 1793.17498704173 0.601502837097586 1.7 4914.96884029913 1922.073 2992.89584029913 0.608934855448032 1.8 8103.28392757538 3109.856 4993.42792757538 0.616222752677196 1.9 13359.9268296619 5031.729 8328.19782966187 0.623371515117246 2 22026.6657948067 8141.385 13885.2807948067 Figura 4: Gráfico de comparação com as soluções exatas e aproximadas. Começando a aproximar com, h = 0.02 . A = 101×5 table x Sol Euler Explicito Error Local Erro Relativo ____ ________________ ________________ ___________________ ___________________ 0 1.2 1.2 0 0 0.02 1.30517091807565 1.3 0.00517091807564762 0.00396187043707016 0.04 1.42140275816017 1.41 0.0114027581601697 0.00802218660031948 0.06 1.549858807576 1.531 0.018858807576003 0.012168081043136 0.08 1.69182469764127 1.6641 0.0277246976412702 0.016387452955335 0.1 1.84872127070013 1.81051 0.0382112707001281 0.0206690274546671 0.12 2.02211880039051 1.971561 0.0505578003905087 0.0250023887719876 0.14 2.21375270747048 2.1487171 0.0650356074704765 0.0293779911599922 0.16 2.42554092849247 2.34358881 0.0819521184924676 0.0337871513647897 0.18 2.65960311115695 2.557947691 0.101655420156949 0.0382220263356243 0.2 2.91828182845905 2.7937424601 0.124539368359045 0.0426755795634744 0.22 3.20416602394643 3.05311670611 0.151049317836433 0.0471415390799233 12 0.84 66.8863310409252 83.7246382862392 16.838307245314 0.251745117175157 0.86 73.8997936995958 93.0051536513769 19.1053599517811 0.258530626343082 0.88 81.6508686649681 103.316837390419 21.6659687254506 0.265348906627692 0.9 90.2171313005218 114.774263767132 24.5571324666101 0.272200325066954 0.92 99.6843156419339 127.504737519035 27.8204218771016 0.27908524724223 0.94 110.147172452124 141.649708354484 31.5025359023603 0.286004036245717 0.96 121.710417518735 157.366342616093 35.6559250973583 0.292957051863451 0.98 134.489779684936 174.829269573437 40.3394898885013 0.299944649942941 1 148.613159102577 194.232521748263 45.6193626456865 0.30696718191825 1.02 164.221907299902 215.791690831403 51.5697835315017 0.314024994468766 1.04 181.472241875151 239.746323146004 58.2740812708525 0.321118429290931 1.06 200.536809974792 266.362581273337 65.8257712985456 0.328247822964872 1.08 221.606416204187 295.936201414819 74.3297852106323 0.335413506900202 1.1 244.89193226422 328.795779349799 83.903847085579 0.342615807347434 1.12 270.626407426153 365.306421499777 94.6800140736244 0.349855045463219 1.14 299.067400967061 405.873801666419 106.806400699358 0.357131537419293 1.16 330.499559909649 450.948668518243 120.449108608594 0.364445594546397 1.18 365.237467865329 501.031853909159 135.794386043831 0.371797523505724 1.2 403.628793492735 556.679837676844 153.051044184109 0.379187626481517 1.22 446.057770082517 618.510930752049 172.453160669532 0.386616201389406 1.24 492.949041093256 687.212145280054 194.263104186798 0.394083542095879 1.26 544.771910125929 763.546828088949 218.77491796302 0.401589938645052 1.28 602.045037872082 848.363142321054 246.318104448972 0.409135677489477 1.3 665.341633044361 942.603491467838 277.261858423477 0.416721041722322 1.32 735.295189241973 1047.31499051982 312.019801277847 0.424346311308678 1.34 812.605825167543 1163.66110057758 351.055275410036 0.432011763314218 1.36 898.047291650417 1292.93455619731 394.887264546892 0.439717672129688 1.38 992.474715605025 1436.57172910812 444.097013503096 0.447464309690115 1.4 1096.83315842846 1596.16858789791 499.335429469454 0.455251945687803 1.42 1212.16707449258 1773.49843099768 561.331356505104 0.463080847778415 1.44 1339.63076439442 1970.53158999742 630.900825603005 0.470951281779652 1.46 1480.49992758455 2189.45732221936 708.957394634813 0.478863511862163 1.48 1636.18442999593 2432.70813579929 796.523705803359 0.48681780073249 1.5 1808.24241445606 2702.98681755476 894.744403098699 0.494814409807906 1.52 1998.39589510412 3003.29646394974 1004.90056884562 0.502853599383151 1.54 2208.54799188721 3336.97384883304 1128.42585694583 0.510935628789116 1.56 2440.8019776245 3707.72649870338 1266.92452107888 0.519060756543596 1.58 2697.48232826851 4119.6738874482 1422.19155917969 0.527229240494258 1.6 2981.15798704173 4577.39320827577 1596.23522123405 0.535441337954057 1.62 3294.66807528385 5085.97023141753 1791.30215613368 0.543697305829315 1.64 3641.15030733236 5651.05581268614 2009.90550535378 0.551997400740733 1.66 4024.07239382231 6278.92868076238 2254.85628694007 0.560341879137585 1.68 4447.26674769986 6976.56520084708 2529.29845314723 0.568730997405404 1.7 4914.96884029913 7751.71688983009 2836.74804953096 0.577165011967463 1.72 5431.85959136298 8612.99654425566 3181.13695289268 0.585644179380281 1.74 6003.11221726102 9569.97393806184 3566.86172080083 0.594168756423521 1.76 6634.44400627789 10633.282153402 3998.83814712416 0.602739000184526 1.78 7332.173539156 11814.7357260023 4482.56218684628 0.611355168137805 1.8 8103.28392757538 13127.4619177803 5024.17799020492 0.620017518219706 1.82 8955.49270348251 14586.0465753114 5630.55387182894 0.628726308898604 1.84 9897.32905874393 16206.6961947905 6309.36713604657 0.637481799240824 1.86 10938.2192081652 18007.4179942117 7069.19878604649 0.646284248972581 1.88 12088.580730217 20008.2199935685 7919.63926335154 0.655133918538128 1.9 13359.9268296619 22231.3333261872 8871.40649652536 0.664031069154432 1.92 14764.9815655773 24701.4592513191 9936.47768574188 0.672975962862531 1.94 16317.8071980154 27446.0436125768 11128.2364145614 0.681968862575777 1.96 18033.9449278285 30495.581791752 12461.6368639235 0.691010032125235 1.98 19930.5704382303 33883.9575463911 13953.3871081608 0.70009973630237 2 22026.6657948067 37648.8194959902 15622.1537011834 0.709238240899207 C = 101×5 table x Sol Centrada Error Local Erro Relativo ____ ________________ ________________ _________________ _________________ 0 1.2 1 0.2 0.166666666666667 0.02 1.30517091807565 0.909 0.396170918075648 0.303539492482536 15 0.04 1.42140275816017 1.1418 0.27960275816017 0.196709030255493 0.06 1.549858807576 1.09736 0.452498807576003 0.29196130987165 0.08 1.69182469764127 1.321272 0.37055269764127 0.219025468866776 0.1 1.84872127070013 1.3216144 0.527106870700128 0.285119708987017 0.12 2.02211880039051 1.54559488 0.476523920390509 0.235655748959202 0.14 2.21375270747048 1.590733376 0.623019331470477 0.281431313157992 0.16 2.42554092849247 1.8237415552 0.601799373292468 0.248109345929075 0.18 2.65960311115695 1.91548168704 0.74412142411695 0.279786642223189 0.2 2.91828182845905 2.166837892608 0.751443935851046 0.257495327738046 0.22 3.20416602394643 2.3088492655616 0.895316758384833 0.279422711461783 0.24 3.52011692273655 2.58860774572032 0.931509177016227 0.264624498976037 0.26 3.86929666761924 2.78657081470566 1.08272585291358 0.27982497748868 0.28 4.25519996684468 3.10592190866145 1.14927805818322 0.270087908238878 0.3 4.68168907033806 3.36775519643795 1.31393387390011 0.280653809802288 0.32 5.15303242439512 3.73947294794904 1.41355947644607 0.274316045393796 0.34 5.6739473917272 4.07564978602776 1.59829760569944 0.281690593048115 0.36 6.24964746441294 4.5146029051546 1.73504455925835 0.277622788987399 0.38 6.88589444227927 4.93857036705868 1.94732407522059 0.282799001864457 0.4 7.58905609893065 5.46231697856633 2.12673912036432 0.280237633328865 0.42 8.36616991256765 5.99103376277195 2.3751361497957 0.283897670572979 0.44 9.22501349943412 6.62052373112072 2.6044897683134 0.282329101033095 0.46 10.1741824548147 7.27513850899609 2.89904394581863 0.284941218490407 0.48 11.2231763806416 8.03555143291994 3.18762494772166 0.284021638759938 0.5 12.3824939607035 8.84224879558008 3.54024516512339 0.285907279774055 0.52 13.6637380350017 9.76400119203596 3.89973684296573 0.285407758329088 0.54 15.0797317248728 10.7550490339873 4.32468269088556 0.286787773800534 0.56 16.6446467710971 11.8750109988334 4.76963577226364 0.286556743309565 0.58 18.3741453694431 13.090051233754 5.2840941356891 0.287583124517822 0.6 20.2855369231877 14.4530212455842 5.83251567760346 0.28752089233273 0.62 22.3979512814416 15.9406554828708 6.45729579857084 0.28829850183312 0.64 24.7325301971094 17.6011523421584 7.13137785495099 0.288340003959016 0.66 27.3126389206579 19.4208859513025 7.89175296935542 0.288941430825511 0.68 30.164100047397 21.4453295324189 8.71877051497816 0.28904460936273 0.7 33.3154519586923 23.6699518577862 9.64550010090608 0.289520313663026 0.72 36.798234443678 26.1393199039761 10.6589145397019 0.289658313798071 0.74 40.6473043600674 28.8578158385815 11.7894885214859 0.290043551647379 0.76 44.9011844933008 31.8708830716924 13.0303014216084 0.29019950294524 0.78 49.6024491055302 35.1919924529199 14.4104566526103 0.29051905525777 0.8 54.7981500331442 38.8692815622764 15.9288684708678 0.290682595329101 0.82 60.540287597362 42.9258487653752 17.6144388319868 0.290953999907234 0.84 66.8863310409252 47.4144513153514 19.4718797255737 0.291118968891561 0.86 73.8997936995958 52.3687390284455 21.5310546711503 0.291354733122456 0.88 81.6508686649681 57.8481991210405 23.8026695439276 0.291517652330134 0.9 90.2171313005218 63.8983788526536 26.3187524478682 0.291726771495293 0.92 99.6843156419339 70.5878748915713 29.0964407503626 0.291885845461156 0.94 110.147172452124 77.9759538309679 32.1712186211556 0.29207484772375 0.96 121.710417518735 86.1430656577648 35.56735186097 0.29222931435179 0.98 134.489779684936 95.1645669625208 39.3252127224147 0.292402982699061 1 148.613159102577 105.135979050269 43.4771800523076 0.292552693952886 1.02 164.221907299902 116.151762772575 48.070144527327 0.292714567244317 1.04 181.472241875151 128.326331604784 53.1459102703673 0.292859721802139 1.06 200.536809974792 141.777029093531 58.7597808812604 0.293012444391863 1.08 221.606416204187 156.64173742349 64.9646787806969 0.293153419893938 1.1 244.89193226422 173.065376578229 71.8265556859909 0.293298987116061 1.12 270.626407426153 191.214812739136 79.4115946870166 0.293436237218225 1.14 299.067400967061 211.268339126057 87.7990618410038 0.293576168974278 1.16 330.499559909649 233.428480564347 97.0710793453014 0.293710162191558 1.18 365.237467865329 257.914035238926 107.323432626402 0.293845626664937 1.2 403.628793492735 284.971287612133 118.657505880602 0.293976811846893 1.22 446.057770082517 314.868292761353 131.189477321164 0.29410871443153 1.24 492.949041093256 347.904946164403 145.044094928853 0.294237502941838 1.26 544.771910125929 384.409281994233 160.362628131696 0.294366550754473 1.28 602.045037872082 424.74680256325 177.298235308832 0.294493308898434 1.3 665.341633044361 469.318642506883 196.022990537478 0.29462005803026 1.32 735.295189241973 518.570531064627 216.724658177346 0.294745105568787 1.34 812.605825167543 572.992748719809 239.613076447734 0.294869996038154 1.36 898.047291650417 633.129080808588 264.918210841828 0.294993608137235 1.38 992.474715605025 699.578564881526 292.896150723499 0.295116990003061 1.4 1096.83315842846 773.004793784894 323.828364643565 0.295239400956428 1.42 1212.16707449258 854.139523638505 358.027550854071 0.295361554020055 16 1.44 1339.63076439442 943.792698512595 395.838065881822 0.295482961725474 1.46 1480.49992758455 1042.85806334102 437.641864243521 0.295604110536864 1.48 1636.18442999593 1152.3243111808 483.860118815128 0.295724681120656 1.5 1808.24241445606 1273.28292557718 534.959488878879 0.295845006511364 1.52 1998.39589510412 1406.94089629624 591.454998807881 0.295964878759454 1.54 2208.54799188721 1554.63110483643 653.916887050778 0.296084526780876 1.56 2440.8019776245 1717.82711726352 722.974860360978 0.296203816200039 1.58 2697.48232826851 1898.15652828914 799.325799979374 0.296322905104055 1.6 2981.15798704173 2097.41842292135 883.739564120379 0.296441707538397 1.62 3294.66807528385 2317.60021287341 977.06786241044 0.296560333267036 1.64 3641.15030733236 2560.89846549603 1080.25184183633 0.29667872805497 1.66 4024.07239382231 2829.73990597261 1194.33248784969 0.296796968584167 1.68 4447.26674769986 3126.80644669055 1320.46030100931 0.29691502127509 1.7 4914.96884029913 3455.06119531072 1459.90764498841 0.297032940070391 1.72 5431.85959136298 3817.7786857527 1614.08090561028 0.297150704737799 1.74 6003.11221726102 4218.57693246126 1784.53528479976 0.297268353516465 1.76 6634.44400627789 4661.45407224495 1972.98993403294 0.297385874711729 1.78 7332.173539156 5150.82774691025 2181.34579224574 0.297503295659426 1.8 8103.28392757538 5691.579621627 2411.70430594838 0.297620610051856 1.82 8955.49270348251 6289.10367123565 2666.38903224686 0.297737837607749 1.84 9897.32905874393 6949.36035587413 2947.9687028698 0.297854975354727 1.86 10938.2192081652 7678.93574241048 3259.2834657547 0.297972037653232 1.88 12088.580730217 8485.10750435622 3603.47322586074 0.298089023540489 1.9 13359.9268296619 9375.91724328172 3984.00958638015 0.298205943578583 1.92 14764.9815655773 10360.2509530126 4404.7306125647 0.298322797966358 1.94 16317.8071980154 11447.9274338842 4869.87976413119 0.298439594550637 1.96 18033.9449278285 12649.7964397894 5384.14848803911 0.298556334156856 1.98 19930.5704382303 13977.8467218421 5952.72371638818 0.298673022673241 2 22026.6657948067 15445.3257841578 6581.34001064888 0.298789661220564 Figura 5: Gráfico de comparação com as soluções exatas e aproximadas. d. { y′=y−x2+1. x∈[0,2]. y(0)=0.5 Solução exata: y(x) = (x+ 1)2 − 0.5ex. Começando a aproximar com, h = 0.2. A = 11×5 table 17 1.6 4.28348378780244 4.18928219226802 0.0942015955344262 0.0219918179222885 1.65 4.41901008641008 4.32074630188142 0.0982637845286582 0.0222366056214382 1.7 4.5530263041364 4.45065861697549 0.102367687160913 0.0224834385577594 1.75 4.68519866199714 4.57869154782426 0.106507114172873 0.0227326783465511 1.8 4.81517626779353 4.70450112521548 0.110675142578049 0.0229846502854535 1.85 4.94259023869908 4.82772618147625 0.114864057222835 0.0232396479731381 1.9 5.06705277886037 4.94798749055006 0.119065288310304 0.0234979372638553 1.95 5.18815620970535 5.06488686507756 0.12326934462779 0.0237597596612826 2 5.30547195053467 5.17800620833144 0.127465742203232 0.0240253352372142 T = 41×5 table x Sol Euler Implicito Error Local Erro Relativo ____ _________________ _________________ ___________________ ___________________ 0 0.5 0.5 0 0 0.05 0.576864451811988 0.578815789473684 0.00195133766169631 0.00338266234913065 0.1 0.657414540962176 0.661385041551247 0.00397050058907045 0.00603956916325477 0.15 0.741582878635858 0.747642149001312 0.00605927036545417 0.00817072580828754 0.2 0.829298620919915 0.837518051580329 0.00821943066041397 0.00991130390557796 0.25 0.920487291656129 0.930940054295083 0.0104527626389539 0.0113556838141105 0.3 1.015070596212 1.02783163610009 0.0127610398880891 0.012571578701728 0.35 1.11296622570337 1.12811224852641 0.0151460228230365 0.0136086994135554 0.4 1.21408765117936 1.23169710371201 0.017609452532644 0.0145042678883507 0.45 1.31834390725492 1.3384969512758 0.020153044020883 0.0152866364459075 0.5 1.42563936464994 1.44841784344821 0.0227784787982734 0.01597772856382 0.55 1.5358734910663 1.56136088784022 0.0254873967739175 0.0165947240590907 0.6 1.64894059980475 1.67722198720023 0.0282813873954861 0.0171512469271695 0.65 1.76472958549305 1.79589156547393 0.0311619799808769 0.0176582181412063 0.7 1.88312364626476 1.91725427944624 0.0341306331814784 0.0181244780443268 0.75 2.00399999169366 2.04118871520657 0.0371887235129065 0.0185572473388469 0.8 2.12722953575377 2.16756706863849 0.0403375328847271 0.0189624731166746 0.85 2.252676574037 2.29625480909315 0.0435782350561462 0.0193450917714521 0.9 2.38019844442152 2.42711032536121 0.0469118809396862 0.0197092309885479 0.95 2.50964517034208 2.5599845530118 0.050339382669724 0.0200583665231299 1 2.64085908577048 2.69472058211769 0.0538614963472086 0.0203954450418904 1.05 2.77367444096842 2.83115324433441 0.0574788033659881 0.0207229812255542 1.1 2.90791698802678 2.96910867824674 0.0611916902199598 0.0210431351623564 1.15 3.04340354515512 3.10840387183868 0.065000326683561 0.0213577745176242 1.2 3.17994153863173 3.24884618088282 0.0689046422510904 0.0216685248499062 1.25 3.31732852126908 3.39023282198191 0.072904300712834 0.0219768106310266 1.3 3.45535166619038 3.53235033892833 0.0769986727379526 0.0222838889284013 1.35 3.59378723465151 3.67497404097719 0.0811868063256758 0.0225908772625345 1.4 3.73240001657766 3.81786741155494 0.085467394977274 0.0228987768185794 1.45 3.87094274241559 3.9607814858473 0.0898387434317085 0.02320849193849 1.5 4.00915546483097 4.10345419562874 0.0942987307977701 0.0235208466284173 1.55 4.14676490870463 4.2456096796092 0.0988447709045692 0.0238365986692615 1.6 4.28348378780244 4.38695755748337 0.103473769680924 0.0241564518057879 1.65 4.41901008641008 4.52719216577197 0.10818207936189 0.0244810664032168 1.7 4.5530263041364 4.66599175344417 0.112965449307773 0.0248110688939233 1.75 4.68519866199714 4.80301763520439 0.117818973207259 0.0251470602864548 1.8 4.81517626779353 4.93791330021515 0.122737032421627 0.0254896239713088 1.85 4.94259023869908 5.07030347391069 0.127713235211602 0.0258393330306129 1.9 5.06705277886037 5.1997931304323 0.132740351571935 0.0261967572403676 1.95 5.18815620970535 5.32596645308663 0.137810243381278 0.026562469943268 2 5.30547195053467 5.44838574009119 0.142913789556517 0.0269370549668281 C = 41×5 table x Sol Centrada Error Local Erro Relativo ____ _________________ ________________ ___________________ __________________ 0 0.5 0.5 0 0 0.05 0.576864451811988 0.657 0.0801355481880121 0.138915733039709 20 0.1 0.657414540962176 0.66545 0.00803545903782366 0.0122228191455321 0.15 0.741582878635858 0.822545 0.0809621213641418 0.109174744585624 0.2 0.829298620919915 0.8454545 0.016155879080085 0.019481377000439 0.25 0.920487291656129 1.00309045 0.0826031583438709 0.0897385103440726 0.3 1.015070596212 1.039513545 0.0244429487880016 0.0240800481062271 0.35 1.11296622570337 1.1980418045 0.0850755787966286 0.0764403957926599 0.4 1.21408765117936 1.24706772545 0.0329800742706357 0.0271644919858948 0.45 1.31834390725492 1.406748577045 0.0884046697900847 0.0670573659146063 0.5 1.42563936464994 1.4674925831545 0.0418532185045644 0.029357507615428 0.55 1.5358734910663 1.62849783536045 0.0926243442941477 0.0603072745463182 0.6 1.64894059980475 1.70009236669055 0.0511517668857993 0.0310209881980323 0.65 1.76472958549305 1.8625070720295 0.0977774865364534 0.0554064981627965 0.7 1.88312364626476 1.9440930738935 0.0609694276287334 0.0323767521849498 0.75 2.00399999169366 2.10791637941885 0.103916387725192 0.0518544851077409 0.8 2.12722953575377 2.19863471183538 0.0714051760816146 0.0335672173037559 0.85 2.252676574037 2.36377985060239 0.111103276565388 0.0493205628566024 0.9 2.38019844442152 2.46276269689562 0.0825642524740955 0.034687970100813 0.95 2.50964517034208 2.62905612029195 0.119410949949877 0.0475808099730692 1 2.64085908577048 2.73541830892482 0.0945592231543388 0.0358062358055545 1.05 2.77367444096842 2.90259795118444 0.128923510216018 0.0464811256547488 1.1 2.90791698802678 3.01542810404326 0.107511116016477 0.0369718655859671 1.15 3.04340354515512 3.18314076158876 0.139737216433646 0.045914784010848 1.2 3.17994153863173 3.30149218020214 0.121550641570409 0.0382241749081683 1.25 3.31732852126908 3.46928997960898 0.151961458339896 0.0458083838744321 1.3 3.45535166619038 3.59217117816303 0.136819511972656 0.0395964073096802 1.35 3.59378723465151 3.75950709742528 0.165719862773765 0.0461128753466217 1.4 3.73240001657766 3.88587188790556 0.153471871327899 0.0411188164843653 1.45 3.87094274241559 4.05209428621584 0.181151543800242 0.0467977843782825 1.5 4.00915546483097 4.18083131652715 0.171675851696177 0.0428209514951836 1.55 4.14676490870463 4.34517741786855 0.198412509163921 0.0478475422485191 1.6 4.28348378780244 4.475099058314 0.191615270511557 0.0447335113202007 1.65 4.41901008641008 4.63668732369995 0.217677237289874 0.0492592759539753 1.7 4.5530263041364 4.766517790684 0.213491486547594 0.04689001826184 1.75 4.68519866199714 4.92433910276835 0.239140440771214 0.0510416863880169 1.8 4.81517626779353 5.05270170096083 0.237525433167304 0.0493285022099817 1.85 4.94259023869908 5.20560927286443 0.263019034165348 0.0532148168193234 1.9 5.06705277886037 5.33101262824727 0.263959849386907 0.0520933688490758 1.95 5.18815620970535 5.47771053568916 0.289554325983805 0.055810641445634 2 5.30547195053467 5.59853368181619 0.293061731281514 0.0552376365408887 Figura 7: Gráfico de comparação com as soluções exatas e aproximadas. 21 e. Escolha um PVI que tenha uma solução analı́tica e resolva como nos itens anteriores. Começando a aproximar com os seguintes dados, h = 0.2. { y′=4x3. x∈[0,2]. y(0)=0 Solução exata: y(x) = x4. A = 11×5 table x Sol Euler Explicito Error Local Erro Relativo ___ _______ _______________ ___________ _________________ 0 0 0 0 NaN 0.2 0.0016 0 0.0016 1 0.4 0.0256 0.00032 0.02528 0.9875 0.6 0.1296 0.00544 0.12416 0.958024691358025 0.8 0.4096 0.03136 0.37824 0.9234375 1 1 0.11328 0.88672 0.88672 1.2 2.0736 0.31328 1.76032 0.84891975308642 1.4 3.8416 0.728 3.1136 0.810495626822157 1.6 6.5536 1.49632 5.05728 0.7716796875 1.8 10.4976 2.80704 7.69056 0.732601737540009 2 16 4.90656 11.09344 0.69334 T = 11×5 table x Sol Euler Implicito Error Local Erro Relativo ___ _______ _______________ ___________ _________________ 0 0 0 0 NaN 0.2 0.0016 0.00032 0.00128 0.8 0.4 0.0256 0.00544 0.02016 0.7875 0.6 0.1296 0.03136 0.09824 0.758024691358025 0.8 0.4096 0.11328 0.29632 0.7234375 1 1 0.31328 0.68672 0.68672 1.2 2.0736 0.728 1.3456 0.64891975308642 1.4 3.8416 1.49632 2.34528 0.610495626822157 1.6 6.5536 2.80704 3.74656 0.5716796875 1.8 10.4976 4.90656 5.59104 0.532601737540009 2 16 8.10656 7.89344 0.49334 C = 11×5 table x Sol Centrada Error Local Erro Relativo ___ _______ ________ __________________ __________________ 0 0 0 0 NaN 0.2 0.0016 0.008 0.0064 4 0.4 0.0256 0.0128 0.0128 0.5 0.6 0.1296 0.1104 0.0192000000000001 0.148148148148148 0.8 0.4096 0.3584 0.0512 0.125 1 1 0.9296 0.0703999999999997 0.0703999999999997 1.2 2.0736 1.9584 0.1152 0.0555555555555554 1.4 3.8416 3.6944 0.147199999999999 0.0383173677634316 1.6 6.5536 6.3488 0.204800000000002 0.0312500000000003 1.8 10.4976 10.248 0.249600000000001 0.0237768632830362 2 16 15.68 0.32 0.022 22