2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,7 +1,14 @@
|
|||
If your language has a library or built-in functions for trigonometry, show examples of sine, cosine, tangent, and their inverses using the same angle in radians and degrees.
|
||||
;Task:
|
||||
If your language has a library or built-in functions for trigonometry, show examples of:
|
||||
::* sine
|
||||
::* cosine
|
||||
::* tangent
|
||||
::* inverses (of the above)
|
||||
<br>using the same angle in radians and degrees.
|
||||
|
||||
For the non-inverse functions, each radian/degree pair should use arguments that evaluate to the same angle (that is, it's not necessary to use the same angle for all three regular functions as long as the two sine calls use the same angle).
|
||||
For the non-inverse functions, each radian/degree pair should use arguments that evaluate to the same angle (that is, it's not necessary to use the same angle for all three regular functions as long as the two sine calls use the same angle).
|
||||
|
||||
For the inverse functions, use the same number and convert its answer to radians and degrees.
|
||||
For the inverse functions, use the same number and convert its answer to radians and degrees.
|
||||
|
||||
If your language does not have trigonometric functions available or only has some available, write functions to calculate the functions based on any [[wp:List of trigonometric identities|known approximation or identity]].
|
||||
If your language does not have trigonometric functions available or only has some available, write functions to calculate the functions based on any [[wp:List of trigonometric identities|known approximation or identity]].
|
||||
<br><br>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
#import system.
|
||||
#import system'math.
|
||||
#import extensions.
|
||||
|
||||
#symbol program =
|
||||
[
|
||||
console writeLine:"Radians:".
|
||||
console writeLine:"sin(π/3) = ":((pi_value/3) sin).
|
||||
console writeLine:"cos(π/3) = ":((pi_value/3) cos).
|
||||
console writeLine:"tan(π/3) = ":((pi_value/3) tan).
|
||||
console writeLine:"arcsin(1/2) = ":(0.5r arcsin).
|
||||
console writeLine:"arccos(1/2) = ":(0.5r arccos).
|
||||
console writeLine:"arctan(1/2) = ":(0.5r arctan).
|
||||
console writeLine.
|
||||
|
||||
console writeLine:"Degrees:".
|
||||
console writeLine:"sin(60º) = ":(60.0r radian sin).
|
||||
console writeLine:"cos(60º) = ":(60.0r radian cos).
|
||||
console writeLine:"tan(60º) = ":(60.0r radian tan).
|
||||
console writeLine:"arcsin(1/2) = ":(0.5r arcsin degree):"º".
|
||||
console writeLine:"arccos(1/2) = ":(0.5r arccos degree):"º".
|
||||
console writeLine:"arctan(1/2) = ":(0.5r arctan degree):"º".
|
||||
].
|
||||
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
Pi := Acos(-1.0);
|
||||
|
||||
# Or use the built-in constant:
|
||||
Pi := FLOAT.PI;
|
||||
|
||||
r := Pi / 5.0;
|
||||
d := 36;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
say sin(pi/3), ' ', sin 60, 'd'; # 'g' (gradians) and 1 (circles)
|
||||
say cos(pi/4), ' ', cos 45, 'd'; # are also recognized.
|
||||
say tan(pi/6), ' ', tan 30, 'd';
|
||||
say sin(pi/3);
|
||||
say cos(pi/4);
|
||||
say tan(pi/6);
|
||||
|
||||
say asin(sqrt(3)/2), ' ', asin sqrt(3)/2, 'd';
|
||||
say acos(1/sqrt 2), ' ', acos 1/sqrt(2), 'd';
|
||||
say atan(1/sqrt 3), ' ', atan 1/sqrt(3), 'd';
|
||||
say asin(sqrt(3)/2);
|
||||
say acos(1/sqrt 2);
|
||||
say atan(1/sqrt 3);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue