Programmers Are Lazy
I was just doing my math homework a few minutes ago. Hero's and Brahmagupta's formulas. If you're familiar with either of them, you'll know that it's a real pain to use either of them, even with a calculator. The number of keystrokes required numbers in the thirties. I realized this when I started the homework. So, I devised a shortcut.
You know how TI's have their own built in language? I implemented Brahmagupta's formula, Hero's formula, and the distance formula in that language on my calculator. Now, it takes me less that seven keystrokes to get the answer I want. Here are the programs for you to enter on you calculator and enjoy the benefit of solving Hero and Brahmagupta problems in ten seconds flat.
Hero's formula:
Prompt A
Prompt B
Prompt C
(A+B+C)/2 -> X
Sqrt(X(X-A)(X-B)(X-C)) -> Y
Disp Y
"Sqrt", of course, denotes the square root sign.
Brahmagupta's formula:
Prompt A
Prompt B
Prompt C
Prompt D
(A+B+C+D)/2 -> X
Sqrt((X-A)(X-B)(X-C)(X-D)) -> Y
Disp Y
The distance formula:
Prompt X
Prompt W
Prompt Y
Prompt Z
Sqrt((X-W)^2+(Y-Z)^2) -> A
Disp A
W is the second X value and Z is the second Y value.
May you save many hours on your math homework henceforth.
Listening to Slayer. Reading Drew Carpyshyn.
[END]

