As promised, this week we're building some special trigonometry functions using the functions we wrote last week: versed sine (or versine), coversed sine (or coversine), haversed sine (or haversine), hacoversed sine (or hacoversine), exsecant, and excosecant. Actually, to be honest, only two of those build on the functions from last week.
ASP
function versin(x)versin = 1 - cos(x)end functionfunction coversin(x)coversin = 1 - sin(x)end functionfunction haversin(x)haversin = versin(x) / 2end functionfunction hacoversin(x)hacoversin = coversin(x) / 2end functionfunction exsec(x)exsec = sec(x) - 1end functionfunction excsc(x)excsc = csc(x) - 1end function
PHP
function versin($x){return (1 - cos($x));}function coversin($x){return (1 - sin($x));}function haversin($x){return (versin($x) / 2);}function hacoversin($x){return (coversin($x) / 2);}function exsec($x){return (sec($x) - 1);}function excsc($x){return (csc($x) - 1);}
Next week, the fun continues with inverse trigonometric functions.

No comments:
Post a Comment