This commit is contained in:
Miloslav Ciz 2022-11-19 22:33:58 +01:00
parent 64e42585cf
commit 2184e73b24
6 changed files with 19 additions and 13 deletions

3
sin.md
View file

@ -43,6 +43,7 @@ Some additional facts and properties regarding the sine functions are:
- Its inverse function is [arcus sine](asin.md), abbreviated *asin*, also written as *sin^-1* -- this function tells you what argument you need to give to sin to get a specific result number. It's actually an inverse of only part of the sine function because the whole sine function can't be inverted, it isn't [bijective](bijection.md).
- [Derivative](derivative.md) of *sin(x)* is *cos(x)*, the [integral](integral.md) of *sin(x) dx* is *-cos(x)*.
- By adding many differently shifted and scaled sine functions we can create basically any other function, see e.g. [cosine transform](cosine_transform.md).
- Sine and [cosine](cos.md) functions are used to draw [circles](circle.md). If you plot points with *x* coordinate equal to *sin(t)* and *y* coordinate equal to *cos(t)* for *t* going from 0 to *2 * pi*, you'll get a unit circle.
- *sin(x)^2 + cos(x)^2 = 1*
Some values of the sine function are:
@ -76,7 +77,7 @@ If you want a small, fast and perhaps integer only `sin` function (the one we'd
Very rough and fast approximations e.g. for primitive music synthesis can be done with the traditional very basic [square](square_function.md) or [triangle](triangle_function.md) functions. The following is a simple 8bit linear approximation that's more accurate than square or triangle (approximates sine with a linear function in each quadrant):
```
unsigned char sinA(uint8_t x)
unsigned char sinA(unsigned char x)
{
unsigned char quadrant = x / 64;