more work

This commit is contained in:
mattdesl
2015-06-30 01:08:18 -04:00
parent 26c6f778fe
commit 2332a6f062
6 changed files with 86 additions and 5 deletions

View File

@@ -16,8 +16,8 @@ For a more complete list, refer to [Wikipedia - List of Mathematical Symbols](ht
# contents
- [variable conventions](#variable-conventions)
- [dot & cross `×` `·`](#dot-cross)
- [variable name conventions](#variable-name-conventions)
- [dot & cross `×` `·`](#dot--cross)
- [scalar multiplication](#scalar-multiplication)
- [vector multiplication](#vector-multiplication)
- [dot product](#dot-product)
@@ -29,22 +29,27 @@ For a more complete list, refer to [Wikipedia - List of Mathematical Symbols](ht
- [Euclidean norm](#euclidean-norm)
- [determinant](#determinant)
- [hat **`â`**](#hat) - *unit vector*
- [equals `=` `≈` `≠` `=:`](#equals-symbols)
- [element `∈` `∉`](#element)
- [such that](#such-that)
- [more...](#more)
## variable conventions
## variable naming conventions
There are a variety of conventions depending on the context and field of study, and they are not always consistent. However, in some of the literature you may find variable names to follow a pattern like so:
There are a variety of naming conventions depending on the context and field of study, and they are not always consistent. However, in some of the literature you may find variable names to follow a pattern like so:
- *s* - italic lowercase letters for scalars (i.e. a number)
- **x** - bold lowercase letters for vectors (i.e. a 2D point)
- **A** - bold uppercase letters for matrices (i.e. a 3D transformation)
- *θ* - italic lowercase Greek letters for constants and special variables (i.e. [polar angle *θ*, *theta*](https://en.wikipedia.org/wiki/Spherical_coordinate_system))
This will also be the format of this guide.
## dot & cross
The dot `·` and cross `×` symbols have different uses depending on context.
These might seem obvious, but it's important to understand the subtle differences before we continue into other sections.
They might seem obvious, but it's important to understand the subtle differences before we continue into other sections.
#### scalar multiplication
@@ -371,6 +376,82 @@ Other implementations:
- [gl-vec3/normalize](https://github.com/stackgl/gl-vec3/blob/507480fa57ba7c5fb70679cf531175a52c48cf53/normalize.js) and [gl-vec2/normalize](https://github.com/stackgl/gl-vec2/blob/21f460a371540258521fd2f720d80f14e87bd400/normalize.js)
- [vectors/normalize-nd](https://github.com/hughsk/vectors/blob/master/normalize-nd.js) (n-dimensional)
## equals symbols
There are a number of symbols resembling the equals sign `=`. Here is a few common ones and an example of their use:
- `=` is for equality (values are the same)
- `≠` is for inequality (value are not the same)
- `≈` is for approximately equal to (`π ≈ 3.14159`)
In JavaScript:
```js
// equality
2 === 3
// inequality
2 !== 3
// approximately equal
almostEqual(Math.PI, 3.14159, 1e-5)
function almostEqual(a, b, epsilon) {
return Math.abs(a - b) <= epsilon
}
```
The `:=` `=:` and `=` symbols can be used for *definition*. The following defines *x* to be another name for 2*kj*.
![equals1](img/equals1.png)
<!-- x = 2kj -->
Code:
```js
var x = 2 * k * j
```
<!--
///// Need a code sample?
The `≅` symbol is for [*congruence*](https://en.wikipedia.org/wiki/Congruence_%28geometry%29). For example, here the line segment AB is congruent with the segment CD.
![equals2](img/equals2.png)
\bar{AB} \cong \bar{CD} -->
## element
In set theory, the "element of" symbol `∈` and `∋` can be used to describe whether something is an element of a set. For example:
![element1](img/element1.png)
<!-- A=\left \{3,9,14}{ \right \}, 3 \in A -->
Here we have a set of numbers *A* `[ 3, 9, 14 ]` and we are saying `3` is an "element of" that set. In code:
```js
var A = [ 3, 9, 14 ]
A.indexOf(3) >= 0
//=> true
```
The backwards `∋` is the same, but the order changes:
![element2](img/element2.png)
<!-- A=\left \{3,9,14}{ \right \}, A \ni 3 -->
You can also use the "not an element of" symbols `∉` and `∌` like so:
![element3](img/element3.png)
<!-- A=\left \{3,9,14}{ \right \}, 6 \notin A -->
## more...
Like this guide? Suggest some [more features](https://github.com/Jam3/math-as-code/issues/1) or send us a Pull Request!

BIN
img/element1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

BIN
img/element2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

BIN
img/element3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

BIN
img/equals1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

BIN
img/equals2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B