1.1. 개요

삼각함수개요.gif
[GIF image (523.48 KB)]


1.2. 호도법과 60분법

π rad = 180˚
60분법 30˚ 45˚ 60˚ 90˚ 180˚ 270˚ 360˚
호도법 0 π / 6 π / 4 π / 3 π / 2 π 3π / 2

1.3. 덧셈정리

sin(x + y) = sin(x) * cos(y) + cos(x) * sin(y)
sin(x - y) = sin(x) * cos(y) - cos(x) * sin(y)
cos(x + y) = cos(x) * cos(y) - sin(x) * sin(y)
cos(x - y) = cos(x) * cos(y) + sin(x) * sin(y)
tan(x + y) = (tan(x) + tan(y)) / (1 - tan(x) * tan(y))
tan(x - y) = (tan(x) - tan(y)) / (1 + tan(x) * tan(y))


1.4. 배각정리

sin(2 * x) = 2 * sin(x) * cos(x)
cos(2 * x) = cos²(x) - sin²(x) = 2 * cos²(x) - 1 = 1 - 2 * sin²(x)
tan(2 * x) = (2 * tan(x)) / (1 - tan²(x))


1.5. 반각의 정리

sin²(x / 2) = (1 - cos(x)) / 2
cos²(x / 2) = (1 + cos(x)) / 2
tan²(x / 2) = (1 - cos(x)) / (1 + cos(x))


1.6. 삼각함수 공식 총괄정리

sin(-θ)=-sinθ, cos(-θ)=cosθ, tan(-θ)=-tanθ
sin²θ+cos²θ=1, sec²θ-tan²θ=1, csc²θ-cot²θ=1
sin(π/2-θ)=cosθ, sin(π/2+θ)=cosθ, sin(θ±π/2)=±cosθ
cos(π/2-θ)=sinθ, cos(π/2+θ)=-sinθ, cos(θ±π/2)=Ŧsinθ
sin(π-θ)=sinθ, sin(π+θ)=-sinθ, sin(θ±π)=-sinθ
cos(π-θ)=-cosθ, cos(π+θ)=-cosθ, cos(θ±π)=-cosθ
sin(α±β)=sinαcosβ±cosαsinβ, cos(α±β)=cosαcosβŦsinαsinβ
tan(α+β)=tanα+tanβ/1-tanαtanβ, tan(α-β)=tanα-tanβ/1+tanαtanβ
sin2θ=2sinθcosθ
cos2θ=cos²θ-sin²θ=2cos²θ-1=1-2sin²θ, tan2θ=2tanθ/1-tan²θ
sin²θ/2=1-cosθ/2, cos²θ/2=1+cosθ/2, tan²θ/2=1-cosθ/1+cosθ
sinαcosβ=1/2{sin(α+β)+sin(α-β)}
cosαcosβ=1/2{cos(α+β)+cos(α-β)}
sinαsinβ=-1/2{cos(α+β)-cos(α-β)}
sinα+sinβ=2sin(α+β/2)cos(α-β/2)
sinα-sinβ=2cos(α+β/2)sin(α-β/2)
cosα+cosβ=2cos(α+β/2)cos(α-β/2)
cosα-cosβ=-2sin(α+β/2)sin(α-β/2)


1.7. 삼각함수의 구현

  • sin 함수
    #define def_hwport_pi (3.14159265358979323846264338327950288) /* pi */
    
    double hwport_pow(double s_value, double s_power)
    {
        double s_result;
        double s_count;
    
        for(s_result = (double)1.0, s_count = (double)0.0;s_count < s_power;s_count++) {
            s_result *= s_value;
        }
    
        return(s_result);
    }
    
    double hwport_sin_v1(double s_radian)
    {
        double s_result;
        double s_step;
        double s_factorial_value;
    
        /* step 이 커지는 단계일수록 정밀도는 높아지지만 factorial 값의 범위도 무시할 수 없기에 여기서는 19! 까지만 계산합니다. */
        for(s_result = 0.0, s_step = 1.0, s_factorial_value = 1.0;s_step <= 17.0;s_step += 4.0) {
            s_factorial_value *= s_step;
            s_result += hwport_pow(s_radian, s_step) / s_factorial_value /* step! */;
            s_factorial_value *= s_step + 1.0;
            s_factorial_value *= s_step + 2.0;
            s_result -= hwport_pow(s_radian, s_step + 2.0) / s_factorial_value /* (step+2)! */;
            s_factorial_value *= s_step + 3.0;
        }
    
        return(s_result);
    }
    
    double hwport_sin_v2(double s_radian)
    {
        double s_result;
        double s_factorial_value;
        double s_radian_pow;
        int s_depth;
    
        s_result = s_radian;
        s_factorial_value = 1.0;
        s_radian_pow= s_radian* s_radian* (-1.0);
    
        for(s_depth = 1;s_depth < 13;s_depth++) {
            s_factorial_value *= ((s_depth << 1) * ((s_depth << 1) + 1));
            s_radian*= s_radian_pow;
            s_result += s_radian/ s_factorial_value;
        }
    
        return(s_result);
    }
    
    double hwport_sin(double s_radian)
    {
        return(hwport_sin_v2(s_radian));
    }
    
    double hwport_cos(double s_radian)
    {
        double s_radian_90;
        double s_radian_180;
        double s_radian_270;
    
        s_radian_90 = ((double)def_hwport_pi) / ((double)2.0);
        s_radian_180 = (double)def_hwport_pi;
        s_radian_270 = s_radian_90 + s_radian_180;
    
        if(s_radian <= s_radian_90) {
            return(hwport_sin(s_radian_90 - s_radian));
        }
    
        if(s_radian <= s_radian_180) {
            return(hwport_sin(s_radian - s_radian_90) * ((double)(-1.0)));
        }
    
        if(s_radian <= s_radian_270) {
            return(hwport_sin(s_radian_270 - s_radian) * ((double)(-1.0)));
        }
    
        return(hwport_sin(s_radian - s_radian_270));
    }
    
    double hwport_tan(double s_radian)
    {
        return(hwport_sin(s_radian) / hwport_cos(s_radian));
    }
    



/*
[ FrontPage | PrintView | RawView | RSS ]

Copyright ⓒ MINZKN.COM
All Rights Reserved.

MINZKN
*/