Skip to content

Commit a0ea3b3

Browse files
committed
Reciprocal trig ratios
1 parent 378a287 commit a0ea3b3

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

Math/Trig.scope

+39-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Math;
88

99
Computes the sine of @"x" (in radians).
1010

11-
Please note that an input of @"PI" **will not** return exactly `0.0`.
11+
Please note that an input of @"PI" **will not** return *exactly* `0.0`.
1212
%/
1313
func dec sin(dec x) {
1414
// Special cases
@@ -67,7 +67,7 @@ func dec sin(dec x) {
6767

6868
Computes the cosine of @"x" (in radians).
6969

70-
Please note that an input of @"PI" **will not** return exactly `-1.0`.
70+
Please note that an input of @"PI" **will not** return *exactly* `-1.0`.
7171
%/
7272
func dec cos(dec x) {
7373
ret sin(x + PI / 2.0);
@@ -79,8 +79,44 @@ func dec cos(dec x) {
7979

8080
Computes the tanget of @"x" (in radians).
8181

82-
Please note that an input of @"PI" **will not** return exactly `0.0`.
82+
Please note that an input of @"PI" **will not** return *exactly* `0.0`.
8383
%/
8484
func dec tan(dec x) {
8585
ret sin(x) / cos(x);
86+
}
87+
88+
/%
89+
@approx: This function uses the Taylor series expansion of sine. This function
90+
is not 100% accurate but will provide a very good approximation.
91+
92+
Computes the cosecant of @"x" (in radians).
93+
94+
Please note that an input of @"PI" **will not** return *exactly* `0.0`.
95+
%/
96+
func dec csc(dec x) {
97+
ret 1.0 / sin(x);
98+
}
99+
100+
/%
101+
@approx: This function uses the Taylor series expansion of sine. This function
102+
is not 100% accurate but will provide a very good approximation.
103+
104+
Computes the secant of @"x" (in radians).
105+
106+
Please note that an input of @"PI" **will not** return *exactly* `0.0`.
107+
%/
108+
func dec sec(dec x) {
109+
ret 1.0 / cos(x);
110+
}
111+
112+
/%
113+
@approx: This function uses the Taylor series expansion of sine. This function
114+
is not 100% accurate but will provide a very good approximation.
115+
116+
Computes the cotangent of @"x" (in radians).
117+
118+
Please note that an input of @"PI" **will not** return *exactly* `0.0`.
119+
%/
120+
func dec cot(dec x) {
121+
ret 1.0 / tan(x);
86122
}

0 commit comments

Comments
 (0)