Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduction: fix typos #126

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ USER root

# prepare dependency

RUN cd /home/opam/opam-repository && git pull --quiet origin master
RUN cd /home/opam/opam-repository \
&& git remote set-url origin https://github.com/ocaml/opam-repository \
&& git pull --quiet origin master
RUN opam install core async lambdasoup re sexp_pretty ppx_jane mdx

# install owl-symbolic
Expand All @@ -27,4 +29,4 @@ RUN opam pin --dev-repo owl-ode --ignore-constraints-on owl,owl-base
WORKDIR /home/opam/book
COPY . ${WORKDIR}

ENTRYPOINT /bin/bash
ENTRYPOINT /bin/bash
30 changes: 15 additions & 15 deletions book/introduction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ There are different ways to interact with Owl, including `utop`, notebook, and t

Scientific Computing is a rapidly evolving multidisciplinary field which uses advanced computing capabilities to understand and solve complex problems.
The algorithms used in scientific computing can be generally divided into two types: numerical analysis, and computer algebra (or symbolic computation).
The former uses numerical approximation to solve mathematical problems, while the latter requires a exact close-form representation of computation and manipulates symbols that are not assigned specific values.
The former uses numerical approximation to solve mathematical problems, while the latter requires an exact close-form representation of computation and manipulates symbols that are not assigned specific values.

Both approaches are widely used in various applications fields, such as engineering, physics, biology, finance, etc.
Even though these advanced applications are sophisticated, they are all built atop of basic numerical operations in a scientific library, most of which Owl has already provided.
Expand Down Expand Up @@ -39,31 +39,31 @@ The point is that how to dissect a complex application into basic building block

Most existing numerical or scientific computing software are based on the imperative programming paradigm, which uses statements that change a program's state.
Imperative programs often work by being built from one or more procedures, or functions. This modular style is widely adopted.
Later around 1980s the idea of object oriented programming is rapidly developed. It extends the modular programming style to include the idea of "object". An object can contains both data and procedure codes.
Later around 1980s the idea of object-oriented programming is rapidly developed. It extends the modular programming style to include the idea of "object". An object can contain both data and procedure codes.
The imperative programming is not widely adopted in numerical computing for no reason. Almost all computers' hardware implementation follows imperative design.
Actually, FORTRAN, the first cross-platform programming language and an imperative language, is still heavily used for numerical and scientific computations in various fields after first being developed at the 1950s.
There is a good chance that, even if you are using modern popular numerical libraries such as SciPy, Julia, or Matlab, they still rely on FORTRAN in the core part somewhere.

As a contrast, the *Functional Programming* seems to born to perform hight-level tasks. When John McCarthy designed LISP, the first functional programming language, he meant to use it in the artificial intelligence field.
As a contrast, the *Functional Programming* seems to born to perform high-level tasks. When John McCarthy designed LISP, the first functional programming language, he meant to use it in the artificial intelligence field.
The S-expression it uses was meant to be an intermediate representation, but later proved to be powerful and expressive enough.
In LISP you can see the clear distinction between functional and imperative programming.
Whereas the later uses a sequence of statements to change the state of the program, the former one builds a program that constructs a tree of expressions by using and composing functions.
Whereas the latter uses a sequence of statements to change the state of the program, the former one builds a program that constructs a tree of expressions by using and composing functions.

The fundamental difference between these two programming paradigms lies the underlying model of computation.
The imperative one is based on the Alan Turing model.
In their book *Alan Turing: His Work and Impact*, S. Barry Cooper and J. Van Leeuwen said that "computability via Turing machines gave rise to imperative programming".
In their book *Alan Turing: His Work and Impact*, S. Barry Cooper and J. Van Leeuwen said that "computability via Turing machines gave rise to imperative programming".
On the other hand, functional programming evolves from the *lambda calculus*, a formal system of computation built from function application.
Lambda Calculus was invented by Alonzo Church in the 1930s, and it was meant to be a formal mathematical logic systems, instead of programming language.
Actually, it was not until the programming language was invented that the relationship between these two is revealed.
Actually, it was not until the programming language was invented that the relationship between these two were revealed.
Turing himself proved that the lambda calculus is Turing complete.
(Fun fact: Turing is the student of Church.)
We can say that the Lambda calculus is the basis of all functional programming languages.

Compared to imperative programming, functional programming features immutable data, first-class functions, and optimisations on tail-recursion.
By using techniques such as higher oder functions, currying, map & reduce etc., functional programming can often achieves parallelisation of threads, lazy evaluation, and determinism of program execution.
By using techniques such as higher order functions, currying, map & reduce etc., functional programming can often achieve parallelisation of threads, lazy evaluation, and determinism of program execution.
But asides from these benefits, we are now talking about numerical computation which requires good performance.
The question is, do we want to use a functional programming language to do scientific computing?
We hope that by presenting Owl, which built on the functional programming language OCaml, we can give you an satisfactory answer.
We hope that by presenting Owl, which built on the functional programming language OCaml, we can give you a satisfactory answer.

## Who Is This Book For

Expand All @@ -89,7 +89,7 @@ The book does not enforce any strict order in reading, you can simply jump to th

## Installation

That being said, there is a long way to go from simple math calculation to those large use cases.
That being said, there is a long way to go from simple maths calculation to those large use cases.
Now let's start from the very first step: installing Owl.
Owl requires OCaml version `>=4.10.0`. Please make sure you have a working OCaml environment before you start installing Owl. You can read the guide on how to [Install OCaml](https://ocaml.org/docs/install.html).

Expand Down Expand Up @@ -129,7 +129,7 @@ There are Owl docker images on various Linux distributions, this can be further

### Option 3: Pin the Dev-Repo

`opam pin` allows you to pin the local code to Owl's development repository on Github. The first command `opam depext` installs all the dependencies Owl needs.
`opam pin` allows you to pin the local code to Owl's development repository on GitHub. The first command `opam depext` installs all the dependencies Owl needs.

```shell

Expand All @@ -141,7 +141,7 @@ There are Owl docker images on various Linux distributions, this can be further

### Option 4: Compile from Source

Compiling directly from the source is an old-school but a recommended option. First, you need to clone the repository.
Compiling directly from the source is an old-school but recommended option. First, you need to clone the repository.

```shell

Expand Down Expand Up @@ -196,7 +196,7 @@ In the following, we will introduce two options to set up an interactive environ

### Using Toplevel

OCaml language has bundled with a simple toplevel, but I recommend *utop* as a more advance replacement. Installing *utop* is straightforward using OPAM, simply run the following command in the system shell.
The OCaml language is bundled with a simple toplevel, but I recommend *utop* as a more advance replacement. Installing *utop* is straightforward using OPAM, simply run the following command in the system shell.


```shell
Expand Down Expand Up @@ -380,7 +380,7 @@ Even though the extra call to `display_file` is not ideal, it is obvious that th

### Using Owl-Jupyter

For the time being, if you want to save that extra line to display a image in Jupyter. There is a convenient module called `owl-jupyter`. Owl-jupyter module overloads the original `Plot.output` function so that a plotted figure can be directly shown on the page.
For the time being, you may want to save that extra line to display an image in Jupyter. There is a convenient module called `owl-jupyter`. Owl-jupyter module overloads the original `Plot.output` function so that a plotted figure can be directly shown on the page.

```txt

Expand Down Expand Up @@ -408,10 +408,10 @@ From the example above, you can see Owl users' experience can be significantly i

## Summary

In this chapter we give an brief introduction to the background of Owl, including scientific computing, functional programming, and target audience, and the layout of this book.
In this chapter we give a brief introduction to the background of Owl, including scientific computing, functional programming, and target audience, and the layout of this book.
Then we start introduces how Owl can be installed and used, as a first step to start this journey.
You can feel free to browse any part of this book as you want.

At this point you have installed a working environment of Owl on your computer, you should feel really proud of yourself.
To be honest, this can be the most challengening part for a new user, even though Owl team has spent tons of time in improving its compilation and intallation.
To be honest, this can be the most challenging part for a new user, even though Owl team has spent tons of time in improving its compilation and installation.
Now, let's roll out and start the exploration of more interesting topics.
Loading