Next: , Previous: , Up: Functions and Variables for trigtools   [Contents][Index]

96.2.6 Evaluation of Trignometric Functions

Function: trigvalue (x)

The function trigvalue compute values of \(\sin {m\pi\over n},\) \(\cos {m\pi\over n},\) \(\tan {m\pi\over n},\) and \(\cot {m\pi\over n}\) in radicals.

Function: trigeval (x)

The function trigeval compute values of expressions with \(\sin {m\pi\over n},\) \(\cos {m\pi\over n},\) \(\tan {m\pi\over n},\) and \(\cot {m\pi\over n}\) in radicals.

Examples:

  1. Values of trignometric functions
    (%i1) load(trigtools)$
    
    (%i2) trigvalue(sin(%pi/10));
                                      sqrt(5) - 1
    (%o2)                             -----------
                                           4
    
    (%i3) trigvalue(cos(%pi/10));
                                   sqrt(sqrt(5) + 5)
    (%o3)                          -----------------
                                          3/2
                                         2
    
    (%i4) trigvalue(tan(%pi/10));
                                  sqrt(5 - 2 sqrt(5))
    (%o4)                         -------------------
                                        sqrt(5)
    
    (%i5) float(%), numer;
    (%o5)                         0.3249196962329063
    (%i6) float(tan(%pi/10)), numer;
    (%o6)                         0.3249196962329063
    (%i7) trigvalue(cot(%pi/10));
    (%o7)                         sqrt(2 sqrt(5) + 5)
    (%i8) float(%), numer;
    (%o8)                          3.077683537175254
    (%i9) float(cot(%pi/10)), numer;
    (%o9)                          3.077683537175254
    (%i10) trigvalue(sin(%pi/32));
                         sqrt(2 - sqrt(sqrt(sqrt(2) + 2) + 2))
    (%o10)               -------------------------------------
                                           2
    (%i11) trigvalue(cos(%pi/32));
                         sqrt(sqrt(sqrt(sqrt(2) + 2) + 2) + 2)
    (%o11)               -------------------------------------
                                           2
    (%i12) trigvalue(cos(%pi/256));
           sqrt(sqrt(sqrt(sqrt(sqrt(sqrt(sqrt(2) + 2) + 2) + 2) + 2) + 2) + 2)
    (%o12) -------------------------------------------------------------------
                                            2
    (%i13) trigvalue(cos(%pi/60));
            sqrt(sqrt(sqrt(2) sqrt(3) sqrt(sqrt(5) + 5) + sqrt(5) + 7) + 4)
    (%o13)  ---------------------------------------------------------------
                                          3/2
                                         2
    
    (%i14) trigvalue(sin(%pi/60));
            sqrt(4 - sqrt(sqrt(2) sqrt(3) sqrt(sqrt(5) + 5) + sqrt(5) + 7))
    (%o14)  ---------------------------------------------------------------
                                          3/2
                                         2
    
    (%i15) trigvalue(sin(%pi/18));
                                           %pi
    (%o15)                             sin(---)
                                           18
    
    (%i16) trigvalue(sin(%pi/20));
                          sqrt(4 - sqrt(2) sqrt(sqrt(5) + 5))
    (%o16)                -----------------------------------
                                          3/2
                                         2
    
  2. ode example
    (%i17) load(odes)$
    
    (%i18) eq:'diff(y,x,5)+2*y=0;
                                      5
                                     d y
    (%o18)                           --- + 2 y = 0
                                       5
                                     dx
    
    (%i19) odeL(eq,y,x);
    
                       1/5     4 %pi
                    - 2    cos(-----) x
                                 5           1/5     4 %pi
    (%o19) y = C5 %e                    sin(2    sin(-----) x)
                                                       5
               1/5     4 %pi
            - 2    cos(-----) x
                         5           1/5     4 %pi
     + C4 %e                    cos(2    sin(-----) x)
                                               5
               1/5     2 %pi
            - 2    cos(-----) x
                         5           1/5     2 %pi
     + C3 %e                    sin(2    sin(-----) x)
                                               5
               1/5     2 %pi
            - 2    cos(-----) x                                  1/5
                         5           1/5     2 %pi            - 2    x
     + C2 %e                    cos(2    sin(-----) x) + C1 %e
                                               5
    
    (%i20) sol:trigeval(%);
                      (sqrt(5) - 1) x
                    - ---------------
                            9/5
                           2              sqrt(sqrt(5) + 5) x
    (%o20) y = C3 %e                  sin(-------------------)
                                                 13/10
                                                2
              (sqrt(5) - 1) x
            - ---------------
                    9/5
                   2              sqrt(sqrt(5) + 5) x
     + C2 %e                  cos(-------------------)
                                         13/10
                                        2
            (sqrt(5) + 1) x
            ---------------
                  9/5
                 2              sqrt(5 - sqrt(5)) x
     + C5 %e                sin(-------------------)
                                       13/10
                                      2
            (sqrt(5) + 1) x
            ---------------
                  9/5                                          1/5
                 2              sqrt(5 - sqrt(5)) x         - 2    x
     + C4 %e                cos(-------------------) + C1 %e
                                       13/10
                                      2
    
    (%i21) subst(sol,eq)$
    (%i22) ev(%, nouns)$
    (%i23) radcan(%);
    (%o23)                               0 = 0
    
  3. n-th root of complex number

    Example. Find the 4-th roots of %i

    (%i24) solve(x^4=%i,x);
                     1/8                1/8             1/8              1/8
    (%o24) [x = (- 1)    %i, x = - (- 1)   , x = - (- 1)    %i, x = (- 1)   ]
    
    (%i25) rectform(%);
                       %pi        %pi                 %pi         %pi
    (%o25) [x = %i cos(---) - sin(---), x = (- %i sin(---)) - cos(---), 
                        8          8                   8           8
                                    %pi           %pi              %pi        %pi
                            x = sin(---) - %i cos(---), x = %i sin(---) + cos(---)]
                                     8             8                8          8
    
    (%i26) trigeval(%);
                sqrt(sqrt(2) + 2) %i   sqrt(2 - sqrt(2))
    (%o26) [x = -------------------- - -----------------, 
                         2                     2
           sqrt(2 - sqrt(2)) %i    sqrt(sqrt(2) + 2)
    x = (- --------------------) - -----------------, 
                    2                      2
        sqrt(2 - sqrt(2))   sqrt(sqrt(2) + 2) %i
    x = ----------------- - --------------------, 
                2                    2
        sqrt(2 - sqrt(2)) %i   sqrt(sqrt(2) + 2)
    x = -------------------- + -----------------]
                 2                     2
    

Next: , Previous: , Up: Functions and Variables for trigtools   [Contents][Index]

JavaScript license information