Skip to content

Commit

Permalink
Updates first few sections of the manual
Browse files Browse the repository at this point in the history
Mainly affects the two sections about primitive numbers and elementary operations.

[x] Adds videos from MIT tutorial to Getting Started
[x] Consolidates and tabulates primitive types, operators and elementary functions rather than having them in list form
[x] Adds sections about overflow behavior of integers and signed zero float values
[x] Expands documentation for eps
[x] Documents `\` and `^` operators
[x] Minor formatting changes and spelling and grammatical corrections.
  • Loading branch information
jiahao committed Apr 18, 2013
1 parent 0f0d337 commit 016823a
Show file tree
Hide file tree
Showing 7 changed files with 376 additions and 205 deletions.
7 changes: 4 additions & 3 deletions doc/manual/complex-and-rational-numbers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Complex Numbers
---------------

The global constant ``im`` is bound to the complex number *i*,
representing one of the square roots of -1. It was deemed harmful to
representing the principal square root of -1. It was deemed harmful to
co-opt the name ``i`` for a global constant, since it is such a popular
index variable name. Since Julia allows numeric literals to be
:ref:`juxtaposed with identifiers as
Expand Down Expand Up @@ -114,7 +114,7 @@ Standard functions to manipulate complex values are provided::
As is common, the absolute value of a complex number is its distance
from zero. The ``abs2`` function gives the square of the absolute value,
and is of particular use for complex numbers, where it avoids taking a
square root. The full gamut of other mathematical functions are also
square root. The full gamut of other :ref:`man-elementary-functions` is also
defined for complex numbers::

julia> sqrt(im)
Expand Down Expand Up @@ -162,7 +162,8 @@ because certain values of ``b`` can yield unexpected results::
1 + 2im

``Inf`` and ``NaN`` propagate through complex numbers in the real
and imaginary parts of a complex number as per IEEE-754 arithmetic::
and imaginary parts of a complex number as described in the
:ref:`man-special-floats` section::

julia> 1 + Inf*im
complex(1.0,Inf)
Expand Down
2 changes: 1 addition & 1 deletion doc/manual/control-flow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ normal end. The ``finally`` keyword solves this problem, by providing
a way to run some code when a given block of code exits, regardless of
how it exits.

For example, here is how we can guarantee that an opened file is closed:
For example, here is how we can guarantee that an opened file is closed::

f = open("file")
try
Expand Down
13 changes: 7 additions & 6 deletions doc/manual/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ to its remaining arguments.

.. _man-return-keyword:

The "return" Keyword
--------------------
The ``return`` Keyword
----------------------

The value returned by a function is the value of the last expression
evaluated, which, by default, is the last expression in the body of the
Expand Down Expand Up @@ -138,7 +138,7 @@ Operators Are Functions
In Julia, most operators are just functions with support for special
syntax. The exceptions are operators with special evaluation semantics
like ``&&`` and ``||``. These operators cannot be functions since
short-circuit evaluation (see :ref:`man-short-circuit-evaluation`) requires that
:ref:`short circuit evaluation <man-short-circuit-evaluation` requires that
their operands are not evaluated before evaluation of the operator.
Accordingly, you can also apply them using parenthesized argument lists,
just as you would any other function::
Expand Down Expand Up @@ -167,16 +167,17 @@ however.
Anonymous Functions
-------------------

Functions in Julia are first-class objects: they can be assigned to
Functions in Julia are `first-class objects
<https://en.wikipedia.org/wiki/First-class_citizen>`_: they can be assigned to
variables, called using the standard function call syntax from the
variable they have been assigned to. They can be used as arguments, and
they can be returned as values. They can also be created anonymously,
without giving them a name::
without being given a name::

julia> x -> x^2 + 2x - 1
#<function>

This creates an unnamed function taking one argument and returning the
This creates an unnamed function taking one argument *x* and returning the
value of the polynomial *x*\ ^2 + 2\ *x* - 1 at that value. The primary
use for anonymous functions is passing them to functions which take
other functions as arguments. A classic example is the ``map`` function,
Expand Down
1 change: 1 addition & 0 deletions doc/manual/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ A few walkthrough-style tutorials are available online:

- `Forio Julia Tutorials <https://forio.com/julia/tutorials-list>`_
- `Tutorial for Homer Reid's numerical analysis class <https://homerreid.ath.cx/teaching/18.330/JuliaProgramming.shtml#SimplePrograms>`_
- `Videos from the Julia tutorial at MIT <https://julialang.org/blog/2013/03/julia-tutorial-MIT/>`_

Noteworthy differences from MATLAB
----------------------------------
Expand Down
Loading

0 comments on commit 016823a

Please sign in to comment.