# How do I modify an equation with a long numerator and a normal denominator?

I have a long equation from Mathematica with very long numerator and normal elements of denominator.

$$P_1(t)= \frac{\exp \left(-\frac{1}{4} t \left(\sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2}+3 \lambda _{\text{G1}}+3 \mu _{\text{G1}}\right)\right) \left(\lambda _{\text{G1}}^3 \left(\mu _{\text{G1}} \left(2 \exp \left(\frac{1}{4} t \left(\sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2}+3 \lambda _{\text{G1}}+3 \mu _{\text{G1}}\right)\right)-4 e^{\frac{1}{2} t \sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2}}-4\right)-\sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2} \left(e^{\frac{1}{2} t \sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2}}-1\right)\right)-\lambda _{\text{G1}}^2 \mu _{\text{G1}} \left(\mu _{\text{G1}} \left(10 \exp \left(\frac{1}{4} t \left(\sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2}+3 \lambda _{\text{G1}}+3 \mu _{\text{G1}}\right)\right)+11 e^{\frac{1}{2} t \sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2}}+11\right)+3 \sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2} \left(e^{\frac{1}{2} t \sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2}}-1\right)\right)+2 \lambda _{\text{G1}} \mu _{\text{G1}}^2 \left(\mu _{\text{G1}} \left(-5 \exp \left(\frac{1}{4} t \left(\sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2}+3 \lambda _{\text{G1}}+3 \mu _{\text{G1}}\right)\right)+e^{\frac{1}{2} t \sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2}}+1\right)+\sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2} \left(e^{\frac{1}{2} t \sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2}}-1\right)\right)+2 \mu _{\text{G1}}^4 \exp \left(\frac{1}{4} t \left(\sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2}+3 \lambda _{\text{G1}}+3 \mu _{\text{G1}}\right)\right)+\lambda _{\text{G1}}^4 \left(e^{\frac{1}{2} t \sqrt{-6 \lambda _{\text{G1}} \mu _{\text{G1}}+\lambda _{\text{G1}}^2+\mu _{\text{G1}}^2}}+1\right)\right)}{2 \left(-3 \lambda _{\text{G1}}^3 \mu _{\text{G1}}-16 \lambda _{\text{G1}}^2 \mu _{\text{G1}}^2-3 \lambda _{\text{G1}} \mu _{\text{G1}}^3+\lambda _{\text{G1}}^4+\mu _{\text{G1}}^4\right)},$$

-
And what is your question? – Svend Tveskæg May 6 '14 at 15:29
@SvendTveskæg I believe the OP wants the fraction to be rewritten so that it fits in a page. As it is, it has a huge numerator. – azetina May 6 '14 at 15:32
@SvendTveskæg While the body of the question doesn't say so, the title pretty much captures it. I found that it needed to be scaled to 10% of original size to fit in one line. Thus, are there any tools to help breaking it up manually. Of course, the big problem to doing so is that there are many uses of \left(...\right) which pose difficulties to a split. – Steven B. Segletes May 6 '14 at 15:33
Probably one can redefine the numerator as a function of several variables and then use split. Having this done the equation could be represented with a single fraction. – azetina May 6 '14 at 15:37
Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Mike Renfro May 6 '14 at 15:44

A possible solution:

\documentclass{article}

\usepackage[margin = 2.5cm]{geometry}
\usepackage{amsmath}

\newcommand*\Index[1]{#1_{\text{G1}}}
\newcommand*\Expo{e^{\frac{1}{2}tW}}
\newcommand*\spc{\mkern -5mu}

\begin{document}

\noindent Set
\begin{align*}
W
= \sqrt{\Index{\lambda}^{2} + \Index{\mu}^{2} - 6\Index{\lambda}\Index{\mu}}
\end{align*}
and let
\begin{align*}
P_{\text{num}}(t)
&= \exp\spc\left(-\frac{1}{4}t\left(W + 3\Index{\lambda} + 3\Index{\mu}\right)\right)\\
&\hphantom{{}=} \cdot \Biggl[\Index{\lambda}^{3}\biggl(\Index{\mu}\biggl(2\exp\spc\left(\frac{1}{4}t \left(W + 3\Index{\lambda} + 3\Index{\mu}\right)\right) - 4\Expo - 4\biggr) - W\left(\Expo - 1\right)\biggr)\\
&\hphantom{{}= \cdot \Biggl[} - \Index{\lambda}^{2}\Index{\mu}\left(\Index{\mu} \left(10\exp\spc\left(\frac{1}{4}t\left(W + 3\Index{\lambda} + 3\Index{\mu}\right)\right) + 11\Expo + 11\right) + 3W\left(\Expo - 1\right)\right)\\
&\hphantom{{}= \cdot \Biggl[} + 2\Index{\lambda}\Index{\mu}^{2}\left(\Index{\mu} \left(-5\exp\spc\left(\frac{1}{4}t\left(W + 3\Index{\lambda} + 3\Index{\mu}\right)\right) + \Expo + 1\right) + W\left(\Expo - 1\right)\right)\\
&\hphantom{{}= \cdot \Biggl[} + 2\Index{\mu}^{4}\exp\spc\left(\frac{1}{4}t\left(W + 3\Index{\lambda} + 3\Index{\mu}\right)\right) + \Index{\lambda}^{4}\left(\Expo + 1\right)\Biggr]{\mkern -3mu},\\[0.5ex]
P_{\text{denom}}(t)
&= 2{\mkern -3mu}\left(\Index{\lambda}^{4} + \Index{\mu}^{4} - 3\Index{\lambda}^{3}\Index{\mu} - 3\Index{\lambda}\Index{\mu}^{3} - 16\Index{\lambda}^{2}\Index{\mu}^{2}\right){\mkern -3mu}.
\end{align*}
Then
\begin{equation*}
P_{1}(t)
= \frac{P_{\text{num}}(t)}{P_{\text{denom}}(t)}.
\end{equation*}

\end{document}


Update

Here is an improved version:

\documentclass{article}

\usepackage{amsmath}

\newcommand*\Index[1]{#1_{\text{G1}}}

\begin{document}

\noindent Set
\begin{align*}
U
&= \sqrt{\Index{\lambda}^{2} + \Index{\mu}^{2} - 6\Index{\lambda}\Index{\mu}},\\
V
&= \frac{1}{4}t(U + 3\Index{\lambda} + 3\Index{\mu}),\\
W
&= \exp{\mkern -8mu}\left(\frac{1}{2}tU\right){\mkern -5mu},
\end{align*}
and let
\begin{align*}
P_{\text{num}}(t)
&= \exp(-V)\\
&\hphantom{{}=} \cdot \Bigl[\Index{\lambda}^{3}\bigl(2\Index{\mu}(\exp(V) - 2W - 2) - U(W - 1)\bigr)\\
&\hphantom{{}= \cdot \Bigl[} - \Index{\lambda}^{2}\Index{\mu}\bigl(\Index{\mu} (10\exp(V) + 11W + 11) + 3U(W - 1)\bigr)\\
&\hphantom{{}= \cdot \Bigl[} + 2\Index{\lambda}\Index{\mu}^{2}\bigl(\Index{\mu} (-5\exp(V) + W + 1) + U(W - 1)\bigr)\\
&\hphantom{{}= \cdot \Bigl[} + 2\Index{\mu}^{4}\exp(V) + \Index{\lambda}^{4}(W + 1)\Bigr]{\mkern -3mu},\\[0.5ex]
P_{\text{denom}}(t)
&= 2{\mkern -3mu}\left(\Index{\lambda}^{4} + \Index{\mu}^{4} - 3\Index{\lambda}^{3}\Index{\mu} - 3\Index{\lambda}\Index{\mu}^{3} - 16\Index{\lambda}^{2}\Index{\mu}^{2}\right){\mkern -4mu}.
\end{align*}
Then
\begin{equation*}
P_{1}(t)
= \frac{P_{\text{num}}(t)}{P_{\text{denom}}(t)}.
\end{equation*}

\end{document}


Update 2

Yet another version:

\documentclass{article}

\usepackage{amsmath}

\newcommand*\Index[1]{#1_{\text{G1}}}

\begin{document}

\noindent Set
\begin{align*}
U
&= \sqrt{\Index{\lambda}^{2} + \Index{\mu}^{2} - 6\Index{\lambda}\Index{\mu}},\\
V
&= \frac{1}{4}t(U + 3\Index{\lambda} + 3\Index{\mu}),\\
W
&= \exp{\mkern -6.5mu}\left(\tfrac{1}{2}tU\right){\mkern -5mu},\\
X
&= \exp(V),\\
Y
&= U(W - 1),\\
Z
&= W + 1,
\end{align*}
and let
\begin{align*}
P_{\text{num}}(t)
&= \frac{1}{X}{\mkern -2mu}\Bigl[\Index{\lambda}^{3}\bigl(2\Index{\mu}(X - 2Z) - Y\bigr) - \Index{\lambda}^{2}\Index{\mu}\bigl(\Index{\mu} (10X + 11Z) + 3Y\bigr)\\
&\hphantom{{}= \frac{1}{X}{\mkern -2mu}\Bigl[} + 2\Index{\lambda}\Index{\mu}^{2}\bigl(\Index{\mu} (-5X + Z) + Y\bigr) + 2\Index{\mu}^{4}X + \Index{\lambda}^{4}Z\Bigr]{\mkern -2mu},\\[0.5ex]
P_{\text{denom}}(t)
&= 2{\mkern -3mu}\left(\Index{\lambda}^{4} + \Index{\mu}^{4} - 3\Index{\lambda}\Index{\mu}{\mkern -4mu}\left(\Index{\lambda}^{2} + \Index{\mu}^{2}\right){\mkern -4mu} - 16\Index{\lambda}^{2}\Index{\mu}^{2}\right){\mkern -3mu}.
\end{align*}
Then
\begin{equation*}
P_{1}(t)
= \frac{P_{\text{num}}(t)}{P_{\text{denom}}(t)}.
\end{equation*}

\end{document}


I perfer this solution.

-
+1 for the effort in spotting subterms, I started but decided not to bother:-) – David Carlisle May 6 '14 at 16:41

I think there's little to be gained, in terms of communicating with your readers, of just splitting up the very long denominator across a multitude of shorter lines. It may well be preferable to simplify the entire expression by using simpler symbols that occur again and again. In essence, I propose going even further than Svend Tveskæg does. I use B, C, and D below; you can probably come up with more descriptive symbols...

\documentclass{article}
\usepackage{mathtools}
\newcommand\tg{\text{G1}}
\newcommand\ltg{\lambda_{\tg}}
\newcommand\mtg{\mu_{\tg}}
\begin{document}
$$P_1(t)= \frac{A}{E}$$
where
\begin{align*}
A &= \exp \bigl[-\tfrac{1}{4} t (D+3 \ltg+3 \mtg)\bigr]\\
\bigl[\mtg (2 B -4 e^{\frac{1}{2} t D}-4)
-C\bigr]\\