ProgrammingThis 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.

\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...

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}

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 cube-root of minus-one?
\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^3-3ab^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 Newton-Raphson 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 e-mail.)

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; 05-04-2005 at 03:05 AM.

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. :-)

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