19th Ave New York, NY 95822, USA

# 数学代写|数值分析代写Numerical analysis代考|MAT12004 Approximating the first derivative

my-assignmentexpert™提供最专业的一站式服务：Essay代写，Dissertation代写，Assignment代写，Paper代写，Proposal代写，Proposal代写，Literature Review代写，Online Course，Exam代考等等。my-assignmentexpert™专注为留学生提供Essay代写服务，拥有各个专业的博硕教师团队帮您代写，免费修改及辅导，保证成果完成的效率和质量。同时有多家检测平台帐号，包括Turnitin高级账户，检测论文不会留痕，写好后检测修改，放心可靠，经得起任何考验！

## 数学代写|数值分析代写Numerical analysis代考|Forward and backward differences

Consider a discretization of an interval $[a, b]$ with $N+1$ equally spaced points, call them $x_0, x_1, \ldots, x_N$. Call the point spacing $h$, so that $h=x_{i+1}-x_i$. Suppose we are given function values
$$f\left(x_0\right), f\left(x_1\right), \ldots, f\left(x_N\right),$$
so we know just the points, but not the entire curve, as in the plot in Figure 4.1.
Suppose we want to know $f^{\prime}\left(x_i\right)$ from just this limited information. Recalling the definition of the derivative is
$$f^{\prime}(x)=\lim _{h \rightarrow 0} \frac{f(x+h)-f(x)}{h}$$

a first guess at approximating $f^{\prime}\left(x_i\right)$ is to use one of
2 point forward difference: $f^{\prime}\left(x_i\right) \approx \frac{f\left(x_{i+1}\right)-f\left(x_i\right)}{h}$,
2 point backward difference: $f^{\prime}\left(x_i\right) \approx \frac{f\left(x_i\right)-f\left(x_{i-1}\right)}{h}$.

## 数学代写|数值分析代写Numerical analysis代考|Centered difference

There are (many) more ways to approximate $f^{\prime}\left(x_i\right)$ using finite differences. One thing to notice about the forward and backward differences is that if $f$ has curvature, then, for smaller $h$, it must be true that one of the methods is an overestimate and the other is an underestimate. Then it makes sense that an average of the two methods might produce a better approximation. After averaging, we get a formula that could also arise from using a finite difference of the values at $x_{i-1}$ and $x_{i+1}$ :
$$2 \text { point centered difference: } f^{\prime}\left(x_i\right) \approx \frac{f\left(x_{i+1}\right)-f\left(x_{i-1}\right)}{2 h} \text {. }$$
A graphical illustration is given in Figure 4.3.

Example 24. Using $h=0.1$, approximate $f^{\prime}(1)$ with $f(x)=x^3$ using forward, backward, and centered difference methods. Note that the true solution is $f^{\prime}(1)=3$.
For $h=0.1$, we get the approximations
\begin{aligned} & \mathrm{FD}=\frac{f(1.1)-f(1)}{0.1}=3.31 \quad(\mid \text { error } \mid=0.31), \ & \mathrm{BD}=\frac{f(1)-f(0.9)}{0.1}=2.71 \quad(\mid \text { error } \mid=0.29) \text {, } \ & \end{aligned}

$$\mathrm{CD}=\frac{f(1.1)-f(0.9)}{0.2}=3.01 \quad(\mid \text { error } \mid=0.01) .$$
We see in the example that the centered difference method is more accurate.
As it is dangerous to draw conclusions based on one example, let us look at what some mathematical analysis tells us:
Consider the Taylor series of a function $f$ expanded about $x_i$ :
$$f(x)=f\left(x_i\right)+f^{\prime}\left(x_i\right)\left(x-x_i\right)+\frac{f^{\prime \prime}\left(x_i\right)}{2 !}\left(x-x_i\right)^2+\frac{f^{\prime \prime \prime}\left(x_i\right)}{3 !}\left(x-x_i\right)^3+\cdots .$$

## 数学代写|数值分析代写NUMERICAL ANALYSIS代 考|FORWARD AND BACKWARD DIFFERENCES

$$f\left(x_0\right), f\left(x_1\right), \ldots, f\left(x_N\right),$$

$$f^{\prime}(x)=\lim {h \rightarrow 0} \frac{f(x+h)-f(x)}{h}$$ 对近似值的初步猜测 $f^{\prime}\left(x_i\right)$ 是使用 2 点前差之一: $f^{\prime}\left(x_i\right) \approx \frac{f\left(x{i+1}\right)-f\left(x_i\right)}{h}$,
2点落后差: $f^{\prime}\left(x_i\right) \approx \frac{f\left(x_i\right)-f\left(x_{i-1}\right)}{h}$.

## 数学代写|数值分析代写NUMERICAL ANALYSIS代 考|CENTERED DIFFERENCE

2 point centered difference: $f^{\prime}\left(x_i\right) \approx \frac{f\left(x_{i+1}\right)-f\left(x_{i-1}\right)}{2 h}$.

$$\begin{gathered} \mathrm{FD}=\frac{f(1.1)-f(1)}{0.1}=3.31 \quad(\mid \text { error } \mid=0.31), \quad \mathrm{BD}=\frac{f(1)-f(0.9)}{0.1}=2.71 \quad(\mid \text { error } \mid=0.29), \ \mathrm{CD}=\frac{f(1.1)-f(0.9)}{0.2}=3.01 \quad(\mid \text { error } \mid=0.01) . \end{gathered}$$

$$f(x)=f\left(x_i\right)+f^{\prime}\left(x_i\right)\left(x-x_i\right)+\frac{f^{\prime \prime}\left(x_i\right)}{2 !}\left(x-x_i\right)^2+\frac{f^{\prime \prime \prime}\left(x_i\right)}{3 !}\left(x-x_i\right)^3+\cdots .$$

## Matlab代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。