Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If possible use matlab for these calculations The aim of this lab is to test the accuracy of several finite difference formulas for computing derivatives

image text in transcribed

If possible use matlab for these calculations

The aim of this lab is to test the accuracy of several finite difference formulas for computing derivatives of functions numerically. Consider the function f(x)= (1+x?)" defined on (-5,5). Choose equally-spaced grid points x:=-5+ih, where i = 0...,n and h=10 with n=11, 21, 51, 101. (1) Numerically approximate f'(x) for i = 1,...n-1 using forward difference, backward difference, central difference approximations. Plot the results on a graph. (2) What is the error between the numerical solution from part (1) and the exact solution? Take the maximum of the absolute value of the errors. Plot the results versus n. How does the error scale with n? Compare the result to the error estimate. Is the actual error about the same size as the error estimate? Explain your answer. (3) Numerically approximate f "(x;)using the central difference formula at the interior grid points i = 1,...n-1. Plot the result on a graph. (4) What is the error between the numerical solution from part (3) and the exact solution? Take the maximum of the absolute value of the errors. Plot the results versus n. How does the error scale with n? Compare the result to the error estimate. Is the actual error about the same size as the error estimate? Explain your answer. (5) Calculate the derivative f'o) using the forward difference formula: f(10-N)-f(0) Dxf(0) - for N - 1, 2, 5, 10, 20, 40 and describe what happens. Justify your observations 10- The aim of this lab is to test the accuracy of several finite difference formulas for computing derivatives of functions numerically. Consider the function f(x)= (1+x?)" defined on (-5,5). Choose equally-spaced grid points x:=-5+ih, where i = 0...,n and h=10 with n=11, 21, 51, 101. (1) Numerically approximate f'(x) for i = 1,...n-1 using forward difference, backward difference, central difference approximations. Plot the results on a graph. (2) What is the error between the numerical solution from part (1) and the exact solution? Take the maximum of the absolute value of the errors. Plot the results versus n. How does the error scale with n? Compare the result to the error estimate. Is the actual error about the same size as the error estimate? Explain your answer. (3) Numerically approximate f "(x;)using the central difference formula at the interior grid points i = 1,...n-1. Plot the result on a graph. (4) What is the error between the numerical solution from part (3) and the exact solution? Take the maximum of the absolute value of the errors. Plot the results versus n. How does the error scale with n? Compare the result to the error estimate. Is the actual error about the same size as the error estimate? Explain your answer. (5) Calculate the derivative f'o) using the forward difference formula: f(10-N)-f(0) Dxf(0) - for N - 1, 2, 5, 10, 20, 40 and describe what happens. Justify your observations 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions