SRL Archive - Other Scripts

Sdcits Wierd Stuff


Sdcit

2006-03-30 00:22:41

3/29/06
My homework used the Hero’s formula, so I decided to make a script for it :p


What it does: Calculates Area of Triangle given 3 side lengths
Proof:

We use the formula area = (1/2)bc.sin(A)

And sin(A) = 2 sin(A/2).cos(A/2) so area = bc.sin(A/2).cos(A/2)

Next we find expressions for cos(A/2) and sin(A/2) in terms of
s, a, b, c, where a, b, c are the sides of the triangle and s is
the semi-perimeter.

So s = (a+b+c)/2

b^2 + c^2 - a^2
cos(A) = 2cos^2(A/2) - 1 = ----------------
2bc


b^2 + c^2 - a^2
2cos^2(A/2) = 1 + ------------------
2bc


(b+c)^2 - a^2 (b+c-a)(b+c+a)
= -------------- = --------------
2bc 2bc

(2s-2a)2s
= -----------
2bc

s(s-a)
cos^2(A/2) = ---------
bc

b^2 + c^2 - a^2
Next cos(A) = 1 - 2 sin^2(A/2) = ----------------
2bc

b^2 + c^2 - a^2
2sin^2(A/2) = 1 - ----------------
2bc

a^2 - (b-c)^2 (a-b+c)(a+b-c)
= -------------- = --------------
2bc 2bc

(2s-2b)(2s-2c)
= --------------
2bc

(s-b)(s-c)
sin^2(A/2) = ------------
bc

We can now return to the formula for the area of the triangle:

(1/2)bc.sin(A) = bc.sin(A/2).cos(A/2)

bc.sqrt[s(s-a)(s-b(s-c)]
= ------------------------
bc

= sqrt[s(s-a)(s-b)(s-c)]



Script attached, Herons

WhiteShadow

2006-03-30 00:29:33

I'm impressed. Such math from a 7th grader. I just learned about Tangent, Cosine, Sine a few months ago.

Sdcit

2006-03-30 00:39:40

it isnt too advanced except for the proof, we need it for plane geometry and the trigonometry were learning right now

Pyro

2006-03-30 00:49:28

Gah seems like sine is stil easier to me. You would never really use this in real world. so when you are using it in maths class or wherever you will most likely have a calculater to do sine. And even if you dont. I have sine tables inscribed on underside of my eyelids

Sdcit

2006-03-30 00:53:06

Gah, doing that takes time and you have to drop the line. This is for ALL triangles. :p I use this so i dont drop the hight, but yes, some times it doesnt have all 3 sides :p

Pwnd

2006-03-30 00:58:12

From: Pyro
And even if you dont. I have sine tables inscribed on underside of my eyelids

Did it hurt?

WhiteShadow

2006-03-30 01:01:30

I went on a Field Trip to KNotts the other day. We had to use this method to get the height of the Roller Costers and other rides. Haha My buddies split and we each did one thing met up in one place, copied each other and got it done in 35 minutes. :p

Then I got to ride roller coasters with my girlfriend and all my buddies. Was a moment worth remembering. We might do this again this spring break, to disney though. No teachers and math shit. My dad ain't going to be home either. W00t. I'll have to start bribing my cousins to drive us. Pleh I wish I could drive. :cool:

Krazy_Meerkat

2006-03-30 03:53:25

Good work sdcit! Do you know anything about simultaneous equations? I'd like to see a script which worked out the side lengths of a rectangle given the perimeter and area.