This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 863
/
herons_formula.html
60 lines (59 loc) · 3.2 KB
/
herons_formula.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<html data-require="math graphie graphie-helpers graphie-geometry math-format">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Heron's formula</title>
<script src="../khan-exercise.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
</div>
<div class="problems">
<div id="simple">
<div class="vars">
<var id="ANGLES">randomTriangleAngles.triangle()</var>
<var id="SIDES"></var>
<var id="S"></var>
<var id="ANS"></var>
<var id="AREA">randRange( 3, 7 ) + random()</var>
<var id="AREA_SHOW">AREA * AREA</var>
</div>
<div class="problem">
What is the area of this triangle? ( Round to two decimal places )
</div>
<div class="question">
<div class="graphie">
init({
range: [ [-1, 12 ], [ -7, 2.5 ] ]
})
var trA = new Triangle( [ 3, -3 ], ANGLES ,AREA, {} );
trA.boxOut( [ [ [ -10, 2.3 ], [ 10, 2.3 ] ] ] , [ 0, -0.7 ] );
trA.boxOut( [ [ [ -1, -10 ], [ -1, 10 ] ] ] , [ 0.7, 0 ] );
trA.boxOut( [ [ [ 11.5, -10 ], [ 11.5, 10 ] ] ] , [ -0.7, 0 ] );
trA.draw();
trA.labels = { "sides" : trA.niceSideLengths };
trA.drawLabels();
SIDES = trA.niceSideLengths;
S = ( ( SIDES[ 0 ] + SIDES[ 1 ] + SIDES[ 2 ] ) / 2 ).toFixed( 2 );
ANS = sqrt(S *( S -SIDES[ 0 ] ) * ( S - SIDES[ 1 ] ) * ( S - SIDES[ 2 ] ) ).toFixed( 2 );
$( "#ans" ).html( ANS ) ;
</div>
</div>
<div class="solution"><div id="ans"></div></div>
<div class="hints">
<p>We know all sides of this triangle, so we can use Heron's formula to calculate the area.</p>
<p>Heron's formula states that the area of a triangle <code>A=\sqrt{s(s-a)(s-b)(s-c)}</code></p>
<p><code>s = \dfrac{ a + b + c }{ 2 }</code></p>
<p><code>s = \dfrac{ <var>SIDES[ 0 ]</var> + <var>SIDES[ 1 ]</var> + <var>SIDES[ 2 ]</var> }{ 2 }</code></p>
<p><code>s = \dfrac{ <var>( SIDES[ 0 ] + SIDES[ 1 ] + SIDES[ 2 ] ).toFixed( 1 )</var> }{ 2 }</code></p>
<p><code>s = <var>S</var></code></p>
<p><code>A = \sqrt{ <var>S</var> \cdot ( <var>S</var> - <var>SIDES[ 0 ]</var> ) \cdot ( <var>S</var> - <var>SIDES[ 1 ]</var> ) \cdot ( <var>S</var> - <var>SIDES[ 2 ]</var> ) }</code></p>
<p><code>A = \sqrt{ <var>S</var> \cdot <var>( S - SIDES[ 0 ] ).toFixed( 2 )</var> \cdot <var>( S - SIDES[ 1 ] ).toFixed( 2 )</var> \cdot <var>( S - SIDES[ 2 ] ).toFixed( 2 )</var> }</code></p>
<p><code>A = <var>ANS</var></code></p>
</div>
</div>
</div>
</div>
</body>
</html>