Posted on Categories:Modern Algebra, 数学代写, 现代代数

# 数学代写|现代代数代考Modern Algebra代写|(Non-)Uniqueness of the gcd

## avatest™帮您通过考试

avatest™的各个学科专家已帮了学生顺利通过达上千场考试。我们保证您快速准时完成各时长和类型的考试，包括in class、take home、online、proctor。写手整理各样的资源来或按照您学校的资料教您，创造模拟试题，提供所有的问题例子，以保证您在真实考试中取得的通过率是85%以上。如果您有即将到来的每周、季考、期中或期末考试，我们都能帮助您！

•最快12小时交付

•200+ 英语母语导师

•70分以下全额退款

## 数学代写|现代代数代考Modern Algebra代写|(Non-)Uniqueness of the gcd

The nonuniqueness of the gcd is a harmless nuisance from a mathematical point of view. But in software, we have to implement a function gcd with a unique output. In this section, we discuss one way of achieving this.

Since $\mathbb{Q}$ is a field, every nonzero rational number is a unit in $\mathbb{Q}$, and so $u a \sim a$ in $R=\mathbb{Q}[x]$ for all nonzero $u \in \mathbb{Q}$ and all $a \in R$. If we want to define a single element $\operatorname{gcd}(f, g) \in \mathbb{Q}[x]$, which one should we choose? In other words, how do we choose one representative from among all the multiples of $a$ ? A reasonable choice is the monic polynomial, that is, the one with leading coefficient 1 . Thus if $\operatorname{lc}(a) \in \mathbb{Q} \backslash{0}$ is the leading coefficient of $a \in \mathbb{Q}[x]$, then we take normal $(a)=$ $a / \operatorname{lc}(a)$ as the normal form of $a$. (This has nothing to do with the “normal EEA” on page 51.)

To make this work in an arbitrary Euclidean domain $R$, we assume that we have selected some normal form normal $(a) \in R$ for every $a \in R$ so that $a \sim \operatorname{normal}(a)$. We call the unit $u \in R$ with $a=u \cdot \operatorname{normal}(a)$ the leading unit $l u(a)$ of $a$. Moreover, we set $\operatorname{lu}(0)=1$ and $\operatorname{normal}(0)=0$. The following two properties are required:

• two elements of $R$ have the same normal form if and only if they are associate, – the normal form of a product is equal to the product of the normal forms.

These properties in particular imply that the normal form of any unit is 1 . We say that an element $a$ in normal form, so that $\operatorname{lu}(a)=1$, is normalized.

In our two main applications, integers and univariate polynomials over a field, we have natural normal forms. If $R=\mathbb{Z}, \operatorname{lu}(a)=\operatorname{sign}(a)$ if $a \neq 0$ and $\operatorname{normal}(a)=$ $|a|$ defines a normal form, so that an integer is normalized if and only if it nonnegative. When $R=F[x]$ for a field $F$, then letting $\operatorname{lu}(a)=\operatorname{lc}(a)$ (with the convention that $\operatorname{lu}(0)=1)$ and $\operatorname{normal}(a)=a / \operatorname{lc}(a)$ defines a normal form, and a nonzero polynomial is normalized if and only if it is monic.

## 数学代写|现代代数代考Modern Algebra代写|Modular arithmetic

We start with some applications. The first one is checking programs for correctness. In Part II of this book, we will see extremely fast algorithms for multiplication of large integers. These methods are also considerably more complicated than classical multiplication, and an implementation quite error-prone. So we may want to test correctness on many inputs. We take inputs $a$ and $b$, say positive integers of 10000 words each, and the output $c$ of 20000 words. Can we check that $a \cdot b=c$ without using our own software?

The solution is a modular test. We take a single-precision prime $p$ and check whether $a \cdot b \equiv c \bmod p$ (read ” $a \cdot b$ and $c$ are congruent modulo $p$ “), which means that $a \cdot b-c$ is divisible by $p$, or equivalently, $a \cdot b$ and $c$ have the same remainder on division by $p$. By (1) below, it is sufficient for this purpose to compute the remainders $a^=a$ rem $p, b^=b$ rem $p, c^=c$ rem $p$ and check whether $a^ \cdot b^* \equiv$ $c^* \bmod p$, since $a \cdot b \equiv a^* \cdot b^* \bmod p$. If this fails to hold, then clearly somewhere there is an error. How reliable is this test?

Of course, it can happen that $a b \neq c$ and $a^* b^* \equiv c^* \bmod p$. This happens if and only if $a b-c \neq 0$ is divisible by $p$. If each of our primes is at least $2^{63}$, then the product of $k$ of them at least $2^{63 \cdot k}$. Now $|a b-c|$ is a number with not more than 20000 words, and hence divisible by at most $\log _{2^{63}}\left(2^{64 \cdot 20000}\right) \leq 20318$ different primes. If we have a data base of 40636 single-precision primes and choose $p$ at random from these, then the test will fail to detect a software error with probability at most $1 / 2$ (assuming that the test itself is correctly implemented). There is an abundant supply of primes: over $2 \cdot 10^{17}$ 64-bit primes, and more than $90 \mathrm{mil}$ lion 32-bit primes, by the prime number theorem 18.7 (see also Exercise 18.18).

By standard tricks, such as rerunning the test or choosing a larger data base, this probability can be made arbitrarily small.

The technique can also be used to test equalities like $f \cdot g=h$ for polynomials $f, g, h$, by substituting a random value, or $A \cdot B=C$ for matrices $A, B, C$, by evaluating at a random vector.

# 现代代数代写

## 数学代写|现代代数代考Modern Algebra代写|Modular arithmetic

avatest.org 为您提供可靠及专业的论文代写服务以便帮助您完成您学术上的需求，让您重新掌握您的人生。我们将尽力给您提供完美的论文，并且保证质量以及准时交稿。除了承诺的奉献精神，我们的专业写手、研究人员和校对员都经过非常严格的招聘流程。所有写手都必须证明自己的分析和沟通能力以及英文水平，并通过由我们的资深研究人员和校对员组织的面试。

## MATLAB代写

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