View Full Version : trigonometrical functions

Jan 22nd, 2004, 04:19 PM
it could just be my computer being weird. i made this script last night and it always yields completely wrong output.

n = new Array(0,1,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,89,90);
document.write("<table border cols=1 width=60%><th>Angle</th><th>Sine</th><th>Cosine</th><th>Tangent</th>");
for (i=0;i<n.length;i++) {
a = n[i];
s = Math.sin(a);
c = Math.cos(a);
t = Math.tan(a);
document.write("<tr><td width=5%>" + a + "</td>");
document.write("<td>" + s + "</td>");
document.write("<td>" + c + "</td>");
document.write("<td>" + t + "</td></tr>");

Jan 22nd, 2004, 04:32 PM
I'm not sure, but I think the mathematical functionsin general works on radians and not degrees. Radians are far more useful mathamatically speaking, degrees or grades (new grades?) are just for making it easier/more practical for humans to work with. So, divide by 180 and multiply by pi, and see if that doesn't make more sense.

Jan 22nd, 2004, 04:34 PM
ooh! thank you. i didn't take that into consideration.