3
\documentclass{article}
\usepackage{setspace} 
\usepackage{amsmath}
\usepackage{amsfonts}

\begin{document
\doublespacing{$f(\chi_0)=\frac{1}{5}[f(0)+f(1)+f(2)+f(3)+f(4)]$\\
$f(\chi_1)=\frac{1}{5}[f(0)+af(1)+a^2f(2)+f(3)+f(4)]$\\
$f(\chi_2)=\frac{1}{5}[f(0)+a^2f(1)+a^4f(2)+f(3)+f(4)]$\\
$f(\chi_3)=\frac{1}{5}[f(0)+a^3f(1)+af(2)+f(3)+f(4)]$\\
$f(\chi_4)=\frac{1}{5}[f(0)+a^4f(1)+a^3f(2)+f(3)+f(4)]$\\}
\smallskip\\
\text{Now we want to calculate $\hat f(a)$ hence:}\\
\begin{align}
\hat f(0)&=f(\chi_0)+f(\chi_1)+f(\chi_2)+f(\chi_3)+f(\chi_4)\\
&=\frac{1}{5}[f(0)+f(1)+f(2)+f(3)+f(4)]+\frac{1}{5}[f(0)+af(1)+a^2f(2)+f(3)+f(4)]+\frac{1}{5}[f(0)+a^2f(1)+a^4f(2)+f(3)+f(4)]+\frac{1}{5}[f(0)+a^3f(1)+af(2)+f(3)+f(4)]+\frac{1}{5}[f(0)+a^4f(1)+a^3f(2)+f(3)+f(4)]
&=f(0)+\frac{f(1)}{5}[1+a+a^2+a^3+a^4]+\frac{f(2)}{5}[1+a+a^2+a^3+a^4]+\frac{f(3)}{5}[1+a+a^2+a^3+a^4]+\frac{f(4)}{5}[1+a+a^2+a^3+a^4]
\end{align}

I tried using this Aligning a set of equations to help me but I cant seem to figure out what's wrong. help would be appreciated.

I forgot to mention I want:

f(\chi_2), f(\chi_3) and f(\chi_4)  

to appear on the next line and also want to remove the equation numbers at the RHS

AboAmmar
  • 46,352
  • 4
  • 58
  • 127
Leo
  • 815
  • 1
    It seems you're trying to use LaTeX as you would use a word processor. That's not the best idea. – egreg Nov 14 '18 at 10:56
  • I just edited in the definitions of f(\chi_0), f(\chi_1) etc in the code in the question above. I want to make it look professional but currently unable to do so, as everything is appearing on 1 line – Leo Nov 14 '18 at 10:56
  • @egreg I understand where you're coming from but I've only been using Latex for a couple of days and I'm still not used to it as I have been using word prior. – Leo Nov 14 '18 at 10:58
  • Hi, always provide a full minimal working example (MWE). So with a document class and \end{document}.There are some parenthesis placed wrongly. For instance, the \begin{document} isn't closed. And one placed after \doublespacing which isn't needed. If I compile the code, the functions are aligned to the left. Maybe you can add \noindent before the equations, if you want to prevent indention to happen on the first one. \begin{align*}, with an asterix, will show the equations without numbers. There is a lot of information available on the web about amsmath to help you with your whishes. – JohnShape Nov 14 '18 at 11:02
  • @JohanFit that was a typo, my bad. I don't understand what you mean by "If I compile the code, the functions are aligned to the left. Maybe you can add \noindent before the equations, if you want to prevent indention to happen on the first one." – Leo Nov 14 '18 at 11:10
  • @Daniel don't worry, indeed I was using documentclass. \documentclass[11pt, a4paper]{article} – Leo Nov 14 '18 at 14:20
  • @A.E Excuse me. – Sebastiano Nov 14 '18 at 17:24
  • @Sebastiano what do you mean? – Leo Nov 15 '18 at 11:24
  • @A.E Excuse me for editing your code. Looks the comment of Daniel. – Sebastiano Nov 15 '18 at 15:38
  • @Sebastiano need not apologise. – Leo Nov 16 '18 at 10:39

1 Answers1

4

Don't try to use LaTeX as if it was a word processor.

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{align*}
f(\chi_0)&=\frac{1}{5}[f(0)+f(1)+f(2)+f(3)+f(4)]\\
f(\chi_1)&=\frac{1}{5}[f(0)+af(1)+a^2f(2)+f(3)+f(4)]\\
f(\chi_2)&=\frac{1}{5}[f(0)+a^2f(1)+a^4f(2)+f(3)+f(4)]\\
f(\chi_3)&=\frac{1}{5}[f(0)+a^3f(1)+af(2)+f(3)+f(4)]\\
f(\chi_4)&=\frac{1}{5}[f(0)+a^4f(1)+a^3f(2)+f(3)+f(4)]
\end{align*}
Now we want to calculate $\hat{f}(a)$:
\begin{align*}
\hat{f}(0)
  &= f(\chi_0)+f(\chi_1)+f(\chi_2)+f(\chi_3)+f(\chi_4)\\
  &= \begin{aligned}[t]
     &\frac{1}{5}[f(0)+f(1)+f(2)+f(3)+f(4)]\\
     &\hphantom{f(0)}+\frac{1}{5}[f(0)+af(1)+a^2f(2)+f(3)+f(4)]\\
     &\hphantom{f(0)}+\frac{1}{5}[f(0)+a^2f(1)+a^4f(2)+f(3)+f(4)]\\
     &\hphantom{f(0)}+\frac{1}{5}[f(0)+a^3f(1)+af(2)+f(3)+f(4)]\\
     &\hphantom{f(0)}+\frac{1}{5}[f(0)+a^4f(1)+a^3f(2)+f(3)+f(4)]
     \end{aligned}
\\
  &=\begin{aligned}[t]
    f(0) &+ \frac{f(1)}{5}[1+a+a^2+a^3+a^4]\\
         &+ \frac{f(2)}{5}[1+a+a^2+a^3+a^4]\\
         &+ \frac{f(3)}{5}[1+a+a^2+a^3+a^4]\\
         &+ \frac{f(4)}{5}[1+a+a^2+a^3+a^4]
    \end{aligned}
\end{align*}

\end{document}

Nesting aligned in align ensures spacing and alignments. The particular case seems to require \hphantom{f(0)} to get alignment of the + signs in the blocks.

enter image description here

A variant with the 1/5 fractions aligned:

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{align*}
f(\chi_0)&=\frac{1}{5}[f(0)+f(1)+f(2)+f(3)+f(4)]\\
f(\chi_1)&=\frac{1}{5}[f(0)+af(1)+a^2f(2)+f(3)+f(4)]\\
f(\chi_2)&=\frac{1}{5}[f(0)+a^2f(1)+a^4f(2)+f(3)+f(4)]\\
f(\chi_3)&=\frac{1}{5}[f(0)+a^3f(1)+af(2)+f(3)+f(4)]\\
f(\chi_4)&=\frac{1}{5}[f(0)+a^4f(1)+a^3f(2)+f(3)+f(4)]
\end{align*}
Now we want to calculate $\hat{f}(a)$:
\begin{align*}
\hat{f}(0)
  &= f(\chi_0)+f(\chi_1)+f(\chi_2)+f(\chi_3)+f(\chi_4)\\
  &\begin{aligned}[t]
   {}={}&\frac{1}{5}[f(0)+f(1)+f(2)+f(3)+f(4)]\\
   {}+{}&\frac{1}{5}[f(0)+af(1)+a^2f(2)+f(3)+f(4)]\\
   {}+{}&\frac{1}{5}[f(0)+a^2f(1)+a^4f(2)+f(3)+f(4)]\\
   {}+{}&\frac{1}{5}[f(0)+a^3f(1)+af(2)+f(3)+f(4)]\\
   {}+{}&\frac{1}{5}[f(0)+a^4f(1)+a^3f(2)+f(3)+f(4)]
   \end{aligned}
\\
  &=\begin{aligned}[t]
    f(0) &+ \frac{f(1)}{5}[1+a+a^2+a^3+a^4]\\
         &+ \frac{f(2)}{5}[1+a+a^2+a^3+a^4]\\
         &+ \frac{f(3)}{5}[1+a+a^2+a^3+a^4]\\
         &+ \frac{f(4)}{5}[1+a+a^2+a^3+a^4]
    \end{aligned}
\end{align*}

\end{document}

enter image description here

egreg
  • 1,121,712
  • thank you, but one small adjustment, where we calculate \hat{f}(0), the part where it says "1/5..." can I make them aligned without the indent on the latter terms? – Leo Nov 14 '18 at 11:16
  • @A.E Added the variant – egreg Nov 14 '18 at 11:27
  • can you do the same with the second part too? much appreciated. – Leo Nov 14 '18 at 11:34
  • no worries, I think I figured it now – Leo Nov 14 '18 at 11:47
  • so this is aligned centrally, If I want to align this to the left how shall I proceed? consider the following example and hopefully you understand: \setlength{\parindent}{0pt} \newcommand{\forceindent}{\leavevmode{\parindent=3em\indent}}Let us also define:\ \smallskip\ \forceindent $\hat f(a) = \sum_{i=0}^{n-1} {f}(\chi_i)\chi_i(a)$\ \smallskip\ \forceindent $f(\chi_i)=\frac{1}{\rule{0pt}{0.65em} |G|}\sum_{b\in G} {f}(b)\chi_i(b)$\ – Leo Nov 14 '18 at 11:53
  • @A.E Forget about left aligning locally. Either all equations are aligned left (option fleqn to the document class) or none. Forget also about \forceindent as soon as possible. – egreg Nov 14 '18 at 12:42