Task

If your language has a library or built-in functions for trigonometry, show examples of:

   sine
   cosine
   tangent
   inverses   (of the above)

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 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   known approximation or identity.




  [ $" bigrat.qky' loadfile ] now! 
 
  [ 2646693125139304345 
    1684937174853026414 ]                 is pi/2     (       --> n/d )          
 
  [ 2dup 
    2dup  3 v**     2363     18183 v* v-
    2over 5 v**    12671   4363920 v* v+
    2swap              1         1
    2over 2 v**      445     12122 v* v+
    2over 4 v**      601    872784 v* v+
    2swap 6 v**      121  16662240 v* v+
    v/ ]                                  is sin      (   n/d --> n/d )
 
  [ 1 1 
    2over 2 v**     3665      7788 v* v-
    2over 4 v**      711     25960 v* v+
    2over 6 v**     2923   7850304 v* v-
    2swap              1         1
    2over 2 v**      229      7788 v* v+
    2over 4 v**        1      2360 v* v+
    2swap 6 v**      127  39251520 v* v+
    v/ ]                                  is cos      (   n/d --> n/d )
 
  [ 2dup 
    2dup  3 v**        5        39 v* v-
    2over 5 v**        2       715 v* v+
    2over 7 v**        1    135135 v* v-
    2swap              1         1 
    2over 2 v**        6        13 v* v-
    2over 4 v**       10       429 v* v+
    2swap 6 v**        4     19305 v* v-
    v/ ]                                  is tan      (   n/d --> n/d )
 
  [ 2dup
    2dup  3 v**  2318543   2278617 v* v-
    2over 5 v** 12022609  60763120 v* v+
    2swap              1         1 
    2over 2 v**  1798875   1519078 v* v-
    2over 4 v**  3891575  12152624 v* v+
    2swap 6 v**  4695545 510410208 v* v-
    v/ ]                                  is arcsin   (   n/d --> n/d )
 
  [ pi/2 2swap arcsin v- ]                is arccos   (   n/d --> n/d )
 
  [ 2dup
    2dup  3 v**       50        39 v* v+
    2over 5 v**      283       715 v* v+
    2over 7 v**      256     15015 v* v+
    2swap              1         1 
    2over 2 v**       21        13 v* v+
    2over 4 v**      105       143 v* v+
    2swap 6 v**       35       429 v* v+
    v/ ]                                  is arctan   (   n/d --> n/d )
 
  [ pi/2 v* 90 1 v/ ]                     is deg->rad (   n/d --> n/d )
 
  [ pi/2 v/ 90 1 v* ]                     is rad->deg (   n/d --> n/d )
 
say "With an argument of 0.5 radians"
cr cr 
$ "0.5" $->v drop 
sin 
say "Sin approximation:  " 20 point$ echo$ cr
say "     Actual value:  0.47942553860420300027..."
cr cr 
$ "0.5" $->v drop 
cos 
say "Cos approximation:  " 20 point$ echo$ cr
say "     Actual value:  0.87758256189037271611..."
cr cr 
$ "0.5" $->v drop 
tan 
say "Tan approximation:  " 20 point$ echo$ cr
say "     Actual value:  0.54630248984379051325..."
cr cr cr
say "To radians, using approximated values from previous computations"
cr cr
$ "0.47942553860423933121" $->v drop 
arcsin 
say "Arcsin approximation: " 20 point$ echo$ cr
say "       Actual value:  0.5"
cr cr
$ "0.87758256189037190908" $->v drop 
arccos 
say "Arccos approximation: " 20 point$ echo$ cr
say "       Actual value:  0.5"
cr cr
$ "0.54630248984379037103" $->v drop 
arctan 
say "Arctan approximation: " 20 point$ echo$ cr
say "       Actual value:  0.5"
cr cr cr 
say "0.5 radians is approx 28.64788976 degrees" cr
cr 
$ "28.64788976" $->v drop 
deg->rad sin 
say "Sin approximation:  " 20 point$ echo$ cr
say "     Actual value:  0.47942553865718102604..."
cr cr 
$ "28.64788976" $->v drop 
deg->rad cos 
say "Cos approximation:  " 20 point$ echo$ cr
say "     Actual value:  0.87758256186143068872..."
cr cr 
$ "28.64788976" $->v drop 
deg->rad tan 
say "Tan approximation:  " 20 point$ echo$ cr
say "     Actual value:  0.54630248992217530618..."
cr cr cr
say "To degrees, using approximated values from previous computations"
cr cr
$ "0.47942553865721735699" $->v drop 
arcsin rad->deg
say "Arcsin approximation:  " 20 point$ echo$ cr
say "        Actual value:  28.64788976..."
cr cr 
$ "0.87758256186142988169" $->v drop 
arccos rad->deg
say "Arccos approximation:  " 20 point$ echo$ cr
say "        Actual value:  28.64788976..."
cr cr
$ "0.54630248992217516396" $->v drop 
arctan rad->deg
say "Arctan approximation:  " 20 point$ echo$ cr
say "        Actual value:  28.64788976..."