iemisc: Additional Examples from GNU Octave Compatible cosd Function

\bigskip

cosd Examples (R style)

library("iemisc")

# Examples from GNU Octave cosd

cosd(c(0, 180, 360))


cosd(c(90, 270, 45))



try(cosd(pi * seq(0, 80, by = 10) / 180))
# gives error message since the computed value is in radians rather than degrees


cos(pi * seq(0, 80, by = 10) / 180)
# this is correct since `cos` expects the angle in radians

try(cosd(seq(0, 80, by = 10) * 180 / pi))
# converts angles in radians to degrees; however, it will still receive an error message with this current implementation. You can use the work-around below:

xx <- seq(0, 80, by = 10) * 180 / pi

cosd(xx)


try(cos(seq(0, 80, by = 10) * 180 / pi))
# converts angles in radians to degrees; however, this is incorrect since `cos` expects the angle in radians and not degrees


cosd(90)

cos(pi/2)

\bigskip \bigskip

cosd and cos Examples (GNU Octave style)

```{octave eval = FALSE}

cosd(90)

cos(pi/2)

% results

cosd(90) ans = 0

cos(pi/2) ans = 6.1232e-17

```

\bigskip \bigskip

Works Cited

John W. Eaton, David Bateman, Søren Hauberg, and Rik Wehbring (November 2022). GNU Octave: A high-level interactive language for numerical computations: Edition 7 for Octave version 7.3.0. https://docs.octave.org/octave.pdf. Page 553.

\bigskip \bigskip

EcoC²S Links

EcoC²S Home -- https://www.ecoccs.com/
About EcoC²S -- https://www.ecoccs.com/about_ecoc2s.html
Services -- https://www.ecoccs.com/services.html
1 Stop Shop -- https://www.ecoccs.com/other_biz.html
Products -- https://www.questionuniverse.com/products.html
Media -- https://www.ecoccs.com/media.html
Resources -- https://www.ecoccs.com/resources.html
R Trainings and Resources provided by EcoC²S (Irucka Embry, E.I.T.) -- https://www.ecoccs.com/rtraining.html

\bigskip \bigskip

Copyright and License

All R code written by Irucka Embry is distributed under the GPL-3 (or later) license, see the GNU General Public License {GPL} page.

All written content originally created by Irucka Embry is copyrighted under the Creative Commons Attribution-ShareAlike 4.0 International License. All other written content retains the copyright of the original author(s).

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.



Try the iemisc package in your browser

Any scripts or data that you put into this service are public.

iemisc documentation built on Sept. 25, 2023, 5:09 p.m.