UNPKG

algebrite

Version:

Computer Algebra System in Coffeescript

114 lines (77 loc) 1.34 kB
test_tan = -> run_test [ "tan(x)", "tan(x)", "tan(-x)", "-tan(x)", "tan(b-a)", "-tan(a-b)", # check against the floating point math library "f(a,x)=1+tan(float(a/360*2*pi))-float(x)+tan(a/360*2*pi)-x", "", "f(0,0)", # 0 "1", "f(180,0)", # 180 "1", "f(360,0)", # 360 "1", "f(-180,0)", # -180 "1", "f(-360,0)", # -360 "1", "f(45,1)", # 45 "1", "f(135,-1)", # 135 "1", "f(225,1)", # 225 "1", "f(315,-1)", # 315 "1", "f(-45,-1)", # -45 "1", "f(-135,1)", # -135 "1", "f(-225,-1)", # -225 "1", "f(-315,1)", # -315 "1", "f(30,sqrt(3)/3)", # 30 "1", "f(150,-sqrt(3)/3)", # 150 "1", "f(210,sqrt(3)/3)", # 210 "1", "f(330,-sqrt(3)/3)", # 330 "1", "f(-30,-sqrt(3)/3)", # -30 "1", "f(-150,sqrt(3)/3)", # -150 "1", "f(-210,-sqrt(3)/3)", # -210 "1", "f(-330,sqrt(3)/3)", # -330 "1", "f(60,sqrt(3))", # 60 "1", "f(120,-sqrt(3))", # 120 "1", "f(240,sqrt(3))", # 240 "1", "f(300,-sqrt(3))", # 300 "1", "f(-60,-sqrt(3))", # -60 "1", "f(-120,sqrt(3))", # -120 "1", "f(-240,-sqrt(3))", # -240 "1", "f(-300,sqrt(3))", # -300 "1", "f=quote(f)", "", "tan(arctan(x))", "x", # check the default case "tan(1/12*pi)", "tan(1/12*pi)", ]