![如何进行长加法、乘法(普通多项式运算)](https://linux22.com/image/380151/%E5%A6%82%E4%BD%95%E8%BF%9B%E8%A1%8C%E9%95%BF%E5%8A%A0%E6%B3%95%E3%80%81%E4%B9%98%E6%B3%95%EF%BC%88%E6%99%AE%E9%80%9A%E5%A4%9A%E9%A1%B9%E5%BC%8F%E8%BF%90%E7%AE%97%EF%BC%89.png)
答案1
以下是基于 的两种可能的乘法代码array
。第一个代码将变量的幂和符号对齐,第二个代码稍微简单一些,仅将变量的幂对齐:
\documentclass[11pt,a4paper]{article}
\usepackage{fourier}
\usepackage{array, multirow, booktabs}
\begin{document}
\[ \begin{array}{*{12}{@{}>{{}}r<{{}}@{}}}
& & \multirow{2.5}{*}{$ {}\times{} $} & & x^3 & + & x^2 & & & + & 2 \\[1ex]
& & & & & & x^2 & - & x & + & 1 \\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-11}
& & & & x^3 & + & x^2 & & & + & 2 \\
& - & x^4 & - & x^3 & & & - & 2x & & \\
x^5 & + & x^4 & & & + & 2 x^2\\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-11}
x^5 & & & & & + & 3 x^2 & - & 2x & + & 2 \
\end{array}
\hspace{4em}
\begin{array}{*{7}{@{}>{{}}r@{}}}
& \multirow{2.5}{*}{$ {}\times{} $} & x^3 & + x^2 & & + 2 \\[1ex]
& & & x^2 & - x & + 1 \\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-6}
& & x^3 & + x^2 & & + 2 \\
& - x^4 & - x^3 & & - 2x & \\
x^5 & + x^4 & & + 2 x^2\\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-6}
x^5 & & & + 3 x^2 & - 2x & + 2
\end{array} \]
\[ \begin{array}{*{12}{@{}>{{}}r<{{}}@{}}}
& & \multirow{2.5}{*}{$ {}\times{} $} & & x^3 & + & x^2 & & & + & 2 \\[1ex]
& & & & & & x^2 & - & x & + & 1 \\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-11}
& & & & x^3 & + & x^2 & & & + & 2 \\
& - & x^4 & - & x^3 & & & - & 2x & & \\
x^5 & + & x^4 & & & + & 2 x^2\\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-11}
x^5 & & & & & + & 3 x^2 & - & 2x & + & 2 \
\end{array}
\hspace{4em}
\begin{array}{*{7}{@{}>{{}}r@{}}}
& \multirow{2.5}{*}{$ {}\times{} $} & x^3 & + x^2 & & + 2 \\[1ex]
& & & x^2 & - x & + 1 \\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-6}
& & x^3 & + x^2 & & + 2 \\
& - x^4 & - x^3 & & - 2x & \\
x^5 & + x^4 & & + 2 x^2\\
\cmidrule[0.6pt](l{-3pt}r{-3pt}){1-6}
x^5 & & & + 3 x^2 & - 2x & + 2
\end{array} \]
\end{document}