Math & ScienceErrors with left aligned equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
0texel
Posts: 4
Joined: Mon Jun 11, 2012 11:13 am

Errors with left aligned equations

Post by 0texel »

Hello
I got few problems with equations.I align it to left side.It works but compiler show me some errors.It's strange because I have in my document some equations with no errors and the errors appears at line63 so i'm confused. \flalign and \align* and \flushleft isn't solve a problem so i decided to ask for a help.

Preamble

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage[leqno,fleqn]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[polish]{babel}
\usepackage[cp1250]{inputenc}
\usepackage{fancyhdr}
\usepackage{enumerate}

Code: Select all

\end{align}\newline
\begin{align}
\sum\limits_{i=0}^{n}f(x_{i})\cdot \int\limits_{a}^{b}L_{i}(x)dx \notag
\end{align}
\newline
\begin{align}
x=a+t\cdot h, \notag
\end{align}
\pagebreak
\begin{align}  %line63
f(x_{i})=f(a+i\cdot h) \notag
\end{align}
\newline
\begin{align}
x_{i}=a+i \cdot h \notag
\end{align}

Code: Select all

! Missing $ inserted.
<inserted text>
$
l.63 \begin{align}
The same things is at 2 other lines.I'm new on LateX so it's hard to me to fix it

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10359
Joined: Mon Mar 10, 2008 9:44 pm

Errors with left aligned equations

Post by Stefan Kottwitz »

Hi,

welcome to the board!

There's no problem with this code, except that it's incomplete. Perhaps post a complete small example (just a few more lines needed), which brings the error when we test it. The code above doesn't.

Further advice:
  • If you don't want numbering, instead of align and \notag use just an align* environment
  • Don't use \newline after a displayed math environment, such as align. They end the line already.
  • The best place to load hyperref is after all other packages have been loaded, since hyperref redefines features of other packages for hyperlinking. Though there are some exceptions. Just in case you would encounter problems with it.
Stefan
LaTeX.org admin
0texel
Posts: 4
Joined: Mon Jun 11, 2012 11:13 am

Errors with left aligned equations

Post by 0texel »

Thanks for help.I will use your advices.Here is all my source code maybe now you will find cause of my problems. When i comment with(%) a \pagebreak above line63 error disappear but that don't satisfied me :P.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[leqno,fleqn]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[polish]{babel}
\usepackage[cp1250]{inputenc}
\usepackage{fancyhdr}
\usepackage{enumerate}
\usepackage[MeX]{polski}
\usepackage{parskip}
\usepackage[a4paper, left=2.0cm, right=2.0cm, top=2.2cm, bottom=2.2cm, headsep=1.2cm]{geometry}
\pagestyle{fancy}
\usepackage{hyperref}
\lhead{Metody Newtona-Cotesa}
\rhead{\today}
\lfoot{http://pl.wikipedia.org/wiki/Metody_Newtona-Cotesa}
\cfoot{}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\author{Ariel Świder}
\title{Metody Newtona-Cotesa}
\date{02 maja 2012}
\begin{document}
\textbf{\huge Metody Newtona-Cotesa}\newline
Z Wikipedii, wolnej encyklopedii\newline
\newline
W analizie numerycznej \textbf{wzory Newtona-Cotesa's} są zbiorem metod numerycznych całkowania, zwanego również \textit{kwadraturą}. Nazwa pochodzi od Isaaca Newtona i Rogera Cotesa.\newline
\newline
Przyjmujemy, że wartość funkcji $f$ jest znana w równo oddalonych punktach $x_{i}$,dla $i=0$,\ldots,$n$.Dla\newline
punktów oddalonych od siebie o inne odległość ma zastosowanie inna klasa wzorów, kwadratura gaussowska.\newline
\newline
Jeżeli $a=x_{0}$<$x_{1}$<$x_{2}$,\ldots$<x_{n-1}$<$x_{n}$=$b$ są \textbf{równo odległymi} węzłami interpolacji funkcji $f(x)$ (\textbf{tj.} $x_{i}$ są elementami dziedziny $f$, dla których znana jest wartość $f(x_{i})=y_{i})$, to całkę:\newline
\begin{align*}
\int\limits_{a}^{b}f(x)dx
\end{align*}
można aproksymować całką:
\begin{align*}
\int\limits_{a}^{b}L_(n)(x)dx
\end{align*}
gdzie $L_{n}dx$ jest wielomianem interpolacyjnym Lagrange'a stopnia co najwyzej $n$, przybliżającym funkcje $f(x)$ w węzłach interpolacyjnych, tj.:
\begin{align*}
L_{n}(x_{0})=y(x_{0}),L_{n}(x_{1})=y(x_{1}),\ldots,L_{n}(x_{n})=y(x_{n})
\end{align*}
Niech $h_{n}=\frac{b-a}{n}$ oznacza długość kroku dzielącą dwa węzły interpolacji.
Wprowadzając zmienną $t$ taką, że $x=a+th$ można zapisać:
\begin{align*}
L_{i}(x)=L_{n}(a+th)=\prod_{j=0\wedge j\neq i}^{n}\frac{t-j}{i-j}=g(t)
\end{align*}
Wtedy:
\begin{align*}
\int\limits_{a}^{b} L_{n}(x)dx=\int\limits_{a}^{b}\sum\limits_{j=0}^{n}f(x_{i})\cdot L_{i}(x)dx=
\end{align*}
\begin{align*}
\sum\limits_{i=0}^{n}f(x_{i})\cdot \int\limits_{a}^{b}L_{i}(x)dx
\end{align*}
\begin{align*}
x=a+t\cdot h, 
\end{align*}
\pagebreak
\begin{align*}
f(x_{i})=f(a+i\cdot h)
\end{align*}
\begin{align*}
x_{i}=a+i \cdot h \notag
\end{align*}
dla $a=x_{0} \hspace{1mm} t=0$ \newline
dla $x_{1} \hspace{1mm} t=1$\newline
\ldots \newline
dla $b=x_{n} \hspace{1mm} t=n$
\newline
\begin{align*}
dx=(x)'=1
\end{align*}
\begin{align*}
dt=(a+t \cdot h)dt=(a+t \cdot h)'=h=dt
\end{align*}
Zmieniając zmienną, oraz granice całkowania otrzymuje się:
\begin{align*}
\int\limits_{a}^{b}L_{i}(x)dx=h \cdot \int\limits_{0}^{n}g(t)dt
\end{align*}
Ostatecznie, wzór Newtona-Cotesa dla $n+1$ równo odległych węzłów przyjmuje postać:
\begin{align*}
\int\limits_{a}^{b}f(x)dx=\int\limits_{a}^{b}L_{n}(x)dx=\sum\limits_{i=0}^{n}f(x_{i}) \cdot\int\limits_{a}^{b}L_{i}(x=a+t \cdot h)dx=\sum\limits_{i=0}^{n}f(x_{i})\cdot h \cdot\int\limits_{0}^{n}\prod_{j=0\wedge j\neq i}^{n}\frac{t-j}{i-j}dt
\end{align*}
Przyjmując za $A_{i}=h \cdot \int_{0}^{n}\prod{j=0\wedge j\neq i}^{n}\frac{t-j}{i-j}dt$(nazywane współczynikami kwadratury Newtona-Cotesa),otrzymuję się:
\begin{align*}
\int\limits_{a}^{b}f(x)\approx\sum\limits_{i=0}^{n}f(x_{i})\cdot A_{i}
\end{align*}
\newline
\begin{align*}
A_{i}=A_{n-i}
\end{align*} 
Dowód:
\begin{align*}
A_{i}=h\cdot\int\limits_{0}^{n}\prod_{j=0\wedge j\neq i}^{n}\frac{t-j}{i-j}dt
\end{align*}
Niech:\linebreak
\begin{align*}
v=n-t 
\end{align*}
Wtedy:\linebreak
\begin{align*}
dt=-dv 
\end{align*}
\begin{align*}
A_{i}=-h\cdot\int\limits_{n}^{0}\prod_{j=0\wedge j\neq i}^{n}\frac{n-v-j}{i-j}dv=
\end{align*}
Odwrocenie granic całkowania:
\pagebreak
\begin{align*}
=h\cdot\int\limits_{0}^{n}\prod_{j=0\wedge j\neq i}^{n}\frac{n-j-v}{(n-j)-(n-i)}dv=
\end{align*}
Niech $(n-j)=v'$.
\begin{align*}
=h\cdot\int\limits_{0}^{n}\prod_{v'=0\wedge j\neq (n-i)}^{n}\frac{v'-v}{v'-(n-i)}dv=
\end{align*}
Po wyciagnieciu (-1) przed iloczyn i mianownik:
\begin{align*} 
=h\cdot\int\limits_{0}^{n}\prod_{v'=0\wedge j\neq (n-i)}^{n}\frac{v-v'}{(n-i)-v'}dv=A_(n-i)
\end{align*}
Definuje sie dwa typy wzorów Newtona-Cotesa:
\begin{align*} 
=h\cdot\int\limits_{0}^{n}\prod_{v'=0\wedge j\neq (n-i)}^{n}\frac{v-v'}{(n-i)-v'}dv=A_(n-i)  
\end{align*}
Definuje się dwa typy wzorów Newtona-Cotesa:
\begin{enumerate}
\item[$\blacksquare$]\textbf{otwarte,}które nie wykorzystują wartości funkcji w skrajnych punktach, oraz
\item[$\blacksquare$]\textbf{zamknięte,}wykorzystujące wszystkie wartości funkcji.
\end{enumerate}
Zamknięty wzór Newtona-Cotesa rzędu n: 
\begin{align*} 
\int\limits_{a}^{b}f(x)dx\approx\sum\limits_{i=0}^{n}w_{i}f(x_{i}) 
\end{align*}
gdzie $x_{i}=h\hspace{1mm}i+x_{0}$,z $h$ (nazywanym \textbf{rozmiarem kroku}) równym ($x_{n}-x_{0}$)$/n$ oraz $w_{i}$ są \textbf{wagami}.Wagi
można wyprowadzić z wielomianów bazowych Lagrange'a.To oznacza, że tylko $x_{i}$ a nie od nie od funkcji $f$.$L_{x}$ wielomianem interpolacjiw postaci Lagrange'a dla punktów ($x_{0},f(x_{0}$),..,($x_{n},f(x_{n},f_(x_{n})$)
\begin{align*}
\int\limits_{a}^{b}f(x)dx\approx\int\limits_{a}^{b}L(x)dx=\int\limits_{a}^{b}\sum\limits_{i=0}^{n}f(x_{i})l_{i}(x)dx\linebreak
=\sum\limits_{i=0}^{n}\int\limits_{x_{i}-1}^{x_{i}}f(x_{i})l_{i}(x)dx=\sum\limits_{i=0}^{n}f(x_{i})\underbrace{\int\limits_{x_{i}-1}^{x_{i}}l_{i}(x)dx}_{w_{i}}
\end{align*}
Otwarty wzór Newtona-Cotesa rzędu n:
\begin{align*}
\int\limits_{a}^{b}f(x)dx\approx\sum\limits_{i=1}^{n-1}w_{i}f(x_{i})
\end{align*}
wagi znajdujemy w sposób analogiczny do powyższego.
\begin{enumerate}
\item[$\blacksquare$]Możemy skontruować wzór Newtona-Cotesa dowolnego rzędu.
\item[$\blacksquare$]Niektóre wzory niskich rzędów mają swoje tradycyjne nazwy.
\item[$\blacksquare$]W poniższej tabeli znajdują się wzory Newtona-Cotesa typu zamknietego.
\item[$\blacksquare$]Notacja $f_{i}$ oznacza $f(x_{i})$
\end{enumerate}
%______________________________________________
%______________________________________________

Wykładnik o kroku $h$ w wyrazie błędu pokazuje szybkość zmniejszania się błedu przybliżenia.Pochodna $f$ w wyrazie błedu pokazuje który wielomian moze być scałkowany dokładnie (tzn. z błedem równym $0$. Zauważ, że pochodna $f$ w wyrazie błędu wzrasta o $2$ dla kazdego innego wzoru.
Liczba $\xi$\hspace{1mm} zwiera się.
w poniższej tabeli znajduja się wzory Newton-Cotesa typu otwartego.
%___________________________________________
%___________________________________________
Zwróc uwagę , że aby wzór dawał dobre przybliżenie, krok $h$ musi być mały, co oznacza, że przedział 
całkowania [a ,b] również musi być mały, co zazwyczaj nie jest spełnione. Z tego powodu dzielimy 
przedział na mniejsze podprzedziały i stosujemy metodę Newtona-Cotesa na każdym z tych 
podprzedziałów a następnie dodając wyniki. Jest to \textit{metoda złożona}. 
\textbf{\Large{Literatura}}\newline
\begin{enumerate}
\item[$\blacksquare$]J. i M. Jankowscy, \textit{Przegląd metod i algorytmów numerycznych.} Warszawa, \hspace{1mm}1981.(See Section 4.5)
\item[$\blacksquare$]M.Abramowitz and I.\hspace{1mm}A.Stegun, eds. \textit{Handbook of Mathematical Functions with Formulas, Graphs,\newline and Mathematical Tables}.New York:Dover,1972.(See Section 25.4)
\item[$\blacksquare$]George E.Forsythe,Micheal A.Malcolm,and Cleve B.Moler.\textit{Computer Methods for Mathematical\newline Computations}. Englewood Cliffs, NJ:Prentice-Hall, 1977(See Section 5.1)
\item[$\blacksquare$]Wiliam H.Press.Brian P.Flannery,Saul A. Teukolsky,William T. Vetterling.\textit{Numerical Recipes} in\newline C.Cambridge, UK:Cambridge University Press, 1988.(See Section 4.1)
\item[$\blacksquare$]Josef Stoer and Roland Burlisch,\textit{Introduction to Numerical Analysis}.New York:Springer-Verlag,\newline 1980.(See Section 3.1)
\end{enumerate}
\textbf{\Large{Przypisy}}\newline
\begin{enumerate}
\item[1.]$\uparrow$  Boole's Rule - from Wolfram Math World (http://mathworld.wolfram.com/BoolesRule.html)
\end{enumerate}
\textbf{\Large{Zobacz też}}\newline
\begin{enumerate}
\item[$\blacksquare$]Analiza numeryczna
\item[$\blacksquare$]Metoda numeryczna
\item[$\blacksquare$]Wzory Newtona-Cotesa\newline(http://hades.ph.tn.tudelft.nl/Internal/PHServices/Documentation/MathWorld/math/math/n/n080.htm)
\end{enumerate}
Źródło ''$http://pl.wikipedia.org/wiki/Metody_Newtona-Cotesa$''\newline
Kategoria: Metody numeryczne
\hrule
\qquad Tę stronę ostatnio zmodyfikowano 11:15, 25 wrz 2010. Tekst udostępniany na licencji Creative\newline \hspace{1mm}Commons: uznanie autorstwa, na tych samych warunkach , z możliwością obowiązywania\newline \hspace{1mm}dodatkowych ograniczeń. 
Zobacz szczegółowe informacje o warunkach korzystania.
\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10359
Joined: Mon Mar 10, 2008 9:44 pm

Errors with left aligned equations

Post by Stefan Kottwitz »

The Problem is here:

Code: Select all

\lfoot{http://pl.wikipedia.org/wiki/Metody_Newtona-Cotesa}
The underscore is for subscripts in math mode. You need to quote it by a backslash:

Code: Select all

\lfoot{http://pl.wikipedia.org/wiki/Metody\_Newtona-Cotesa}
Or use \url:

Code: Select all

\lfoot{\url{http://pl.wikipedia.org/wiki/Metody_Newtona-Cotesa}}
The problem occurs at the page break, because the footer is typeset there.

Stefan
LaTeX.org admin
0texel
Posts: 4
Joined: Mon Jun 11, 2012 11:13 am

Re: Errors with left aligned equations

Post by 0texel »

Thanks for a help.Now everything works fine but last thing i want to change a page numbering of page i have only a page's number but i want "page 1 of x " (where x will be a number of pages in document).How can i do that?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10359
Joined: Mon Mar 10, 2008 9:44 pm

Errors with left aligned equations

Post by Stefan Kottwitz »

Use the lastpage package, such as

Code: Select all

\usepackage{lastpage}
\cfoot{\thepage\ of \pageref{LastPage}}
Stefan
LaTeX.org admin
Post Reply