如何分解符号计算产生的巨大分数?

如何分解符号计算产生的巨大分数?

我正在尝试使用计算机代数系统来学习一些关于代数表达式的知识,这是它在 LaTex 中给出的结果:

\documentclass{article}
\usepackage{breqn}

\begin{document}

\begin{dmath}
    \frac{e_{0} n_{0} \left(- n_{0} p_{0} + n_{0} r_{0} + n_{0} \left(p_{0} - q_{0}\right) - n_{1} p_{1} + n_{1} r_{1} + n_{1} \left(p_{1} - q_{1}\right) - n_{2} p_{2} + n_{2} r_{2} + n_{2} \left(p_{2} - q_{2}\right)\right) + e_{1} n_{1} \left(- n_{0} p_{0} + n_{0} r_{0} + n_{0} \left(p_{0} - q_{0}\right) - n_{1} p_{1} + n_{1} r_{1} + n_{1} \left(p_{1} - q_{1}\right) - n_{2} p_{2} + n_{2} r_{2} + n_{2} \left(p_{2} - q_{2}\right)\right) - e_{10} \left(\left(- p_{1} + r_{1}\right) \left(n_{0} \left(p_{0} - q_{0}\right) + n_{1} \left(p_{1} - q_{1}\right) + n_{2} \left(p_{2} - q_{2}\right)\right) + \left(p_{1} - q_{1}\right) \left(n_{0} p_{0} - n_{0} r_{0} + n_{1} p_{1} - n_{1} r_{1} + n_{2} p_{2} - n_{2} r_{2}\right)\right) - e_{11} \left(\left(- p_{2} + r_{2}\right) \left(n_{0} \left(p_{0} - q_{0}\right) + n_{1} \left(p_{1} - q_{1}\right) + n_{2} \left(p_{2} - q_{2}\right)\right) + \left(p_{2} - q_{2}\right) \left(n_{0} p_{0} - n_{0} r_{0} + n_{1} p_{1} - n_{1} r_{1} + n_{2} p_{2} - n_{2} r_{2}\right)\right) + e_{2} n_{2} \left(- n_{0} p_{0} + n_{0} r_{0} + n_{0} \left(p_{0} - q_{0}\right) - n_{1} p_{1} + n_{1} r_{1} + n_{1} \left(p_{1} - q_{1}\right) - n_{2} p_{2} + n_{2} r_{2} + n_{2} \left(p_{2} - q_{2}\right)\right) - e_{9} \left(\left(- p_{0} + r_{0}\right) \left(n_{0} \left(p_{0} - q_{0}\right) + n_{1} \left(p_{1} - q_{1}\right) + n_{2} \left(p_{2} - q_{2}\right)\right) + \left(p_{0} - q_{0}\right) \left(n_{0} p_{0} - n_{0} r_{0} + n_{1} p_{1} - n_{1} r_{1} + n_{2} p_{2} - n_{2} r_{2}\right)\right) + \left(e_{3} n_{0} + e_{4} n_{1} + e_{5} n_{2}\right) \left(n_{0} p_{0} - n_{0} r_{0} + n_{1} p_{1} - n_{1} r_{1} + n_{2} p_{2} - n_{2} r_{2}\right) - \left(e_{6} n_{0} + e_{7} n_{1} + e_{8} n_{2}\right) \left(n_{0} \left(p_{0} - q_{0}\right) + n_{1} \left(p_{1} - q_{1}\right) + n_{2} \left(p_{2} - q_{2}\right)\right)}{\left(n_{0} \left(p_{0} - q_{0}\right) + n_{1} \left(p_{1} - q_{1}\right) + n_{2} \left(p_{2} - q_{2}\right)\right)^{2}}
\end{dmath}

\end{document}

这是一个很大的部分,当我尝试将其编译为 PDF 时,它被截断了:

在此处输入图片描述

在 LaTex 中是否有一种自动方法可以将这个分数拆分成多行?如果您查看 LaTex 源代码,就会发现在此类表达式中手动搜索合理的断点并不容易。

编辑:分数如下所示:

在此处输入图片描述

几乎看不出来,但分母只有一个,分子却很大。有没有办法自动将分子写在多行上?

答案1

恐怕不是自动的。首先,不要使用\left\right调整大小指令:它们不仅不能成功地扩大任何括号,它们还会阻止 TeX 在左右对的范围内插入换行符。其次,使用指令\parbox,并在内联数学模式(无\frac术语)在 内\parbox。为什么要使用内联数学模式?因为 TeX 允许内联数学材料换行(只要没有\left-\right干扰)。

要设置分子和分母项的开始和结束,请使用花括号。

(可选)使用方括号 --[和 和]-- 代替“外部”圆括号。

话虽如此,我不确定您的读者应该从以下表达中得到什么——更不用说记住三秒钟以上了……

在此处输入图片描述

\documentclass{article}
\begin{document}

\[ 
\parbox{0.8\textwidth}{$\bigl\{
  e_0 n_0 [- n_0 (p_0 - r_0) + n_0 (p_0 - q_0) 
           - n_1 (p_1 - r_1) + n_1 (p_1 - q_1) 
           - n_2 (p_2 - r_2) + n_2 (p_2 - q_2)] 
+ e_1 n_1 [- n_0 (p_0 - r_0) + n_0 (p_0 - q_0) 
           - n_1 (p_1 - r_1) + n_1 (p_1 - q_1) 
           - n_2 (p_2 - r_2) + n_2 (p_2 - q_2)] 
- e_{10} [(- p_1 + r_1) [n_0 (p_0 - q_0) + n_1 (p_1 - q_1) + n_2 (p_2 - q_2)] 
          + (p_1 - q_1) [n_0 (p_0 - r_0) + n_1 (p_1 - r_1) + n_2 (p_2 - r_2)]] 
- e_{11} [(- p_2 + r_2) [n_0 (p_0 - q_0) + n_1 (p_1 - q_1) + n_2 (p_2 - q_2)] 
          + (p_2 - q_2) [n_0 (p_0 - r_0) + n_1 (p_1 - r_1) + n_2 (p_2 - r_2)]] 
+ e_2 n_2 [- n_0 (p_0 - r_0) + n_0 (p_0 - q_0) 
           - n_1 (p_1 - r_1) + n_1 (p_1 - q_1) 
           - n_2 (p_2 - r_2) + n_2 (p_2 - q_2)] 
- e_9 [(- p_0 + r_0) [n_0 (p_0 - q_0) + n_1 (p_1 - q_1) + n_2 (p_2 - q_2)] 
       + (p_0 - q_0) [n_0 (p_0 - r_0) + n_1 (p_1 - r_1) + n_2 (p_2 - r_2)]] 
+ [e_3 n_0 + e_4 n_1 + e_5 n_2] [n_0 (p_0 - r_0) + n_1 (p_1 - r_1) + n_2 (p_2 - r_2)] 
- [e_6 n_0 + e_7 n_1 + e_8 n_2] [n_0 (p_0 - q_0) + n_1 (p_1 - q_1) + n_2 (p_2 - q_2)]
\bigr\}\big/\bigl\{
n_0 (p_0 - q_0) + n_1 (p_1 - q_1) + n_2 (p_2 - q_2)
\bigr\}^2 $}
\]

\end{document}

答案2

不是自动的。我删除了长表达式周围的\left\right,只保留了差异p i – q i和类似的。

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\begin{gathered}
\frac{
  \;
  \parbox{0.8\displaywidth}{\raggedright\leftskip=1em\hspace{-1em}$
    e_{0} n_{0} (- n_{0} p_{0} + n_{0} r_{0} + n_{0} 
    \left(p_{0} - q_{0}\right) - n_{1} p_{1} + n_{1} r_{1} + n_{1} 
    \left(p_{1} - q_{1}\right) - n_{2} p_{2} + n_{2} r_{2} + n_{2}
    \left(p_{2} - q_{2}\right)) + e_{1} n_{1}
    (- n_{0} p_{0} + n_{0} r_{0} + n_{0} \left(p_{0} - q_{0}\right) 
    - n_{1} p_{1} + n_{1} r_{1} + n_{1} \left(p_{1} - q_{1}\right) - 
    n_{2} p_{2} + n_{2} r_{2} + n_{2} \left(p_{2} - q_{2}\right))
    - e_{10} (\left(- p_{1} + r_{1}\right) 
   (n_{0} \left(p_{0} - q_{0}\right) + n_{1} \left(p_{1} - q_{1}\right) 
   + n_{2} \left(p_{2} - q_{2}\right)) + \left(p_{1} - q_{1}\right)
   (n_{0} p_{0} - n_{0} r_{0} + n_{1} p_{1} - n_{1} r_{1} + 
   n_{2} p_{2} - n_{2} r_{2})) 
   - e_{11} (\left(- p_{2} + r_{2}\right)
   (n_{0} \left(p_{0} - q_{0}\right) + n_{1} \left(p_{1} - q_{1}\right)
   + n_{2} \left(p_{2} - q_{2}\right)) + \left(p_{2} - q_{2}\right) 
   (n_{0} p_{0} - n_{0} r_{0} + n_{1} p_{1} - n_{1} r_{1} + 
   n_{2} p_{2} - n_{2} r_{2})) + e_{2} n_{2} 
   (- n_{0} p_{0} + n_{0} r_{0} + n_{0} \left(p_{0} - q_{0}\right) 
   - n_{1} p_{1} + n_{1} r_{1} + n_{1} \left(p_{1} - q_{1}\right)
   - n_{2} p_{2} + n_{2} r_{2} + n_{2} \left(p_{2} - q_{2}\right))
   - e_{9} (\left(- p_{0} + r_{0}\right)
   (n_{0} \left(p_{0} - q_{0}\right) + n_{1} \left(p_{1} - q_{1}\right)
   + n_{2} \left(p_{2} - q_{2}\right))
   + \left(p_{0} - q_{0}\right) (n_{0} p_{0}
   - n_{0} r_{0} + n_{1} p_{1} - n_{1} r_{1} + n_{2} p_{2}
   - n_{2} r_{2})) + (e_{3} n_{0} + e_{4} n_{1}
   + e_{5} n_{2}) (n_{0} p_{0} - n_{0} r_{0}
   + n_{1} p_{1} - n_{1} r_{1} + n_{2} p_{2} - n_{2} r_{2})
   - (e_{6} n_{0} + e_{7} n_{1} + e_{8} n_{2})
   (n_{0} \left(p_{0} - q_{0}\right) + n_{1}
   \left(p_{1} - q_{1}\right) + n_{2} \left(p_{2} - q_{2}\right))
  $}\;
}{
  (n_{0} (p_{0} - q_{0}) + n_{1} (p_{1} - q_{1}) + n_{2} (p_{2} - q_{2}))^{2}
}
\end{gathered}
\end{equation}

\end{document}

在此处输入图片描述

相关内容