Skip to content

Commit eb4d26c

Browse files
committed
better and clearer wording
1 parent c4a07bc commit eb4d26c

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

README.md

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ For simplicity, many of the code examples here operate on floating point values
3636
- [common sets `` `` `` ``](#common-sets)
3737
- [function `ƒ`](#function)
3838
- [piecewise function](#piecewise-function)
39-
- [function notation](#function-notation)
4039
- [special functions](#special-functions)
40+
- [function notation](#function-notation)
4141
- [prime ``](#prime)
4242
- [equality arrows `<` `>` `` ``](#equality-arrows)
4343
- [more...](#more)
@@ -145,12 +145,14 @@ var result = 3 * k * j
145145

146146
To denote multiplication of one vector with a scalar, or element-wise multiplication of a vector with another vector, we typically do not use the dot `·` or cross `×` symbols. These have different meanings in linear algebra, discussed shortly.
147147

148-
Let's take our earlier example but apply it to vectors. For element-wise vector multiplication, you might see an open dot `` to represent the [Hadamard product](https://en.wikipedia.org/wiki/Hadamard_product_%28matrices%29).<sup>[2]</sup> Or, the author might explicitly define a different symbol, such as a circle with a dot, or a large filled dot.<sup>[3]</sup>
148+
Let's take our earlier example but apply it to vectors. For element-wise vector multiplication, you might see an open dot `` to represent the [Hadamard product](https://en.wikipedia.org/wiki/Hadamard_product_%28matrices%29).<sup>[2]</sup>
149149

150150
![dotcross3](img/dotcross3.png)
151151

152152
<!-- 3\mathbf{k}\circ\mathbf{j} -->
153153

154+
In other instances, the author might explicitly define a different notation, such as a circled dot `` or a filled circle ``.<sup>[3]</sup>
155+
154156
Here is how it would look in code, using arrays `[x, y]` to represent the 2D vectors.
155157

156158
```js
@@ -520,7 +522,7 @@ function isInteger (n) {
520522

521523
##### `` natural numbers
522524

523-
A natural number, a positive and non-negative integer. The set looks like either of these, depending on the context and field of study:
525+
A natural number, a positive and non-negative integer. Depending on the context and field of study, the set may or may not include zero, so it could look like either of these:
524526

525527
```js
526528
{ 0, 1, 2, 3, ... }
@@ -530,14 +532,14 @@ A natural number, a positive and non-negative integer. The set looks like either
530532
The latter is more common in computer science, for example:
531533

532534
```js
533-
function isNatural (n) {
535+
function isNaturalNumber (n) {
534536
return isInteger(n) && n >= 0
535537
}
536538
```
537539

538540
##### `` complex numbers
539541

540-
A complex number is a combination of a real number and an imaginary number. For more info, see [A Visual Intuitive Guide to Imaginary Numbers](http://betterexplained.com/articles/a-visual-intuitive-guide-to-imaginary-numbers/).
542+
A complex number is a combination of a real number and an imaginary number. For more info, see [A Visual, Intuitive Guide to Imaginary Numbers](http://betterexplained.com/articles/a-visual-intuitive-guide-to-imaginary-numbers/).
541543

542544
## function
543545

@@ -617,7 +619,7 @@ function f (x) {
617619

618620
There are some "special" functions that are commonplace in mathematics. For a programmer, these might be analogous to "built-in" functions.
619621

620-
One such example is the *sgn* function. This is the *signum* or *sign* function. Let's use some earlier notation to describe it:
622+
One such example is the *sgn* function. This is the *signum* or *sign* function. Let's use [piecewise function](#piecewise-function) notation to describe it:
621623

622624
![sgn](http://latex.codecogs.com/svg.latex?sgn%28x%29%20%3A%3D%20%5Cbegin%7Bcases%7D%20-1%26%20%5Ctext%7Bif%20%7D%20x%20%3C%200%5C%5C%200%2C%20%26%20%5Ctext%7Bif%20%7D%20%7Bx%20%3D%200%7D%5C%5C%201%2C%20%26%20%5Ctext%7Bif%20%7D%20x%20%3E%200%5C%5C%20%5Cend%7Bcases%7D)
623625

@@ -658,13 +660,15 @@ It might also be written in the following form:
658660

659661
The arrow here with a tail typically means "maps to," as in *x maps to x<sup>2</sup>*.
660662

661-
Sometimes, when it isn't obvious, the notation will also describe the *domain* and *codomain* of the function.
663+
Sometimes, when it isn't obvious, the notation will also describe the *domain* and *codomain* of the function. A more formal definition of *ƒ* might be written as:
662664

663-
The above function *ƒ* might have a domain specified like so:
664-
665-
![domain](http://latex.codecogs.com/svg.latex?f%20%3A%20%5Cmathbb%7BR%7D%20%5Crightarrow%20%5Cmathbb%7BR%7D)
665+
![funcnot](http://latex.codecogs.com/svg.latex?%5Cbegin%7Balign*%7D%20f%20%3A%26%5Cmathbb%7BR%7D%20%5Crightarrow%20%5Cmathbb%7BR%7D%5C%5C%20%26x%20%5Cmapsto%20x%5E2%20%5Cend%7Balign*%7D)
666666

667-
<!-- f : \mathbb{R} \rightarrow \mathbb{R} -->
667+
<!-- \begin{align*}
668+
f :&\mathbb{R} \rightarrow \mathbb{R}\\
669+
&x \mapsto x^2
670+
\end{align*}
671+
-->
668672

669673
In programming, the *domain* and *codomain* might be seen as the *input* and *output* types of a function. Another example, using our earlier *sgn* function, which outputs an integer:
670674

@@ -690,17 +694,7 @@ function square (a) {
690694

691695
Some tools like [flowtype](http://flowtype.org/) attempt to bring static typing into JavaScript.
692696

693-
Other languages, like Java, allow for true method overloading based on the static types of a function's input/output. This is closer to mathematics, since two functions are not the same if they operate in a different *domain*.
694-
695-
So, with all of this together, a formal definition of our earlier *ƒ* function could look like this:
696-
697-
![funcnot](http://latex.codecogs.com/svg.latex?%5Cbegin%7Balign*%7D%20f%20%3A%26%5Cmathbb%7BR%7D%20%5Crightarrow%20%5Cmathbb%7BR%7D%5C%5C%20%26x%20%5Cmapsto%20x%5E2%20%5Cend%7Balign*%7D)
698-
699-
<!-- \begin{align*}
700-
f :&\mathbb{R} \rightarrow \mathbb{R}\\
701-
&x \mapsto x^2
702-
\end{align*}
703-
-->
697+
Other languages, like Java, allow for true method overloading based on the static types of a function's input/output. This is closer to mathematics, since two functions are not the same if they use a different *domain*.
704698

705699
## prime
706700

@@ -738,7 +732,7 @@ Multiple prime symbols can be used to describe the second derivative *ƒ′′*
738732

739733
## equality arrows
740734

741-
In math, the `<` `>` `` and `` are typically used in the same way we use them in code:
735+
In math, the `<` `>` `` and `` are typically used in the same way we use them in code: *less than*, *greater than*, *less than or equal to* and *greater than or equal to*, respectively.
742736

743737
```js
744738
50 > 2 === true

0 commit comments

Comments
 (0)