所有方程式都适合一行,但第三行(方程式)太长,所以我需要将其分成两行。我试过了,\\
但没有用。这是我的(我在中间添加了更多空间,以便您可以看到第三个方程式):
\begin{eqnarray}
&I&= \displaystyle \int_{x_0=0}^{x_2=2h} \left[ \left(\dfrac{x^2-3hx+2h^2}{2h^2}\right)f(x_0) + \left(\dfrac{4hx-2x^2}{2h^2}\right)f(x_1) + \left(\dfrac{x^2-hx}{2h^2}\right)f(x_2)\right] \ dx \nonumber\\
&=& \dfrac{1}{2h^2}\left[ \left(\dfrac{x^3}{3}-\dfrac{3hx^2}{2}+2h^2x\right)f(x_0) + \left(\dfrac{4hx^2}{2}-\dfrac{2x^3}{3}\right)f(x_1) + \left(\dfrac{x^3}{3}-\dfrac{hx^2}{2}\right)f(x_2)\right]_0^{2h} \nonumber\\
&=& \dfrac{1}{2h^2}\left[ \left(\dfrac{(2h)^3}{3}-\dfrac{3h(2h)^2}{2}+2h^2(2h)\right)f(x_0) + \left(\dfrac{4h(2h)^2}{2}-\dfrac{2(2h)^3}{3}\right)f(x_1) +\left(\dfrac{(2h)^3}{3}-\dfrac{h(2h)^2}{2}\right)f(x_2) + 0\right] \nonumber\\
&=&\dfrac{1}{2h^2}\left[ \left(\dfrac{8h^3}{3}-6h^3+4h^3\right)f(x_0) + \left(8h^3-\dfrac{16h^3}{3}\right)f(x_1) + \left(\dfrac{8h^3}{3}-2h^3\right)f(x_2) \right]\nonumber \\
&=&\dfrac{1}{2h^2}\left[ \left(\dfrac{2h^3}{3}\right)f(x_0) + \left(\dfrac{8h^3}{3}\right)f(x_1) + \left(\dfrac{2h^3}{3}\right)f(x_2) \right] \nonumber\\
&=&\dfrac{1}{2h^2}\cdot \dfrac{2h^3}{3}\left[ f(x_0) + 4f(x_1) + f(x_2) \right] \nonumber\\
&=&\dfrac{h}{3}\left[ f(x_0) + 4f(x_1) + f(x_2) \right] \\
\end{eqnarray}
答案1
永远不要使用eqnarray
。在这种情况下,equation
和split
是最好的。
\documentclass{article}
\usepackage{geometry} % more generous text width
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{split}
I&= \int_{x_0=0}^{x_2=2h} \left[
\left(\frac{x^2-3hx+2h^2}{2h^2}\right)f(x_0)
+ \left(\frac{4hx-2x^2}{2h^2}\right)f(x_1)
+ \left(\frac{x^2-hx}{2h^2}\right)f(x_2)
\right] \, dx
\\[1ex]
&= \frac{1}{2h^2}\left[
\left(\frac{x^3}{3}-\frac{3hx^2}{2}+2h^2x\right)f(x_0)
+ \left(\frac{4hx^2}{2}-\frac{2x^3}{3}\right)f(x_1)
+ \left(\frac{x^3}{3}-\frac{hx^2}{2}\right)f(x_2)
\right]_0^{2h}
\\[1ex]
&= \frac{1}{2h^2}\biggl[
\begin{aligned}[t]
& \left(\frac{(2h)^3}{3}-\frac{3h(2h)^2}{2}+2h^2(2h)\right)f(x_0)
+ \left(\frac{4h(2h)^2}{2}-\frac{2(2h)^3}{3}\right)f(x_1) \\
&+ \left(\frac{(2h)^3}{3}-\frac{h(2h)^2}{2}\right)f(x_2) + 0
\biggr]
\end{aligned}
\\[1ex]
&=\frac{1}{2h^2}\left[
\left(\frac{8h^3}{3}-6h^3+4h^3\right)f(x_0)
+ \left(8h^3-\frac{16h^3}{3}\right)f(x_1)
+ \left(\frac{8h^3}{3}-2h^3\right)f(x_2) \right]
\\[1ex]
&=\frac{1}{2h^2}\left[
\left(\frac{2h^3}{3}\right)f(x_0)
+ \left(\frac{8h^3}{3}\right)f(x_1)
+ \left(\frac{2h^3}{3}\right)f(x_2) \right]
\\[1ex]
&=\frac{1}{2h^2}\cdot \frac{2h^3}{3}\left[ f(x_0) + 4f(x_1) + f(x_2) \right]
\\[1ex]
&=\frac{h}{3}\left[ f(x_0) + 4f(x_1) + f(x_2) \right]
\end{split}
\end{equation}
\end{document}
我也会考虑拆分计算(如果有必要的话,因为它们非常简单):
\documentclass{article}
\usepackage{geometry} % more generous text width
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{split}
I&= \int_{x_0=0}^{x_2=2h} \left[
\left(\frac{x^2-3hx+2h^2}{2h^2}\right)f(x_0)
+ \left(\frac{4hx-2x^2}{2h^2}\right)f(x_1)
+ \left(\frac{x^2-hx}{2h^2}\right)f(x_2)
\right] \, dx
\\
&= \frac{1}{2h^2}\bigl[f(x_0)I_0 + f(x_1)I_1 + f(x_2)I_2\bigr]
\\[2ex]
I_0 &= \left[\frac{x^3}{3}-\frac{3hx^2}{2}+2h^2x\right]_0^{2h}
= \left(\frac{(2h)^3}{3}-\frac{3h(2h)^2}{2}+2h^2(2h)\right) \\
&= \left(\frac{8h^3}{3}-6h^3+4h^3\right)
= \frac{2h^3}{3}
\\[1ex]
I_1 &= \left[\frac{4hx^2}{2}-\frac{2x^3}{3}\right]_0^{2h}
= \left(\frac{4h(2h)^2}{2}-\frac{2(2h)^3}{3}\right) \\
&= \left(8h^3-\frac{16h^3}{3}\right)
= \frac{8h^3}{3}
\\[1ex]
I_2 &= \left[\frac{x^3}{3}-\frac{hx^2}{2}\right]_0^{2h}
= \left(\frac{(2h)^3}{3}-\frac{h(2h)^2}{2}\right) \\
&= \left(\frac{8h^3}{3}-2h^3\right)
= \frac{2h^3}{3}
\\[2ex]
I &= \frac{h}{3}[f(x_0) + 4f(x_1) + f(x_2)]
\end{split}
\end{equation}
\end{document}