# How to break this function up between multiple lines?

I need to split the equation

$$f(x)=\bigg(\prod_{i=1}^n((y(\lceil\frac{i-1}{i}\rceil)+1|(\lceil\frac{i-1}{i}\rceil)-1|) 2^{(2(g(x)+(\lceil\frac{i}{3}\rceil)(\lceil\frac{(y)(2^{|y\,\bmod\,3-3|})-1}{9}\, \bmod\,1\rceil)(\lceil\frac{i-1}{i}\rceil)+(\lceil\frac{i+2}{3}\rceil) (|\lceil\frac{(y)(2^{|y\,\bmod\,3-3|})-1}{9}\,\bmod\,1\rceil-1|) (\lceil\frac{i-1}{i}\rceil)+(\lceil\frac{i+1}{3}\rceil) (|\lceil\frac{i-1}{i}\rceil-1|))+|(g(x)\,\bmod\,3)-3|)}-1)/3_i\bigg)(x)$$


between two lines maybe even three. How do I do this is TexMakerX?

-
I would suggest defining functions for the power to condense the expression and then give the expressions on separate lines. – Werner Jun 14 '12 at 3:42
good idea thanks! – Jesse Stern Jun 14 '12 at 3:44
You should avoid using $$. Please see Why is [ … ] preferable to$$?. – Peter Grill Jun 14 '12 at 5:54
@Jesse: I see a few (mathematical) issues in your formula. What is 3_i in the end? In the beginning, do you really want a factor 1 in front of the absolut value? And: what does the (x) in the very end mean? In which sense is that product a function of x? You already have F(x) within the product! – Hendrik Vogt Jun 14 '12 at 18:17

Yikes, that's quite a function- I don't envy you!

I'd try something like

You'll notice that I've used a lot of \left(...\right), and also some \left. and \right. Essentially the main thing is to introduce a local function F

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}
f(x)&=\left(\prod_{i=1}^n\left(\left(y\left(\left\lceil\frac{i-1}{i}\right\rceil\right)+1\left|\left(\left\lceil\frac{i-1}{i}\right\rceil\right)-1\right|\right)2^{F\left(x\right)}-1\right)\frac{1}{3_i}\right)\left(x\right)
\intertext{where}
F(x)&= \left(2\left(g(x)+\left(\left\lceil\frac{i}{3}\right\rceil\right)\right.\right. \cdot  \left(\left\lceil\frac{\left(y\right)\left(2^{|y\,\bmod\,3-3|}\right)-1}{9}\,\bmod\,1\right\rceil\right)\left(\left\lceil\frac{i-1}{i}\right\rceil\right)\\
&\phantom{=}+\left(\left\lceil\frac{i+2}{3}\right\rceil\right)\cdot  \left(\left|\left\lceil\frac{\left(y\right)\left(2^{|y\,\bmod\,3-3|}\right)-1}{9}\,\bmod\,1\right\rceil-1\right|\right)\left(\left\lceil\frac{i-1}{i}\right\rceil\right)\\
&\phantom{=}+\left(\left\lceil\frac{i+1}{3}\right\rceil\right)\cdot  \left.\left(\left|\left\lceil\frac{i-1}{i}\right\rceil-1\right|\right)\right)\\
&\phantom{=}+\left.\vphantom{\frac{1}{2}}|(g(x)\,\bmod\,3)-3|\right)
\end{align*}
\end{document}

-
how would one do this in TexMakerX? TexMakerX still uses eqnarray instead of align =( – Jesse Stern Jun 14 '12 at 11:05
@JesseStern I'd just copy & paste my code. I don't know much about TexMaker, but if it still uses eqnarray then it is pretty out of date. – cmhughes Jun 14 '12 at 16:25
Ahhh it turns out that TexMakerX was turned in to TexStudio and thus stopped receiving updates. I will transfer everything to TexStudio and then everything should work. Thanks again for the help – Jesse Stern Jun 14 '12 at 16:39