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

#### 96.2.1 Convert to sin and cos

Function: c2sin (x)
Function: c2cos (x)

  The function c2sin converts the expression \(a\cos x + b\sin x\) to \(r\sin(x+\phi).\)

  The function c2cos converts the expression \(a\cos x + b\sin x\) to \(r\cos(x-\phi).\)

  Examples:

      (%i1) load("trigtools")$
      (%i2) c2sin(3*sin(x)+4*cos(x));
                                                  4
      (%o2)                        5 sin(x + atan(-))
                                                  3
      (%i3) trigexpand(%),expand;
      (%o3)                        3 sin(x) + 4 cos(x)

      (%i4) c2cos(3*sin(x)-4*cos(x));
                                                   3
      (%o4)                       - 5 cos(x + atan(-))
                                                   4

      (%i5) trigexpand(%),expand;
      (%o5)                        3 sin(x) - 4 cos(x)

      (%i6) c2sin(sin(x)+cos(x));
                                                  %pi
      (%o6)                       sqrt(2) sin(x + ---)
                                                   4

      (%i7) trigexpand(%),expand;
      (%o7)                          sin(x) + cos(x)
      (%i8) c2cos(sin(x)+cos(x));
                                                  %pi
      (%o8)                       sqrt(2) cos(x - ---)
                                                   4

      (%i9) trigexpand(%),expand;
      (%o9)                          sin(x) + cos(x)

  Example. Solve trigonometric equation

      (%i10) eq:3*sin(x)+4*cos(x)=2;
      (%o10)                      3 sin(x) + 4 cos(x) = 2

      (%i11) plot2d([3*sin(x)+4*cos(x),2],[x,-%pi,%pi]);

      (%i12) eq1:c2sin(lhs(eq))=2;
                                                 4
      (%o35)                      5 sin(x + atan(-)) = 2
                                                 3
      (%i13) solvetrigwarn:false$
      (%i14) solve(eq1)[1]$ x1:rhs(%);
                                          2         4
      (%o15)                         asin(-) - atan(-)
                                          5         3
      (%i16) float(%), numer;
      (%o39)                       - 0.5157783719341241
      (%i17) eq2:c2cos(lhs(eq))=2;
                                                 3
      (%o17)                      5 cos(x - atan(-)) = 2
      (%i18) solve(eq2,x)[1]$ x2:rhs(%);
                                          3         2
      (%o19)                         atan(-) + acos(-)
                                          4         5
      (%i20) float(%), numer;
      (%o20)                         1.802780589520693

      (%i21) sol:[x1,x2];
                                2         4        3         2
      (%o44)              [asin(-) - atan(-), atan(-) + acos(-)]
                                5         3        4         5

  Answ.: \(x = x_1 + 2\pi k,\) \(x_1 = \sin^{-1}{2\over 5} - \tan^{-1}{4\over 3},\)or \(x_1 = \tan^{-1}{3\over 4} + \cos^{-1}{2\over 5},\)for k any integer.

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