How can I split up a long and complicated equation in LaTeX?

In summary, the conversation discusses methods for splitting up a long and complex equation into several lines when using LaTeX. The first method involves using the align and IEEEeqnarray environments, while the second method involves using variables to simplify the equation. The conversation also mentions using the texlabel package for long expressions.
  • #1
SeM
Hi, how do I split up this horrible equation into several lines?

given in latex code:

\Psi_2= -2.018\,{10}^{-122}\,C_{2}\,{\mathrm{e}}^{-x\,1.014{}{10}^7{}\mathrm{i}}\,\left(1.398\,{10}^{121}\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}-1.398\,{10}^{121}\,x^2\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}+1.398\,{10}^{121}\,x^2-1.436\,{10}^{135}+x^3\,1.396{}{10}^{60}{}\mathrm{i}+x\,2.833{}{10}^{128}{}\mathrm{i}\right)

and shown in latex form:

\begin{equation}
\Psi_2= -2.018\,{10}^{-122}\,C_{2}\,{\mathrm{e}}^{-x\,1.014{}{10}^7{}\mathrm{i}}\,\left(1.398\,{10}^{121}\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}-1.398\,{10}^{121}\,x^2\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}+1.398\,{10}^{121}\,x^2-1.436\,{10}^{135}+x^3\,1.396{}{10}^{60}{}\mathrm{i}+x\,2.833{}{10}^{128}{}\mathrm{i}\right)
\end{equation}

it shows beautifully here, but in my latex document it stretches beyond the right margin of the page, and does not split up no matter what I have tried.
 
Physics news on Phys.org
  • #2
SeM said:
no matter what I have tried.
What have you tried?
 
  • #3
DrClaude said:
What have you tried?

I managed, I used

\begin{equation*}
\begin{split*}
\begin{align*}
& Text to split //
& second part to split //
& and so on //

\end{equation*}
\end{split*}
\end{align*}
 
  • #4
It is strange to see an align within a split. Normally, it should be inside the align. From the AMS math documentation:
Like multiline, the split environment is for single equations that are too long to fit on one line and hence must be split into multiple lines. Unlike multline, however, the split environment provides for alignment among the split lines, using & to mark alignment points. Unlike the other amsmath equation structures, the split environment provides no numbering, because it is intended to be used only inside some other displayed equation structure, usually an equation, align, or gather environment, which provides the numbering.
 
  • #5
DrClaude said:
It is strange to see an align within a split. Normally, it should be inside the align. From the AMS math documentation:
It worked well as given.

Thanks!
 
  • #6
SeM said:
Hi, how do I split up this horrible equation into several lines?

given in latex code:

\Psi_2= -2.018\,{10}^{-122}\,C_{2}\,{\mathrm{e}}^{-x\,1.014{}{10}^7{}\mathrm{i}}\,\left(1.398\,{10}^{121}\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}-1.398\,{10}^{121}\,x^2\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}+1.398\,{10}^{121}\,x^2-1.436\,{10}^{135}+x^3\,1.396{}{10}^{60}{}\mathrm{i}+x\,2.833{}{10}^{128}{}\mathrm{i}\right)

and shown in latex form:

\begin{equation}
\Psi_2= -2.018\,{10}^{-122}\,C_{2}\,{\mathrm{e}}^{-x\,1.014{}{10}^7{}\mathrm{i}}\,\left(1.398\,{10}^{121}\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}-1.398\,{10}^{121}\,x^2\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}+1.398\,{10}^{121}\,x^2-1.436\,{10}^{135}+x^3\,1.396{}{10}^{60}{}\mathrm{i}+x\,2.833{}{10}^{128}{}\mathrm{i}\right)
\end{equation}

it shows beautifully here, but in my latex document it stretches beyond the right margin of the page, and does not split up no matter what I have tried.

Well there are various environments like align and IEEEeqnarray that you could use to produce output like this: $$\begin{align}
\Psi_2 = -2.018 \, {10}^{-122} \, C_{2} \,
{\mathrm{e}}^{-x\,1.014 \cdot {10}^7{}\mathrm{i}}\, \Bigl(
& 1.398 \, {10}^{121} \,
{\mathrm{e}}^{x\,1.014 \cdot {10}^7{}\mathrm{i}} \nonumber \\
&-\> 1.398 \, {10}^{121} \, x^2 \,
{\mathrm{e}}^{x \, 1.014 \cdot {10}^7{}\mathrm{i}} \nonumber \\
&+\> 1.398\,{10}^{121}\,x^2 - 1.436\,{10}^{135} \nonumber \\
&+\> x^3\,1.396{}{10}^{60}{}\mathrm{i}
+ x\,2.833{}{10}^{128}{}\mathrm{i} \Bigr) \,.
\end{align}$$

But why not just use a few variables: $$\Psi_{2} = - \lambda \, C_{2} \,
\mathrm{e}^{-\mathrm{i} \phi x} \, \Bigl(
\alpha \mathrm{e}^{\mathrm{i} \phi x}
- \alpha x^{2} \mathrm{e}^{\mathrm{i} \phi x}
+ \alpha x^{2} - \beta
+ \mathrm{i} \gamma x^{3}
+ \mathrm{i} \delta x \Bigr) \,,$$ where $$\begin{eqnarray}
\lambda &=& 2.018 \cdot 10^{-122} \,, &\qquad&
\phi &=& 1.014 \cdot 10^{7} \,, \\
\alpha &=& 1.398 \cdot 10^{121} \,, &&
\beta &=& 1.436 \cdot 10^{135} \,, \\
\gamma &=& 1.396 \cdot 10^{60} \,, &&
\delta &=& 2.833 \cdot 10^{128} \,.
\end{eqnarray}$$ This makes the structure of the equation so much clearer.

You can produce the second set of equations in a paper with, e.g.,
Code:
\begin{IEEEeqnarray}{rCl+rCl}
  \lambda &=& 2.018 \cdot 10^{-122} \,, &
  \phi &=& 1.014 \cdot 10^{7} \,, \\
  \alpha &=& 1.398 \cdot 10^{121} \,, &
  \beta &=& 1.436 \cdot 10^{135} \,, \\
  \gamma &=& 1.396 \cdot 10^{60} \,, &
  \delta &=& 2.833 \cdot 10^{128} \,.
\end{IEEEeqnarray}
(If you want to use the IEEEeqnarray environment like here then install IEEEtrantools and put \usepackage[retainorgcmds]{IEEEtrantools} in the document preamble.)
 
  • Like
Likes FactChecker
  • #7
wle said:
(If you want to use the IEEEeqnarray environment like here then install IEEEtrantools and put \usepackage[retainorgcmds]{IEEEtrantools} in the document preamble.)
Thanks WLE! I ended up using texlabel because these expressions become too long.
 
Last edited by a moderator:

1. How do I approach splitting up a complicated equation?

First, identify the terms and variables in the equation. Then, use the distributive property or grouping to break the equation into smaller parts. Lastly, solve each part individually and combine the solutions to get the final answer.

2. Is there a specific order I should follow when splitting up an equation?

Yes, it is best to follow the order of operations (PEMDAS) when splitting up an equation. This ensures that the equation is correctly solved and the final answer is accurate.

3. What are some common mistakes to avoid when splitting up an equation?

Some common mistakes include forgetting to distribute negative signs, incorrectly applying the order of operations, and forgetting to include all terms in each part of the equation.

4. Are there any tips for simplifying a complicated equation before splitting it up?

Yes, it can be helpful to combine like terms and simplify fractions before splitting up a complicated equation. This can make the process easier and reduce the chances of making mistakes.

5. Can I use different methods to split up an equation?

Yes, there are multiple methods that can be used to split up an equation, such as factoring, grouping, or using the distributive property. It is important to choose the method that is most efficient and effective for the specific equation.

Similar threads

Replies
3
Views
332
  • Classical Physics
Replies
8
Views
2K
  • Advanced Physics Homework Help
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
275
Replies
2
Views
5K
Replies
5
Views
1K
  • General Math
Replies
8
Views
920
Replies
1
Views
4K
Replies
2
Views
584
Back
Top