Talk:Trigonometry Functions

From the Oblivion ConstructionSet Wiki
Revision as of 11:06, 10 May 2006 by imported>JustTim (Comment on Stage Functions)
Jump to navigation Jump to search

Creating a Trig Category

I'd love someone forever if they switched this article to a category and made a separate article for each of these. Not too much work, but I'm conversioned out right now...--DragoonWraith 21:58, 9 May 2006 (EDT)

The Stage Function thing

Completely replacing all trig functions with the stage function version seems to be a little extreme. Stage Functions are a good thing, but not everyone might want to use them. Furthermore the non-stage-functions might be a little easier to read. I think it would be best to leave the Trigonometry thread with non-stage functions and add those as an option instead. Yes, thats very redundant, but some people might feel patronised otherwise... and there is nothing we need less than anger on this wiki. :) It'd be good to hear the opinion of others about this. --JustTim 12:06, 10 May 2006 (EDT)

Removed Sections

I see no reason for three versions of the Taylor series, and this one is, to me, the most difficult to read. If it has merit, re-add it to the main article, though it must be formatted for being a Stage Function.--DragoonWraith 20:35, 9 May 2006 (EDT)

Taylor Series Variant 3

The idea here is to approximate sin(z) and cos(z) with taylor. Since taylor works best with values close to 0, I think it's a good idea to use sin and cos periodicity as many times as possible. then I used taylor to approximate the functions. (Scripts by bifmadeinsabbioni)

ScriptName Sin(Z)
set Angolo to AngleZ ; Angolo is the angle of which we want to calculate the sin
set Sign to 1 ; it's the sign adjustment of the result 

if (Angolo < 0) ; sin(-z) = -sin(z) 
       set Angolo to Angolo * (-1)
       set Sign to Sign * (-1)
endif

if (Angolo > 180)&& (Angolo <=360) ; if 180<=z<=360 sin(z) = -sin(z-180)
	set Sign to Sign * (-1)
	set Angolo to (Angolo - 180)
endif
 
if (Angolo > 90)&&(Angolo <=180) ; if 90<=z<=180 sin (z) = sin (180-z)
	set Angolo to (180 - angolo)
endif

if (Angolo >45)&&(Angolo <=90) ; if 45<z<90 sin(z) = cos(90-z)
	set Angle to (90 - Angolo)
     	set Angle to (3.14159265 * Angle / 180) ;now in radiants
	set X2 to Angle * Angle
	set X4 to X2 * X2
	set X6 to X4 * X2
	set X8 to X4 * X4
	set SinZ to (1 - X2 / 2 + X4 / 24 - X6 / 720 + X8 / 40320)
	set SinZ to SinZ*Sign
endif

if (Angolo>=0)&&(Angolo<=45)
	set Angle to Angolo
     	set Angle to (3.14159265 * Angle / 180) ;now in radiants
	set X to Angle
	set X3 to X*X*X
	set X5 to X3*X*X
	set X7 to X3*X3*X
	set X9 to X3*X3*X3
	set SinZ to (X - X3 / 6 + X5 / 120 - X7 / 5040 + X9 / 362880)
	set SinZ to SinZ*Sign
endif
ScriptName Cos(Z)
set Angolo to AngleZ ; Angolo is the angle of which we want to calculate the cos
set Sign to 1 ; it's the sign adjustment of the result 
 
if (Angolo < 0) ; cos(-z) = cos(z) 
       set Angolo to Angolo * (-1)
endif

if (Angolo > 180)&& (Angolo <=360) ; if 180<=z<=360 cos(z) = -cos(z-180)
	set Sign to Sign * (-1)
	set Angolo to (Angolo - 180)
endif

if (Angolo > 90)&&(Angolo <=180)   ; if 90<=z<=180 cos (z) = -cos(180-z)
	set Angolo to (180 - Angolo)
	set Sign to Sign * (-1)
endif

if (Angolo >45)&&(Angolo <=90) if 45<z<90 cos(z) = sin(90-z)
	set Angle to (90 - Angolo)
     	set Angle to (3.14159265 * Angle / 180) ;now in radiants
	set X to Angle
	set X3 to X*X*X
	set X5 to X3*X*X
	set X7 to X3*X3*X
	set X9 to X3*X3*X3
	set CosZ to (X - X3 / 6 + X5 / 120 - X7 / 5040 + X9 / 362880)
	set CosZ to CosZ * Sign
endif

if (Angolo>=0)&&(Angolo<=45)
	set Angle to Angolo
     	set Angle to (3.14159265 * Angle / 180) ;now in radiants
	set X2 to Angle * Angle
	set X4 to X2 * X2
	set X6 to X4 * X2
	set X8 to X4 * X4
	set CosZ to (1 - X2 / 2 + X4 / 24 - X6 / 720 + X8 / 40320)
	set CosZ to CosZ * Sign
endif