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 function
function coversin(x)
coversin = 1 - sin(x)
end function
function haversin(x)
haversin = versin(x) / 2
end function
function hacoversin(x)
hacoversin = coversin(x) / 2
end function
function exsec(x)
exsec = sec(x) - 1
end function
function excsc(x)
excsc = csc(x) - 1
end 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