### 统计代写|数值分析和优化代写numerical analysis and optimazation代考|Forward and Backward Error Analysis

statistics-lab™ 为您的留学生涯保驾护航 在代写数值分析和优化numerical analysis and optimazation方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写数值分析和优化numerical analysis and optimazation方面经验极为丰富，各种代写数值分析和优化numerical analysis and optimazation相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 统计代写|数值分析和优化代写numerical analysis and optimazation代考|Forward and Backward Error Analysis

Forward error analysis examines how perturbations of the input propagate. For example, consider the function $f(x)=x^{2}$. Let $x^{}=x(1+\delta)$ be the representation of $x$, then squaring both sides gives \begin{aligned} \left(x^{}\right)^{2} &=x^{2}(1+\delta)^{2} \ &=x^{2}\left(1+2 \delta+\delta^{2}\right) \ & \approx x^{2}(1+2 \delta) \end{aligned}
because $\delta^{2}$ is small. This means the relative error is approximately doubled. Forward error analysis often leads to pessimistic overestimates of the error, especially when a sequence of calculations is considered and in each calculation the error of the worst case is assumed. When error analyses were first performed, it was feared that the final error could be unacceptable, because of the accumulation of intermediate errors. In practice, however, errors average out. An error in one calculation gets reduced by an error of opposite sign in the next calculation.

Backward error analysis examines the question: How much error in input would be required to explain all output error? It assumes that an approximate

solution to a problem is good if it is the exact solution to a nearby problem. Returning to our example, the output error can be written as
$$[f(x)]^{}=\left(x^{2}\right)^{}=x^{2}(1+\rho),$$
where $\rho$ denotes the relative error in the output such that $\rho \leq u$. As $\rho$ is small, $1+\rho>0$. Thus there exists $\tilde{\rho}$ such that $(1+\tilde{\rho})^{2}=1+\rho$ with $|\tilde{\rho}|<|\rho| \leq u$, since $(1+\tilde{\rho})^{2}=1+2 \tilde{\rho}+\tilde{\rho}^{2}=1+\tilde{\rho}(2+\tilde{\rho})$. We can now write
\begin{aligned} {[f(x)]^{*} } &=x^{2}(1+\tilde{\rho})^{2} \ &=f[x(1+\tilde{\rho})] \end{aligned}
If the backward error is small, we accept the solution, since it is the correct solution to a nearby problem.

Another reason for the preference which is given to backward error analysis is that often the inverse of a calculation can be performed much easier than the calculation itself. Take for example
$$f(x)=\sqrt{x}$$
with the inverse
$$f^{-1}(y)=y^{2}$$

## 统计代写|数值分析和优化代写numerical analysis and optimazation代考|Loss of Significance

Consider
\begin{aligned} x_{1}^{}+x_{2}^{} &=x_{1}\left(1+\delta_{1}\right)+x_{2}\left(1+\delta_{2}\right) \ &=x_{1}+x_{2}+\left(x_{1} \delta_{1}+x_{2} \delta_{2}\right) \ &=x_{1}+x_{2}+\left(\epsilon_{1}+\epsilon_{2}\right) \end{aligned}
Note how the error build-up in addition and subtraction depends on the absolute errors $\epsilon_{1}$ and $\epsilon_{2}$ in representing $x_{1}, x_{2}$, respectively. In the worst case scenario $\epsilon_{1}$ and $\epsilon_{2}$ have the same sign, i.e., the absolute error in $x_{1}^{}+x_{2}^{}$ is no worse than $\left|\epsilon_{1}\right|+\left|\epsilon_{2}\right|$.

Using the fact that $\left(-x_{2}\right) =-x_{2}-\epsilon_{2}$ we get that the absolute error in $x_{1}^{}-x_{2}^{*}$ is also no worse than $\left|\epsilon_{1}\right|+\left|\epsilon_{2}\right|$. However, the relative error is
$$\frac{\left|\epsilon_{1}\right|+\left|\epsilon_{2}\right|}{x_{1}-x_{2}}$$

Suppose we calculate $\sqrt{10}-\pi$ using a computer with precision $p=6$. Then $\sqrt{10} \approx 3.16228$ with absolute error of about $2 \times 10^{-6}$ and $\pi \approx 3.14159$ with absolute error of about $3 \times 10^{-6}$. The absolute error in the result $\sqrt{10}-\pi \approx$ $0.02069$ is about $5 \times 10^{-6}$. However, calculating the relative error, we get approximately
$$5 \times 10^{-6} / 0.02068 \ldots \approx 2 \times 10^{-4} .$$
This means that the relative error in the subtraction is about 100 times as big as the relative error in $\sqrt{10}$ or $\pi$.

This problem is known as loss of significance. It can occur whenever two similar numbers of equal sign are subtracted (or two similar numbers of opposite sign are added). If possible it should be avoided programmatically. We will see an example of how to do so later when discussing robustness.

As another example with the same precision $p=6$, consider the numbers $x_{1}=1.00000$ and $x_{2}=9.99999 \times 10^{-1}$. The true solution of $x_{1}-x_{2}=$ $0.000001$. However, when calculating the difference, the computer first adjusts the magnitude such that both $x_{1}$ and $x_{2}$ have the same magnitude. This way $x_{2}$ becomes $0.99999$. Note that we have lost one digit in $x_{2}$. The computed result is $1.00000-0.99999=0.00001$ and the absolute error is $\mid 0.000001-$ $0.00001 \mid=0.000009$. The relative error is $0.000009 / 0.000001=9$. We see that the relative error has become as large as the base minus one. The following theorem generalizes this for any base.

## 统计代写|数值分析和优化代写numerical analysis and optimazation代考| Robustness

An algorithm is described as robust if for any valid data input which is reasonably representable, it completes successfully. This is often achieved at the expense of time. Robustness is best illustrated by example. We consider the quadratic equation $a x^{2}+b x+c=0$. Solving it seems to be a very elementary problem. Since it is often part of a larger calculation, it is important that it is implemented in a robust way, meaning that it will not fail and give reasonably accurate answers for any coefficients $a, b$ and $c$ which are not too close to overflow or underflow. The standard formula for the two roots is
$$x=\frac{-b \pm \sqrt{b^{2}-4 a c}}{2 a} .$$

A problem arises if $b^{2}$ is much larger than $|4 a c|$. In the worst case the difference in the magnitudes of $b^{2}$ and $|4 a c|$ is so large that $b^{2}-4 a c$ evaluates to $b^{2}$ and the square root evaluates to $b$, and one of the calculated roots lies at zero. Even if the difference in magnitude is not that large, one root is still small. Without loss of generality we assume $b>0$ and the small root is given by
$$x=\frac{-b+\sqrt{b^{2}-4 a c}}{2 a}$$
We note that there is loss of significance in the numerator. As we have seen before, this can lead to a large relative error in the result compared to the relative error in the input. The problem can be averted by manipulating the formula in the following way:
\begin{aligned} x &=\frac{-b+\sqrt{b^{2}-4 a c}}{2 a} \times \frac{-b-\sqrt{b^{2}-4 a c}}{-b-\sqrt{b^{2}-4 a c}} \ &=\frac{b^{2}-\left(b^{2}-4 a c\right)}{2 a\left(-b-\sqrt{b^{2}-4 a c}\right)} \ &=\frac{-2 c}{b+\sqrt{b^{2}-4 a c}} . \end{aligned}
Taking $a=1, b=100000$ and $c=1$ and as accuracy $2 \times 10^{-10}$, Equation (1.3) gives $x=-1.525878906 \times 10^{-5}$ for the smaller root while (1.4) gives $x=-1.000000000 \times 10^{-5}$, which is the best this accuracy allows.

In general, adequate analysis has to be conducted to find cases where numerical difficulties will be encountered, and a robust algorithm must use an appropriate method in each case.

## 统计代写|数值分析和优化代写numerical analysis and optimazation代考|Forward and Backward Error Analysis

[F(X)]=(X2)=X2(1+ρ),

[F(X)]∗=X2(1+ρ~)2 =F[X(1+ρ~)]

F(X)=X

F−1(是)=是2

## 统计代写|数值分析和优化代写numerical analysis and optimazation代考|Loss of Significance

\begin{aligned} x_{1}^{ }+x_{2}^{ } &=x_{1}\left(1+\delta_{1}\right)+x_{2}\left( 1+\delta_{2}\right) \ &=x_{1}+x_{2}+\left(x_{1} \delta_{1}+x_{2} \delta_{2}\right) \ & =x_{1}+x_{2}+\left(\epsilon_{1}+\epsilon_{2}\right) \end{aligned}

|ε1|+|ε2|X1−X2

5×10−6/0.02068…≈2×10−4.

## 统计代写|数值分析和优化代写numerical analysis and optimazation代考| Robustness

X=−b±b2−4一种C2一种.

X=−b+b2−4一种C2一种

X=−b+b2−4一种C2一种×−b−b2−4一种C−b−b2−4一种C =b2−(b2−4一种C)2一种(−b−b2−4一种C) =−2Cb+b2−4一种C.

## 广义线性模型代考

statistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

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