Skip to content

removing principles of code chapter, updating book #250

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

Merged
merged 5 commits into from
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from 3 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
29 changes: 8 additions & 21 deletions SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
# Summary

* [Algorithm Archive](README.md)
* [TODO](TODO.md)
* [Introduction](chapters/introduction/introduction.md)
* [A Personal Note](chapters/introduction/my_introduction_to_hobby_programming.md)
* [How To Contribute](chapters/introduction/how_to_contribute.md)
* [Principles of Code](chapters/principles_of_code/principles_of_code.md)
* [Choosing A Language](chapters/principles_of_code/choosing_a_language/choosing_a_language.md)
* [Compiled Languages](chapters/principles_of_code/choosing_a_language/compiled/compiled.md)
* [Makefiles](chapters/principles_of_code/choosing_a_language/compiled/makefiles.md)
* [FORTRAN](chapters/principles_of_code/choosing_a_language/compiled/FORTRAN.md)
* [Building Blocks](chapters/principles_of_code/building_blocks/building_blocks.md)
* [Variables and Types](chapters/principles_of_code/building_blocks/variables.md)
* [Conditions](chapters/principles_of_code/building_blocks/conditions.md)
* [Loops](chapters/principles_of_code/building_blocks/loops.md)
* [Functions](chapters/principles_of_code/building_blocks/functions.md)
* [Classes](chapters/principles_of_code/building_blocks/classes.md)
* [Stacks and Queues](chapters/principles_of_code/building_blocks/stacks.md)
* [Bit Logic](chapters/principles_of_code/building_blocks/bitlogic.md)
* [Version Control](chapters/principles_of_code/version_control.md)
* [Complexity Notation](chapters/principles_of_code/notation/notation.md)
* [Convolutions](chapters/algorithms/convolutions/convolutions.md)
* [Taylor Series](chapters/general/taylor_series_expansion/taylor_series_expansion.md)
* [Version Control](chapters/introduction/version_control.md)
* [Data Structures](chapters/data_structures/data_structures.md)
* [Stacks and Queues](chapters/data_structures/stacks_and_queues/stacks_and_queues.md)
* [Mathematical Background](chapters/general/mathematical_background/mathematical_background.md)
* [Complexity Notation](chapters/general/notation/notation.md)
* [Bit Logic](chapters/general/bitlogic/bitlogic.md)
* [Convolutions](chapters/algorithms/convolutions/convolutions.md)
* [Taylor Series](chapters/general/taylor_series/taylor_series.md)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file taylor_series.md and the enclosing folder shouldn't exist, since there's already the taylor_series_expansion.md with its enclosing folder.

If this file is an updated version of the taylor_series_expansion.md however, you should delete the old one and rename the taylor_series.md, so it doesn't violate the naming guidelines.

* [Sorting and Searching](chapters/general/sorting_and_searching/sorting_and_searching.md)
* [Bubble Sort](chapters/algorithms/bubble_sort/bubble_sort.md)
* [Bogo Sort](chapters/algorithms/bogo_sort/bogo_sort.md)
* [Tree Traversal](chapters/algorithms/tree_traversal/tree_traversal.md)
* [Euclidean Algorithm](chapters/algorithms/euclidean_algorithm/euclidean_algorithm.md)
* [Multiplication](chapters/general/multiplication/multiplication.md)
* [Monte Carlo](chapters/algorithms/monte_carlo_integration/monte_carlo_integration.md)
* [Matrix Methods](chapters/general/matrix_methods/matrix_methods.md)
* [Gaussian Elimination](chapters/algorithms/gaussian_elimination/gaussian_elimination.md)
Expand All @@ -45,7 +33,6 @@
* [Backward Euler Methods](chapters/algorithms/backward_euler_method/backward_euler_method.md)
* [Physics Solvers](chapters/general/physics_solvers/physics_solvers.md)
* [Verlet Integration](chapters/algorithms/verlet_integration/verlet_integration.md)
* [Barnes-Hut](chapters/algorithms/barnes_hut_algorithm/barnes_hut_algorithm.md)
* [Quantum Systems](chapters/general/quantum_systems/quantum_systems.md)
* [Split-Operator Method](chapters/algorithms/split-operator_method/split-operator_method.md)
* [Data Compression](chapters/general/data_compression/data_compression.md)
Expand Down
29 changes: 0 additions & 29 deletions TODO.md

This file was deleted.

4 changes: 4 additions & 0 deletions chapters/data_structures/data_structures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Data Structures

This is a book about algorithms.
The fundamental building blocks of algorithms are data structures, and thus as more algorithms are added to the Archive, more data structures will be added to this section.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
### Bit Logic
# Bit Logic

We write code in a language that makes a little sense to us, but does not make sense at all to our computer without a compiler to transform the code we write into a language the computer can understand.
In the end, whenever we write code, all of the data structures we write are transformed into binary strings of 1's and 0's to be interpreted by our computer.
That said, it's not always obvious how this happens, so let's start the simple case of integer numbers.

#### Integers
## Integers
For integer numbers, 0 is still 0 and 1 is still 1; however, for 2, we need to use 2 digits because binary only has 0's and 1's. When we get to 4, we'll need 3 digits and when we get to 8, we'll need 4. Ever time we cross a power of 2, we'll need to add a new digit. Here's a table of the first 10 integers in binary:

| Integer Number | Binary Number |
Expand Down Expand Up @@ -45,7 +45,7 @@ Another method is to "roll over" to negative numbers when the bit count gets too

Ultimately, integer numbers are not that difficult to deal with in binary, so let's move onto something more complicated: *floating-point numbers!*

#### Floating-point Numbers
## Floating-point Numbers
Floats are numbers with a decimal point.
9.125 is a float. 9.000 is a float. 9 is an integer.
Here are a few floats and their integer representations:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Mathematical Background

No matter who you ask, programming requires at least a little math.
That said, for most programmers, it doesn't require *too* much.
For the most part, depending on your specialty, you will probably not see too much calculus or differential equations.
Honestly, you could probably get away with what you learned in high school.

However, this is a book about algorithms, and algorithms sometimes require a deeper understanding of mathematics.
This section attemps to provide the mathematical foundations that you will need to understand certain algorithms.
As we add new algorithms and need new mathematical tools, we will add them to this section.

A notable exception to this rule will be in the case of classes of algorithms that require domain-specific knowledge, like quantum simulations or bioinformatics.
In those cases, we will place the mathematical methods in more relevant sections.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions chapters/general/taylor_series/taylor_series.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
NOTE: Incomplete!

# Taylor Series Expansion

I have been formally trained as a physicist. In my mind, there are several mathematical topics that blur the boundary between mathematics and physics. Taylor Series Expansions are one of those topics.

On the one hand, I can see how the expansion could be considered purely mathematical. I mean, here is the definition:
$$
f(x) \simeq \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n
$$

where $$f(x)$$ is some function along real or complex space, $$a$$ is the point that we are expanding from, and $$f^{(n)}(x)$$ denotes the $$n^{\text{th}}$$ derivative of $$f(x)$$.
From this perspective, the expansion just looks like a bunch of derivatives strung together! Where's the physics? Well, let's expand this series for the first few derivatives:

$$
f(x) \simeq f(a) + \frac{df(a)}{dx}(x-a)
+ \frac{1}{2}\frac{d^2f(a)}{dx^2}(x-a)^2
$$

If we substitute the derivatives for their physical quantities with $$f(x) \rightarrow x(t)$$, expanding from 0, and set

$$
\begin{align}
\frac{dx(t)}{dt} &= \text{velocity} = v(t) \\
\frac{d^2x(t)}{dt^2} &= \text{acceleration} = a \\
\end{align}
$$

The Taylor series expansion turns into one of the most common formulas in classical physics, the *kinematic equation*!

$$
x(t) \simeq x_0 + v_0t
+ \frac{1}{2}at^2
$$

Note that here, we assume the acceleration to be constant, but it could technically have higher order terms.

Truth be told, the Taylor Series Expansion can be found in the most unusual places and is used as the foundation of many different algorithms throughout this book. At first, it might not seem obvious why, but we can approximate almost any smooth function with a Taylor Series Expansion, and the more terms we include, the better our approximation becomes! For example, take Figure 1. Any function can be approximated as a sum of all the derivatives for that function. If we evaluate these derivatives at any point, we closely approximate the actual function.

<p>
<img class="center" src="res/function_sum.png" />
</p>

This shows the true power of the Taylor Series Expansion. It allows us to more easily tackle complicated functions by approximating them as functions we can actually use and imagine!

<script>
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
</script>
$$
\newcommand{\d}{\mathrm{d}}
\newcommand{\bff}{\boldsymbol{f}}
\newcommand{\bfg}{\boldsymbol{g}}
\newcommand{\bfp}{\boldsymbol{p}}
\newcommand{\bfq}{\boldsymbol{q}}
\newcommand{\bfx}{\boldsymbol{x}}
\newcommand{\bfu}{\boldsymbol{u}}
\newcommand{\bfv}{\boldsymbol{v}}
\newcommand{\bfA}{\boldsymbol{A}}
\newcommand{\bfB}{\boldsymbol{B}}
\newcommand{\bfC}{\boldsymbol{C}}
\newcommand{\bfM}{\boldsymbol{M}}
\newcommand{\bfJ}{\boldsymbol{J}}
\newcommand{\bfR}{\boldsymbol{R}}
\newcommand{\bfT}{\boldsymbol{T}}
\newcommand{\bfomega}{\boldsymbol{\omega}}
\newcommand{\bftau}{\boldsymbol{\tau}}
$$

2 changes: 1 addition & 1 deletion chapters/introduction/how_to_contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The *Algorithm Archive* is an effort to learn about and teach algorithms as a community.
As such, it requires a certain level of trust between community members.
For the most part, the collaboration can be done via GitHub and gitbook, so it is important to understand the basics of [version control](../principles_of_code/version_control.md).
For the most part, the collaboration can be done via GitHub and gitbook, so it is important to understand the basics of [version control](version_control.md).
Ideally, all code provided by the community will be submitted via pull requests and discussed accordingly; however, I understand that many individuals are new to collaborative projects, so I will allow submissions by other means (comments, tweets, etc...).
As this project grows in size, it will be harder and harder to facilitate these submissions.
In addition, by submitting in any way other than pull requests, I cannot guarantee I will be able to list you as a collaborator (though I will certainly do my best to update the `CONTRIBUTORS.md` file accordingly).
Expand Down

This file was deleted.

26 changes: 0 additions & 26 deletions chapters/principles_of_code/building_blocks/classes.md

This file was deleted.

102 changes: 0 additions & 102 deletions chapters/principles_of_code/building_blocks/conditions.md

This file was deleted.

Loading