From 2332a6f062e2a344082df5263c0f315653e7f17c Mon Sep 17 00:00:00 2001 From: mattdesl Date: Tue, 30 Jun 2015 01:08:18 -0400 Subject: [PATCH] more work --- README.md | 91 ++++++++++++++++++++++++++++++++++++++++++++--- img/element1.png | Bin 0 -> 638 bytes img/element2.png | Bin 0 -> 625 bytes img/element3.png | Bin 0 -> 734 bytes img/equals1.png | Bin 0 -> 301 bytes img/equals2.png | Bin 0 -> 405 bytes 6 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 img/element1.png create mode 100644 img/element2.png create mode 100644 img/element3.png create mode 100644 img/equals1.png create mode 100644 img/equals2.png diff --git a/README.md b/README.md index 9d6f4f2..657d6dd 100644 --- a/README.md +++ b/README.md @@ -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) + + + +Code: + +```js +var x = 2 * k * j +``` + + + +## 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) + + + +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) + + + +You can also use the "not an element of" symbols `∉` and `∌` like so: + +![element3](img/element3.png) + + + ## more... Like this guide? Suggest some [more features](https://github.com/Jam3/math-as-code/issues/1) or send us a Pull Request! diff --git a/img/element1.png b/img/element1.png new file mode 100644 index 0000000000000000000000000000000000000000..139599fb1f304a0e840bf2d1e568600a4fae00fe GIT binary patch literal 638 zcmV-^0)hQUNk%w1VWR*O0OJ4v|Ns90003rYX1cn%n3$M|h=?L0BFxOp+}zwmL`15p zst^zmc6N5|?(S4nR5CI$A^8LW00000EC2ui0HXjC000F35XecZz4#8Mvi~4>Fhgjb zXsTv{v%V`Mz;rDMrELXAMGyrC0i<9Q1U*nAk+h5|jX(qS3l4P`oM#ZYVkJ=og>j8~ zFNDOzAkHAjftlP0$;^Y<_0Vp5~ zLkkB86DDMk0bzy%3w}94^hQcNS_9hDqYz{TM2Y?q-mDNv&;kMh3{oZtz-Pb%ZWbIA zbVESFfC4NpT5<;y0D}htPsr3@0F=>E%uuS#Ng*hgYdSVcaL|MSybzh9Nhp$%fq@4M zeq}R3b%Ir>08XlKdUb1s1NX8hoa=xghA8Wr33R|ToE!rnFUX^i0A^eedMEJ3&<{mW z0C1ZO_!H%^4P*??HCP}DfxZd}t{j=*c^`$r6AD*DoA&b<&73hDSQKJ%wGN&GJXoiI zuK}c&+s-rMKp@;d2MQF(GvPQCWxB&sxD{Z507J-{@2Rjnh~=gU6tE`EclU(e0e+|Y zkln-g4DVC4KTo3pflQx(uMa*xoMRpHxh=KdfHoZV!2qUhk>D;CX|N!H5SqXMZ6Czv YUsM#L6XAv)k-#Ae8(8?^2N3`OJJuue^8f$< literal 0 HcmV?d00001 diff --git a/img/element2.png b/img/element2.png new file mode 100644 index 0000000000000000000000000000000000000000..f1db1e1ade603598438f3bef5c2bdb5b234ae6e6 GIT binary patch literal 625 zcmV-%0*?JhNk%w1VWa>P0OJ4v|Ns90003rYX1cn%n3$M|h=?L0BFxOp+}zwmL`15p zst^zmc6N5|?(S4nR5CI$A^8LW00000EC2ui0HgpD000F35XecZz4#8Mvi~4>Fhgjb zXsUXGv%V`Mz;rzcrELXAMGyrC0i<9Q1U*nAk+h5|jXt1zg#84U~$Q%bHC2V$M70EHF|q?@q- zfV5CUxvi`y#{kJD2Z|rg7>xo3%CN%}3N7gv23`V|Akh+<*A+Z34AVb0o2NpEBaNy7zDf4O#XmgK3kQM%+3Zg*Zi=xB|BpIko5Ma=N2PG>w zFzAMWf&m3uW+VhJCW8n6K%`u$(*h??NS`^RDd8WNY&JSdaL|N-ybzWTXcY) zC_!y71HfQdg9Vxp2o$X4$OO&pD9{t^Yx3vK6dbpTJT9gq%a{RZ4)7qI0=)(_SutI} zh=WjW^&BYB`%G{s&S-c+O=}!Y z;GjU^@HNm6JW(En{QB_oqd@#&KxhyCogjyi2LI`2APT{lfL{d*n$QAy2S)h92!To1 L9|soF5CH%?u-N!m literal 0 HcmV?d00001 diff --git a/img/element3.png b/img/element3.png new file mode 100644 index 0000000000000000000000000000000000000000..6d846e0865c424e14605cc2c9ad2552c1b89e688 GIT binary patch literal 734 zcmZ?wbhEHbT+ATM(89p*|Nnmm28Oh>v|YP)&6qKxqoYGfN$Jd)Gk5OXadB~3wQ7}s zfIwMU*}He|LPA1}jEsbYgv7+etgNi^^75*xs(^a&1I3>#j35;{AOd731M5Epg}#)` zc`qytyk6}ys4;NPxnHqvdDG_q)@=+kJ`4Ib-TEkEF@>Y0shJ_zfQw0e&BP0{(w4d{ zm>4Xw=$?2}qxUX0##cr%4ihAbHp;kq^zf8vX0tGQsj)e$BsH2bu`2Po8SwNN6jZCX z^cQ!PsxZ|laZmEmRdOEd6oED!OzO+1Pb##$faHn&_ zrzwq$*_jdxPIvO_IyZMpwfI~VTpugsnAsO_a#JdoA;;B+#R29E6q#quG*OYlVF zg@S}^I}IIh1Og=(S`xTC@FWw%gTfeifV~#NxYWV-GP@pb~JMq3fxu?C(Uh@aqd~Uh4B&3l0Me#t{HJZ8d1` literal 0 HcmV?d00001 diff --git a/img/equals2.png b/img/equals2.png new file mode 100644 index 0000000000000000000000000000000000000000..6120f8bdcd01a02f32a38003ca3f9c0117794b9a GIT binary patch literal 405 zcmV;G0c!q7Nk%w1VNw7O0OJ4v|Ns90005Ynn09t{s;a7HW@fs&x`>E~A|fKp%*@=} z+(bk~5D*aV?(S4nR5CI$A^8LW00000EC2ui08#)C000F35Xeb^7#NevyZ@k-X<=!e zXsWJk>w1O34M>m`i|`rCqgNYHW8f$p4gdv`LbG9TvR&X;SrjOWK(LZ{7!r#?Mf{;9 zn20E4;h;1SRE{99tZ41zN}(|!P8wGp3kw_x0Uc8n1_69>00@B;hK&*g0SX*43ujei=+Sz0csNon1dXg6ar};TN6AEXB~^T6utm799eOd5(Nkx4-TFJRxce3 z3@Hzq5{s+=TL;s2yPF88F9B^RcVmZG1sMzJxb70Fb$Sl<_V;-dbRMA;ryK~%O}MqF zUob*$_CcG#U>>e-eUep}L&}#Sh!64wyR>iu4h};N97;f-Q2_&128yZLqKeg=Y!nLI zo9RH~1O)REh)lK0Uo8m=90YhkiGWa?!5#!yH$di|j