<commit_before># Built-in Math

> This exercise covers built-in JavaScript Math functions.


## Exercises

### a) Plotting

* Generate a plot of `Math.sin` over the interval `[0,2π]`.
* Generate a plot of `Math.cos` over the interval `[0,2π]`.


### b) RMSE

A common measure of numerical accuracy is the [root-mean-square error][rmse] (RMSE). The basic idea is to determine the average deviation of computed values from a known standard. The lower the RMSE, the more accurate the algorithm; the higher the RMSE, the less accurate the algorithm.

* Write a function to compute the [root-mean-square error][rmse] (RMSE).


### c) Comparison to Standard

* Generate a plot showing the sine computed by `Math.sin` and the sine computed from Julia (Julia results can be found in the [fixtures][fixtures] directory). The `x` values over which to compute the sin are included in the fixtures.
* Generate a plot showing the deviations (in units of [epsilon][epsilon-difference]) of `Math.sin` from Julia (include the RMSE in the plot title).
* As a bonus, repeat the test for different Node versions.


### d) Testing Native Math

* Extend the previous solutions to test the following Math functions:

  - `cos`
  - `tan`
  - `sqrt`
  - `pow`
  - `exp`
  - `log`

  The output should be a single web page showing the deviations in units of epsilon for __all__ functions.

* As a bonus, repeat the tests for different browsers, such as Firefox and Internet Explorer.


### e) Testing Custom Implementations

* Extend the previous solution to test custom implementations of the above functions.

  - `sin`: `@stdlib/math/base/special/sin`
  - `cos`: `@stdlib/math/base/special/cos`
  - `tan`: `@stdlib/math/base/special/tan`
  - `sqrt`: `@stdlib/math/base/special/sqrt`
  - `log`: `@stdlib/math/base/special/ln`
  - `exp`: `@stdlib/math/base/special/exp`
  - `pow`: `@stdlib/math/base/special/pow`


## Tips

* When calculating the [RMSE][rmse], consider using [Welford's method][welfords-method] for robust computation of the mean.
* When generating plots, be sure to specify plot axis labels and the plot title.
* To test against different Node versions, use [nvm][nvm].
* Testing different browsers may be rather involved. One possible solution would be to launch a browser, load a test script which runs the computations, and then streams the results back to an analysis server which collects the results and generates a plot.


## Testing

Assuming that each solution is placed in a separate file,

``` javascript
$ node ./path/to/<solution_a>.js
$ node ./path/to/<solution_b>.js
```

When all your solutions pass, proceed to the [next exercise][next-exercise].


<!-- <links> -->

[rmse]: https://en.wikipedia.org/wiki/Root-mean-square_deviation
[welfords-method]: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Online_algorithm
[nvm]: https://github.com/creationix/nvm

[fixtures]: https://github.com/stdlib-js/stdlib/tree/develop/workshops/numeric-computing

[epsilon-difference]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/utils/float64-epsilon-difference

<!-- </links> --><commit_msg>Update copy and fix link<commit_after># Built-in Math

> This exercise covers built-in JavaScript Math functions.


## Exercises

### a) Plotting

* Generate a plot of `Math.sin` over the interval `[0,2π]`.
* Generate a plot of `Math.cos` over the interval `[0,2π]`.


### b) RMSE

A common measure of numerical accuracy is the [root-mean-square error][rmse] (RMSE). The basic idea is to determine the average deviation of computed values from a known standard. The lower the RMSE, the more accurate the algorithm; the higher the RMSE, the less accurate the algorithm.

* Write a function to compute the [root-mean-square error][rmse] (RMSE).


### c) Comparison to Standard

* Generate a plot showing the sine computed by `Math.sin` and the sine computed from Julia (Julia results can be found in the [fixtures][fixtures] directory). The `x` values over which to compute the sin are included in the fixtures.
* Generate a plot showing the deviations (in units of [epsilon][epsilon-difference]) of `Math.sin` from Julia (include the RMSE in the plot title).
* As a bonus, repeat the test for different Node versions.


### d) Testing Native Math

* Extend the previous solutions to test the following Math functions:

  - `cos`
  - `tan`
  - `sqrt`
  - `pow`
  - `exp`
  - `log`

  The output should be a single web page showing the deviations in units of epsilon for __all__ functions.

* As a bonus, repeat the tests for different browsers, such as Firefox and Internet Explorer.


### e) Testing Custom Implementations

* Extend the previous solution to test custom implementations of the above functions.

  - `sin`: `@stdlib/math/base/special/sin`
  - `cos`: `@stdlib/math/base/special/cos`
  - `tan`: `@stdlib/math/base/special/tan`
  - `sqrt`: `@stdlib/math/base/special/sqrt`
  - `log`: `@stdlib/math/base/special/ln`
  - `exp`: `@stdlib/math/base/special/exp`
  - `pow`: `@stdlib/math/base/special/pow`


## Tips

* When calculating the [RMSE][rmse], consider using [Welford's method][welfords-method] for robust computation of the mean.
* When generating plots, be sure to specify plot axis labels and the plot title.
* To test against different Node versions, use [nvm][nvm].
* Testing different browsers may be rather involved. One possible solution would be to launch a browser, load a test script which runs the computations, and then stream the results back to an analysis server which collects the results and generates a plot.


## Testing

Assuming that each solution is placed in a separate file,

``` javascript
$ node ./path/to/<solution_a>.js
$ node ./path/to/<solution_b>.js
```

When all your solutions pass, proceed to the [next exercise][next-exercise].


<!-- <links> -->

[rmse]: https://en.wikipedia.org/wiki/Root-mean-square_deviation
[welfords-method]: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Online_algorithm
[nvm]: https://github.com/creationix/nvm

[fixtures]: https://github.com/stdlib-js/stdlib/tree/develop/workshops/numeric-computing

[epsilon-difference]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/utils/float64-epsilon-difference

[next-exercise]: https://github.com/stdlib-js/stdlib/blob/develop/workshops/numeric-computing/exercises/03.md

<!-- </links> -->
{'fraction_non_alphanumeric': 0.11547452080411408, 'fraction_numerical': 0.002805049088359046, 'mean_word_length': 4.17998385794996, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 11, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3215395', 'n_tokens_mistral': 2003, 'n_tokens_neox': 1852, 'n_words': 726}