Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
Disp sin(43)▶Dec,i
|
||||
Disp cos(43)▶Dec,i
|
||||
Disp tan⁻¹(10,10)▶Dec,i
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Const pi As Double = 4 * Atn(1)
|
||||
Dim As Double radians = pi / 4
|
||||
Dim As Double degrees = 45.0 '' equivalent in degrees
|
||||
Dim As Double temp
|
||||
|
||||
Print "Radians : "; radians, " ";
|
||||
Print "Degrees : "; degrees
|
||||
Print
|
||||
Print "Sine : "; Sin(radians), Sin(degrees * pi / 180)
|
||||
Print "Cosine : "; Cos(radians), Cos(degrees * pi / 180)
|
||||
Print "Tangent : "; Tan(radians), Tan(degrees * pi / 180)
|
||||
Print
|
||||
temp = ASin(Sin(radians))
|
||||
Print "Arc Sine : "; temp, temp * 180 / pi
|
||||
temp = ACos(Cos(radians))
|
||||
Print "Arc Cosine : "; temp, temp * 180 / pi
|
||||
temp = Atn(Tan(radians))
|
||||
Print "Arc Tangent : "; temp, temp * 180 / pi
|
||||
Sleep
|
||||
14
Task/Trigonometric-functions/Nim/trigonometric-functions.nim
Normal file
14
Task/Trigonometric-functions/Nim/trigonometric-functions.nim
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import math
|
||||
|
||||
proc radians(x): float = x * Pi / 180
|
||||
proc degrees(x): float = x * 180 / Pi
|
||||
|
||||
let rad = Pi/4
|
||||
let deg = 45.0
|
||||
|
||||
echo "Sine: ", sin(rad), " ", sin(radians(deg))
|
||||
echo "Cosine : ", cos(rad), " ", cos(radians(deg))
|
||||
echo "Tangent: ", tan(rad), " ", tan(radians(deg))
|
||||
echo "Arcsine: ", arcsin(sin(rad)), " ", degrees(arcsin(sin(radians(deg))))
|
||||
echo "Arccocose: ", arccos(cos(rad)), " ", degrees(arccos(cos(radians(deg))))
|
||||
echo "Arctangent: ", arctan(tan(rad)), " ", degrees(arctan(tan(radians(deg))))
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
import: math
|
||||
|
||||
: testTrigo
|
||||
| rad deg hyp z |
|
||||
Pi 4 / ->rad
|
||||
45.0 ->deg
|
||||
0.5 ->hyp
|
||||
|
||||
System.Out rad sin << " - " << deg asRadian sin << cr
|
||||
System.Out rad cos << " - " << deg asRadian cos << cr
|
||||
System.Out rad tan << " - " << deg asRadian tan << cr
|
||||
|
||||
printcr
|
||||
|
||||
rad sin asin ->z
|
||||
System.Out z << " - " << z asDegree << cr
|
||||
|
||||
rad cos acos ->z
|
||||
System.Out z << " - " << z asDegree << cr
|
||||
|
||||
rad tan atan ->z
|
||||
System.Out z << " - " << z asDegree << cr
|
||||
|
||||
printcr
|
||||
|
||||
System.Out hyp sinh << " - " << hyp sinh asinh << cr
|
||||
System.Out hyp cosh << " - " << hyp cosh acosh << cr
|
||||
System.Out hyp tanh << " - " << hyp tanh atanh << cr ;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
?sin(PI/2)
|
||||
?sin(90*PI/180)
|
||||
?cos(0)
|
||||
?cos(0*PI/180)
|
||||
?tan(PI/4)
|
||||
?tan(45*PI/180)
|
||||
?arcsin(1)*2
|
||||
?arcsin(1)*180/PI
|
||||
?arccos(0)*2
|
||||
?arccos(0)*180/PI
|
||||
?arctan(1)*4
|
||||
?arctan(1)*180/PI
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
pi = 3.14
|
||||
decimals(8)
|
||||
see "sin(pi/4.0) = " + sin(pi/4.0) + nl
|
||||
see "cos(pi/4.0) = " + cos(pi/4.0) + nl
|
||||
see "tan(pi/4.0) = " + tan(pi/4.0)+ nl
|
||||
see "asin(sin(pi/4.0)) = " + asin(sin(pi/4.0)) + nl
|
||||
see "acos(cos(pi/4.0)) = " + acos(cos(pi/4.0)) + nl
|
||||
see "atan(tan(pi/4.0)) = " + atan(tan(pi/4.0)) + nl
|
||||
see "atan2(3,4) = " + atan2(3,4) + nl
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
var angle_deg = 45;
|
||||
var angle_rad = Num.pi/4;
|
||||
|
||||
for arr in [
|
||||
[sin(angle_rad), sin(deg2rad(angle_deg))],
|
||||
[cos(angle_rad), cos(deg2rad(angle_deg))],
|
||||
[tan(angle_rad), tan(deg2rad(angle_deg))],
|
||||
[cot(angle_rad), cot(deg2rad(angle_deg))],
|
||||
] {
|
||||
say arr.join(" ");
|
||||
}
|
||||
|
||||
for n in [
|
||||
asin(sin(angle_rad)),
|
||||
acos(cos(angle_rad)),
|
||||
atan(tan(angle_rad)),
|
||||
acot(cot(angle_rad)),
|
||||
] {
|
||||
say [n, rad2deg(n)].join(' ');
|
||||
}
|
||||
25
Task/Trigonometric-functions/jq/trigonometric-functions-1.jq
Normal file
25
Task/Trigonometric-functions/jq/trigonometric-functions-1.jq
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# degrees to radians
|
||||
def radians:
|
||||
(-1|acos) as $pi | (. * $pi / 180);
|
||||
|
||||
def task:
|
||||
(-1|acos) as $pi
|
||||
| ($pi / 180) as $degrees
|
||||
| "Using radians:",
|
||||
" sin(-pi / 6) = \( (-$pi / 6) | sin )",
|
||||
" cos(3 * pi / 4) = \( (3 * $pi / 4) | cos)",
|
||||
" tan(pi / 3) = \( ($pi / 3) | tan)",
|
||||
" asin(-1 / 2) = \((-1 / 2) | asin)",
|
||||
" acos(-sqrt(2)/2) = \((-(2|sqrt)/2) | acos )",
|
||||
" atan(sqrt(3)) = \( 3 | sqrt | atan )",
|
||||
|
||||
"Using degrees:",
|
||||
" sin(-30) = \((-30 * $degrees) | sin)",
|
||||
" cos(135) = \((135 * $degrees) | cos)",
|
||||
" tan(60) = \(( 60 * $degrees) | tan)",
|
||||
" asin(-1 / 2) = \( (-1 / 2) | asin / $degrees)",
|
||||
" acos(-sqrt(2)/2) = \( (-(2|sqrt) / 2) | acos / $degrees)",
|
||||
" atan(sqrt(3)) = \( (3 | sqrt) | atan / $degrees)"
|
||||
;
|
||||
|
||||
task
|
||||
14
Task/Trigonometric-functions/jq/trigonometric-functions-2.jq
Normal file
14
Task/Trigonometric-functions/jq/trigonometric-functions-2.jq
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Using radians:
|
||||
sin(-pi / 6) = -0.49999999999999994
|
||||
cos(3 * pi / 4) = -0.7071067811865475
|
||||
tan(pi / 3) = 1.7320508075688767
|
||||
asin(-1 / 2) = -0.5235987755982988
|
||||
acos(-sqrt(2)/2) = 2.356194490192345
|
||||
atan(sqrt(3)) = 1.0471975511965979
|
||||
Using degrees:
|
||||
sin(-30) = -0.49999999999999994
|
||||
cos(135) = -0.7071067811865475
|
||||
tan(60) = 1.7320508075688767
|
||||
asin(-1 / 2) = -29.999999999999996
|
||||
acos(-sqrt(2)/2) = 135
|
||||
atan(sqrt(3)) = 60.00000000000001
|
||||
Loading…
Add table
Add a link
Reference in a new issue