简体   繁体   中英

How to use trigonometry in Scheme?

Scheme中的三角函数的名称是什么,它们表示角度的单位是什么?

The Scheme standards define six trigonometric functions: sin , cos , tan , asin , acos , and atan . In particular, atan can be called with either 1 or 2 arguments, and the 2-argument version is equivalent to atan2 in other languages.

sin , cos and tan all take radian arguments. asin , acos , and atan all return radian values.


All serious math libraries (for any programming language), including the one that Scheme provides, use radians for their trigonometric functions.

Mathematically, radian is the one true correct unit of measure for angles. :-) Anyway, this is why documentation usually doesn't explicitly spell this out; it is such an overwhelmingly common expectation that it's redundant, as using any other unit is a pretty serious WTF.

Racket's documentation spells this out more explicitly because it's used widely in educational settings where radian-as-fundamental-unit-of-angle-measure may not have been taught yet.

In the R6RS standard you have a fair amount of standard numeric procedures including sin , cos , tan , asin , acos , and atan .

The R6RS standard has special numeric libraries for both fixnum and floats which may be faster versions than the generic ones.

From the procedure available you may able to make other, more specialized, procedures.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM