Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. 
Notices 
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto 
Site FAQ 
Sitemap 
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQrelated cookies.

Introduction to Linux  A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free. 


05022005, 12:05 AM

#1

Member
Registered: Aug 2004
Location: Australia
Distribution: Fedora
Posts: 282
Rep:

latex amsmath error
Hi, I have a latex source file as such:
Code:
\title{Lecture 1}
\documentclass[11pt,a4paper]{article}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{amsmath}
\setlength{\topmargin}{0.5in}
\setlength{\headheight}{0.5in}
\setlength{\textheight}{9.0in}
\setlength{\textwidth}{6.5in}
\setlength{\oddsidemargin}{.125in}
\begin{document}
\maketitle
\section{Number Systems}
\begin{enumerate}
\item natural numbers
\begin{equation*}
m = 0, 1, 2, \dots \quad \text{(postive integers)}
\end{equation*}
cannot be used to solve $ x + m = n \quad \text{where} \quad x: \text{unknown}; m,n: \text{natural} $
\item integers
\begin{equation*}
m = \dots, 1, 2, 0, 1, 2, \dots
\end{equation*}
cannot solve $ mx = n $. x may not be an integer.
\item rational number
\begin{equation*}
\frac{m}{n} \quad m,n: \text{integers}
\end{equation*}
cannot solve $ x^{2} = m $ (m: postive integer)
\item real numbers
as points of a line
cannot solve $ x^2 + 1 = 0 $
\item complex numbers
\begin{equation*}
z = x + i y \quad x,y: \, \text{real} \quad i: i^2 = 1
\end{equation*}
Complex numbers can be thought of as vectors.
"length" of vector: $ \lvert z \rvert = \sqrt{x^2 + y^2} \geq 0 $
\end{enumerate}
\section{Algebra of Complex Numbers}
\begin{align}
z_1& = x_1 + i y_1 \\
z_2& = x_2 + i y_2 \\
z& = z_1 + z_2 \\
& = x_1 + i y_1 + x_2 + i y_2
\end{align}
\end{document}
When I run "latex chap1.tex" it produces this error message:
Code:
(/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (./chap1.aux)
Runaway argument?
! Paragraph ended before \align was complete.
<to be read again>
\par
l.62
Have checked documentation which suggests
Explanation: This might be produced by a misspelling in the \end{multline}
command, e.g.,
\begin{multline}
...
\end{multiline}
or by using abbreviations for certain environments, such as \bal and \eal for
\begin{align} and \end{align}:
\bal
...
\eal
But as can be seen in the code above, i did not use multline or \bal...
Any idea/suggestion?



05022005, 03:51 AM

#2

Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep:

You did use multiline  each time you used an environment  note: you error occurs in line 62 of chapter 1 (the 1.62 notice) this is a blank line  remember, in latex a blank line is a new paragraph. You cannot have new paragraphs inside an "align" environment. Remove them and it outputs fine.
You also have too many blank lines in your enumerate environment, it will look odd on the page. There is already half a line at the beginning of the equation environment so you don't need to start a new paragraph for it. Remove them too.
Anyway  this is what you want:
Code:
\section{Algebra of Complex Numbers}
\begin{align}
z_1& = x_1 + i y_1 \\
z_2& = x_2 + i y_2 \\
z& = z_1 + z_2 \\
& = x_1 + i y_1 + x_2 + i y_2
\end{align}


1 members found this post helpful.

05022005, 04:05 AM

#3

Member
Registered: Aug 2004
Location: Australia
Distribution: Fedora
Posts: 282
Original Poster
Rep:

Great! It works now! Thanks a lot! Clear and concise explanation! Never know empty lines are significant btw \begin{align} and \end{align}
Thanks!



05032005, 02:23 AM

#4

Member
Registered: Jan 2005
Distribution: Arch
Posts: 120
Rep:

Another one that I like is the eqnarray command
\begin{eqnarray}
.
.
.
\end{eqnarray}



05032005, 03:44 AM

#5

Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep:

A Better LaTeX Document + a Bonus
I enjoyed the lecture  I figured you'd like to look at this...
[ aside  to the invisible awedience]
For anyone who just searched into this thread looking for LaTeX advice: the code that follows is a LaTeX format article intended as a lecture. Comments through the formatting explains, breifly, some of the conventions that make for good layout.
To use: copy all the enclosed code to a text file and call it "lecture.tex" (or anything you like ending in ".tex"). From terminal, cd into the directory of lecture.tex and type "latex lecture" and watch the writing scroll past. Then type "xdvi lecture" and you'll be able to see what happened. Type "dvips lecture.dvi" to print the lecture on the default printer.
[ aside ends]
Code:
\title{Lecture 1\\ \Huge Introducing Complex Numbers}
\author{Your Name Goes Here}
%\date{} % only uncomment if \date \neq \today
%Some notes on effective use of LaTeX for lecture notes intended for presentation.
\documentclass[11pt,a4paper]{article}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb} % added to give access to special fonts to name the number sets
%\setlength{\topmargin}{0.5in}
%\setlength{\headheight}{0.5in}
%\setlength{\textheight}{9.0in}
%\setlength{\textwidth}{6.5in}
%\setlength{\oddsidemargin}{.125in}
% It is good form to resist the urge to adjust the page parameters. The default set is easier to read, and learn from, though your set uses less paper.
\begin{document}
\maketitle
\section{Number Systems}
Where the main number sets are constructed, their weaknesses expounded, with an aim to motivating the use of the next more general (super) set of numbers.
% using subsections rather than enumerate for structure give greater functionality (see the numbering) and emphasises your main points. It also gives space to expand on your arguments and reduces the chance of errors from restriction in the multiline enumerate... like the number of further enumerations you can do, tabbing, the use of boxes and lengths and so on.
%Numbering your equations right from the beginning allows you to refer to your definitions during the lecture in a consice and direct way. It also allows you to add references later. You either break even or lose by removing them, but you can win by including them  Pascal says: take the bet.
%Watch the carriage returns. Two in a row is a paragraph break  which has special treatment depending on contexts. Some environments do not allow paragraph breaks.
%
\subsection{ Natural Numbers ($\mathbb{N}$)}
\begin{equation}
m \in \{ 0, 1, 2, \cdots \} \quad \text{(postive integers)}
\end{equation}
\hspace{0.33\textwidth} \ldots cannot be used to solve $x + m = n$ where $x,m,n \in \mathbb{N}$ and $x$ is the only unknown.
\subsection{ Integers ($\mathbb{Z}$)}
\begin{equation}
m \in \{ \cdots, 1, 2, 0, 1, 2, \cdots \}
\end{equation}
\hspace{0.33\textwidth}\ldots cannot solve $mx = n:m,n \in \mathbb{Z}$, as x may not be an integer.
%The above line is really a continuation from the equation, this reads more naturally if looks like it starts after the start of the equation. About a third along the page should do the trick.
\subsection{ Rational Numbers ($\mathbb{Q}$)}
\begin{equation}
r=\frac{m}{n}:m,n \in \mathbb{Z}
\end{equation}
\hspace{0.33\textwidth}\ldots cannot solve $ x^{2} = a : a \in \mathbb{N}$ (e.g. $a=2 \Rightarrow x \notin \mathbb{Q}$)
\subsection{ Real Numbers ($\mathbb{R}$)}
\ldots as points of a line \ldots cannot solve $ x^2 + 1 = 0 $
\subsection{ Complex Numbers $\mathbb{C}$}
\begin{equation}
z = x + i y : x,y \in \mathbb{R}, i^2 = 1
\end{equation}
Complex numbers can be thought of as vectors (where ${\bf z} = (x,y)^t$ with a {\em modulus} (length)$: \lvert z \rvert = \sqrt{x^2 + y^2}$\ldots and an {\em argument} (gradient)$: \text{arg}(z) = \arctan{\frac{y}{x}}$.
\section{Algebra of Complex Numbers}
\begin{align}
z_1& = x_1 + i y_1 \\
z_2& = x_2 + i y_2 \\
z& = z_1 + z_2 \\
& = x_1 + i y_1 + x_2 + i y_2
\end{align}
% you'll tie yourself in knots here. Put x,y and complex: x=(a,b) and y=(c,d) then z=x+y = (a+c,b+d) and so on... nice and clear to students  at a glance.
\section{Bonus Puzzle  from Simon Bridge}
What is the cuberoot of minusone?
\subsection{A Solution Path}
Clearly $z=1$ is one root. The fundamental theorum of algebra says there must be two more. The trick is to look for complex roots. This is equivalent to solving the following relation:
\begin{equation}
z^3=1:z \in \mathbb{C}
\end{equation}
If $z=a+ib$ then $z^3$ is given by:
\begin{align}
z^3 &=(a+ib)(a+ib)(a+ib) \\
&= (a^33ab^2)+i(3a^2b b^3)\\
&= c + id
\end{align}
The requirement that $z^3=1$ reduces to $c=1$ simultanious with $d=0$. Here are two equations with two unknowns, for which we must solve for a and b $\in$ $\mathbb{R}$. And this is the approach most students will use. However, there is a geometrical shortcut:
The roots must form an {\em equilateral triangle} in the complex plane. Knowing one root $(1,0)$ gives the other two $( \cos{(\pi/3)}=1/2, \pm \sin{(\pi/3)}=\PM \sqrt{3}/2 )$.
%For bunus marks, compute the solutions via the NewtonRaphson algorithm. Different starting points will converge to different roots. For many starting points in the complex plain, color code according to where they end up (i.e. red for z=(1,0).) Observe. Comment. Investigate. Look for relations between the starting point and which root is the endpoint. Note  a complete map is a fractal(!) A starting point close to one root can converge to a different one in defiance to conventional wisdom about the way the NR algorithm works. This excersize includes complex algebra, representations of complex numbers as vectors and so on. Students will also learn to appreciate the proper use of computers in mathematics.
\end{document}
You missed out irrational numbers but that is really counter to the aim of introducing complex numbers.
I've added a bonus to your notes  a good exercise or maybe assignment/project. The algebra I've done in my head so I may have missed a term here or there. Not intended to be taken verbatim. (This is also wildly off topic  so further discussion should be via email.)
btw: the align environment is better than the eqnarray environment  you'll see why if you format the same equation group using each, on the same page. eqnarray is not good at getting spaces right.
The nature of my replies is because I've got the same job as you, looks like, only I've been doing it longer (I guess).
Last edited by Simon Bridge; 05042005 at 04:05 AM.



05042005, 08:21 PM

#6

Member
Registered: Aug 2004
Location: Australia
Distribution: Fedora
Posts: 282
Original Poster
Rep:

Re: A Better LaTeX Document + a Bonus
Quote:
Originally posted by Simon Bridge
The nature of my replies is because I've got the same job as you, looks like, only I've been doing it longer (I guess).

Hi, Simon,
The British Tory Party's election catchphase, "Are you thinking what we are thinking", just flashed across across my mind. :)
Actually I am just helping someone to get his teaching aid organised. I would guess you are also teaching math in university, right? Math is such a fasincating subject, so I always envious of people who are able to have fun and yet make a living out of math. :)
Thanks again for your help. I really appreciate.



Thread Tools 
Search this Thread 


Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off



All times are GMT 5. The time now is 06:29 PM.

LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.

Latest Threads
LQ News

