计算物理学 Computational Physics PHYS96010

这是一份 Imperial帝国理工大学 PHYS96010作业代写的成功案例

计算物理学 Computational Physics PHYS96010
问题 1.

Assume now that we will employ two points to represent the function $f$ by way of a straight line between $x$ and $x+h$. illustrates this subdivision.
This means that we could represent the derivative with
$$
f_{2}^{\prime}(x)=\frac{f(x+h)-f(x)}{h}+O(h),
$$
where the suffix 2 refers to the fact that we are using two points to define the derivative and the dominating error goes like $O(h)$. This is the forward derivative formula. Alternatively, we could use the backward derivative formula
$$
f_{2}^{\prime}(x)=\frac{f(x)-f(x-h)}{h}+O(h) .
$$

证明 .

If the second derivative is close to zero, this simple two point formula can be used to approximate the derivative. If we however have a function like $f(x)=a+b x^{2}$, we see that the approximated derivative becomes
$$
f_{2}^{\prime}(x)=2 b x+b h
$$
while the exact answer is $2 b x$. Unless $h$ is made very small, and $b$ is not too large, we could approach the exact answer by choosing smaller and smaller and values for $h$. However, in this case, the subtraction in the numerator, $f(x+h)-f(x)$ can give rise to roundoff errors.

A better approach in case of a quadratic expression for $f(x)$ is to use a 3 -step formula where we evaluate the derivative on both sides of a chosen point $x_{0}$ using the above forward and backward two-step formulae and taking the average afterward. We perform again a Taylor expansion but now around $x_{0} \pm h$, namely



英国论文代写Viking Essay为您提供作业代写代考服务

PHYS96010 COURSE NOTES :

To determine $f_{0}^{\prime}$, we require in the last equation that
$$
\begin{gathered}
a_{-h}+a_{0}+a_{h}=0, \
-a_{-h}+a_{h}=\frac{1}{h},
\end{gathered}
$$
and
$$
a_{-h}+a_{h}=0 .
$$
These equations have the solution
$$
a_{-h}=-a_{h}=-\frac{1}{2 h},
$$
and
$$
a_{0}=0
$$
yielding
$$
\frac{f_{h}-f_{-h}}{2 h}=f_{0}^{\prime}+\sum_{j=1}^{\infty} \frac{f_{0}^{(2 j+1)}}{(2 j+1) !} h^{2 j} .
$$
To determine $f_{0}^{\prime \prime}$, we require in the last equation that
$$
\begin{gathered}
a_{-h}+a_{0}+a_{h}=0, \
-a_{-h}+a_{h}=0,
\end{gathered}
$$








发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注