Awkwardsaw
2009-07-14 07:22:06
im bored, and i figured i would do some math stuff, since its just so gosh dang fun :p
the first function says if the triangle is acute, right, or obtuse based off of the sides, and the second one solves the sides of a RIGHT triangle(leave the side you dont know as what ever you want). i might make sin cos and tan stuff, but those where my weak spots in school =\
and if you don't remember, a = long leg, b = short leg, and c = hypotenuses
the solveside uses either sin, cos, or tan, and a side length to find the measurement of the other unknown side. what you use is up to you, but you have to do it correctly, as in get the correct sin/cos/tan value, and side measure. remember, the trig values are in DEGREES not radians.
the areoftri solves the area of a triangle. either equilateral or other(every other type of triangle, based off of sides).
i tested all of these using the theorem and properties that i remember, so if they aren't correct post here. although they do work
enjoy :p
the first function says if the triangle is acute, right, or obtuse based off of the sides, and the second one solves the sides of a RIGHT triangle(leave the side you dont know as what ever you want). i might make sin cos and tan stuff, but those where my weak spots in school =\
and if you don't remember, a = long leg, b = short leg, and c = hypotenuses
the solveside uses either sin, cos, or tan, and a side length to find the measurement of the other unknown side. what you use is up to you, but you have to do it correctly, as in get the correct sin/cos/tan value, and side measure. remember, the trig values are in DEGREES not radians.
the areoftri solves the area of a triangle. either equilateral or other(every other type of triangle, based off of sides).
function TriAngType(a, b, c: extended): string;
begin
if a + b <= c then
begin
writeln('Wrong Triangle side measures');
exit;
end;
if Sqr(a) + sqr(b) > sqr(c) then result:= 'acute';
if Sqr(a) + sqr(b) = sqr(c) then result:= 'right';
if Sqr(a) + sqr(b) < sqr(c) then result:= 'obtuse';
end;
function RightTriSideMeasure(a, b, c: extended; sidetosolve: string; showwork: boolean): extended;
begin
case lowercase(sidetosolve) of
'a': begin
if showwork then
begin
writeln(floattostr(c) + '^2 = ' + floattostr(b) + '^2 + a^2');
writeln(floattostr(Sqr(c)) + ' = ' + floattostr(Sqr(b)) + ' + a^2');
writeln(floattostr(Sqr(c) - Sqr(b)) + ' = a^2');
writeln(floattostr(sqrt((Sqr(c)) - (sqr(b)))) + ' = a');
end;
result:= sqrt((Sqr(c)) - (sqr(b)));
end;
'b': begin
if showwork then
begin
writeln(floattostr(c) + '^2 = b^2 + ' + floattostr(a) + '^2');
writeln(floattostr(Sqr(c)) + ' = b^2 + ' + floattostr(Sqr(a)));
writeln(floattostr(Sqr(c) - Sqr(a)) + ' = b^2');
writeln(floattostr(sqrt((Sqr(c)) - (sqr(a)))) + ' = b');
end;
result:= sqrt((Sqr(c)) - (sqr(a)));
end;
'c': begin
if showwork then
begin
writeln('c^2 = ' + floattostr(b) + '^2 + ' + floattostr(a) + '^2');
writeln('c^2 = ' + floattostr(sqr(b)) + ' + ' + floattostr(sqr(a)));
writeln('c^2 = ' + floattostr(sqr(b) + sqr(a)));
writeln('c = ' + floattostr(sqrt(Sqr(a) + sqr(b))));
end;
result:= sqrt(Sqr(a) + sqr(b));
end;
end;
end;
function solveside(sincostannum, l: extended): extended;
var a, b: extended;
begin
a:= sincostannum;
b:= l;
result:= (a * b) * 2;
end;
function AreaOfTri(typeoftri: string; side1, side2: extended):extended;
begin
case lowercase(typeoftri) of
'equilateral': result:= (sqr(side1) * sqrt(3)) / 4;
'other': result:= ((side1 * side2) / 2);
end;
end;i tested all of these using the theorem and properties that i remember, so if they aren't correct post here. although they do work
enjoy :p