Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 108 lines (106 sloc) 5.145 kB
b03482a @igorT New exercise for triangle inequalities
igorT authored
1 <!DOCTYPE html>
2 <html data-require="math graphie graphie-helpers math-format graphie-geometry">
3 <head>
4 <meta charset="UTF-8" />
5 <title>Triangle Inequality Theorem</title>
6 <script src="../khan-exercise.js"></script>
7 <script>
8 function randomTriangleWithSides(){
9 var a = KhanUtil.randRange( 25, 150 );
10 var b = KhanUtil.randRange( 25, 180 - a );
11 if ( a + b > 170 ){
12 a = Math.max( 30, a - 15 );
13 b = Math.max( 30, b - 15 );
14 }
15 var c = 180 - a - b;
16 var sa = KhanUtil.randRange( 4, 8 );
17 var sb = sa * Math.sin( b * Math.PI / 180 ) / Math.sin( a * Math.PI / 180 );
18 var sc = sa * Math.sin( c * Math.PI / 180 ) / Math.sin( a * Math.PI / 180 );
19 return [ [ a, b, c] , [ sa.toFixed( 1 ), sb.toFixed( 1 ), sc.toFixed( 1 ) ] ];
20 }
21 </script>
22 </head>
23 <body>
24 <div class="exercise">
25 <div class="vars">
26 <var id="MAIN">randomTriangleWithSides()</var>
27 <var id="HIDDEN">rand( 3 )</var>
28 <var id="ANSWER">MAIN[ 1 ][ HIDDEN ]</var>
29 <var id="KNOWN">MAIN[ 1 ].slice( 0, HIDDEN ).concat( MAIN[ 1 ].slice( HIDDEN + 1 ) )</var>
02e2f9c @beneater Correct triangle_inequality hints
beneater authored
30 <var id="MAX">roundTo( 1, parseFloat( KNOWN[ 0 ] ) + parseFloat( KNOWN[ 1 ] ) )</var>
31 <var id="MIN">roundTo( 1, abs( KNOWN[ 0 ] - KNOWN[ 1 ] ) )</var>
b03482a @igorT New exercise for triangle inequalities
igorT authored
32 </div>
33
34 <div class="problems">
35 <div id="range">
36 <div class="problem">
26b0aff @igorT triangle inequality exercise finished
igorT authored
37 What is the range of possible sizes for side x?
b03482a @igorT New exercise for triangle inequalities
igorT authored
38 </div>
39 <div class="question">
40 <div class="graphie">
41 init({
4dbb802 @igorT polish of geometry
igorT authored
42 range: [ [ -1, 10 ], [ -7.5, 1 ] ]
b03482a @igorT New exercise for triangle inequalities
igorT authored
43 })
b52d800 @coffenbacher Switching to new 'sides' argument for Triangle, in turn improving for…
coffenbacher authored
44 var tr = new Triangle( [ 3, -6.5 ], MAIN[ 0 ], 5, { "sides" : [ HIDDEN !== 2 ? MAIN[ 1 ][ 2 ] : "x", HIDDEN !== 0 ? MAIN[ 1 ][ 0 ] : "x", HIDDEN !== 1 ? MAIN[ 1 ][ 1 ] : "x" ] } );
4dbb802 @igorT polish of geometry
igorT authored
45 tr.boxOut( [ [ [ -1, -10 ], [ -1, 10 ] ] ], [ 1, 0 ] );
46 tr.boxOut( [ [ [ 10, -10 ], [ 10, 10 ] ] ], [ -1, 0 ] );
b03482a @igorT New exercise for triangle inequalities
igorT authored
47 tr.draw();
48 tr.drawLabels();
49 </div>
50 </div>
51 <div class="solution" data-type="multiple">
9ae3477 @beneater Answer for triangle_inequality shouldn't be an equality; fixes #4855
beneater authored
52 <p><span class="sol"><var>MIN</var></span> <code>&lt; x &lt;</code> <span class="sol"><var>MAX</var></span></p>
53 <span class="example">two <em>exact</em> decimals, like <code>0.75</code></span>
b03482a @igorT New exercise for triangle inequalities
igorT authored
54 </div>
55 <div class="hints">
02e2f9c @beneater Correct triangle_inequality hints
beneater authored
56 <p>The triangle inequality theorem states that any side of a triangle is always shorter than the sum of the other two sides.</p>
57 <p>Therefore the the third side must be less than <code><var>KNOWN[ 0 ]</var> + <var>KNOWN[ 1 ]</var> = <var>MAX</var></code></p>
58 <p>By the same theorem, the third side must be also larger than the difference between the other two sides.</p>
59 <p>Therefore the third side must be larger than <code><var>KNOWN[0] &lt; KNOWN[1] ? KNOWN[1] : KNOWN[0]</var> - <var>KNOWN[0] &lt; KNOWN[1] ? KNOWN[0] : KNOWN[1]</var> = <var>MIN</var></code></p>
60 <p>So <code><var>MIN</var> &lt; x &lt; <var>MAX</var></code></p>
b03482a @igorT New exercise for triangle inequalities
igorT authored
61 </div>
62 </div>
cef3c71 @igorT made angle marking appear in similar triangles
igorT authored
63 <div id="possible">
26b0aff @igorT triangle inequality exercise finished
igorT authored
64 <div class="vars">
65 <var id="MAIN">randomTriangleWithSides()</var>
66 <var id="POSSIBLE">( randRange( 0, 1 ) === 0 )</var>
cef3c71 @igorT made angle marking appear in similar triangles
igorT authored
67 </div>
b03482a @igorT New exercise for triangle inequalities
igorT authored
68 <div class="problem">
26b0aff @igorT triangle inequality exercise finished
igorT authored
69 Can this triangle exist?
b03482a @igorT New exercise for triangle inequalities
igorT authored
70 </div>
71 <div class="question">
9ae3477 @beneater Answer for triangle_inequality shouldn't be an equality; fixes #4855
beneater authored
72 <div class="graphie">
b03482a @igorT New exercise for triangle inequalities
igorT authored
73 init({
4dbb802 @igorT polish of geometry
igorT authored
74 range: [ [-1, 10 ], [ -7.5, 1 ] ]
b03482a @igorT New exercise for triangle inequalities
igorT authored
75 })
26b0aff @igorT triangle inequality exercise finished
igorT authored
76 if( !POSSIBLE ){
77 var side = randRange( 0, 2 );
4dbb802 @igorT polish of geometry
igorT authored
78 var sideValue = ( parseFloat( MAIN[ 1 ][ ( side + 1 ) % 3 ] ) + parseFloat( MAIN[ 1 ][ ( side + 2 ) % 3 ] ) + randRange( 1, 3 ) ).toFixed( 1 );
26b0aff @igorT triangle inequality exercise finished
igorT authored
79 MAIN[ 1 ][ side ] = sideValue;
80 }
b52d800 @coffenbacher Switching to new 'sides' argument for Triangle, in turn improving for…
coffenbacher authored
81 var tr = new Triangle( [ 3, -6.9 ], MAIN[ 0 ], 5, { "sides" : [ MAIN[ 1 ][ 2 ], MAIN[ 1 ][ 0 ], MAIN[ 1 ][ 1 ] ] } );
4dbb802 @igorT polish of geometry
igorT authored
82 tr.boxOut( [ [ [ -1, -10 ], [ -1, 10 ] ] ], [ 1, 0 ] );
83 tr.boxOut( [ [ [ 10, -10 ], [ 10, 10 ] ] ], [ -1, 0 ] );
b03482a @igorT New exercise for triangle inequalities
igorT authored
84 tr.draw();
85 tr.drawLabels();
86 </div>
87 </div>
26b0aff @igorT triangle inequality exercise finished
igorT authored
88 <div class="solution"><var>POSSIBLE ? "Yes" : "No"</var></div>
89 <ul class="choices" data-category="true">
90 <li>Yes</li>
91 <li>No</li>
92 </ul>
b03482a @igorT New exercise for triangle inequalities
igorT authored
93 <div class="hints">
26b0aff @igorT triangle inequality exercise finished
igorT authored
94 <p>Triangle inequality theorem states that a side must be smaller than the sum of the other two sides.</p>
70a19b7 @coffenbacher Typo fix in triangle inequality
coffenbacher authored
95 <p>Let's check for all three sides:</p>
26b0aff @igorT triangle inequality exercise finished
igorT authored
96 <div data-each="MAIN[ 1 ] as i, v">
9ae3477 @beneater Answer for triangle_inequality shouldn't be an equality; fixes #4855
beneater authored
97 <p><code><var>MAIN[ 1 ][ i ]</var> + <var>MAIN[ 1 ][ ( i + 1 ) % 3 ]</var> = <var>( parseFloat( MAIN[ 1 ][ i ] ) + parseFloat( MAIN[ 1 ][ ( i + 1 ) % 3 ] ) ).toFixed( 1 )</var></code></p>
98 <p><code><var>MAIN[ 1 ][ ( i + 2 ) % 3 ]</var></code> is <span data-if="parseFloat( MAIN[ 1 ][ ( i + 2 ) % 3 ] ) >= ( parseFloat( MAIN[ 1 ][ i ] ) + parseFloat( MAIN[ 1 ][ ( i + 1 ) % 3 ] ) ) ">not</span> smaller than <code><var>( parseFloat( MAIN[ 1 ][ i ] ) + parseFloat( MAIN[ 1 ][ ( i + 1 ) % 3 ] ) ).toFixed( 1 )</var></code> so the theorem <span data-if="parseFloat( MAIN[ 1 ][ ( i + 2 ) % 3 ] ) >= ( parseFloat( MAIN[ 1 ][ i ] ) + parseFloat( MAIN[ 1 ][ ( i + 1 ) % 3 ] ) )">does not hold</span><span data-else>holds</span>.</p>
26b0aff @igorT triangle inequality exercise finished
igorT authored
99 </div>
100 <p data-if="POSSIBLE">All three sides conform to the inequality theorem, so this triangle can exist.</p>
101 <p data-else>Not all three sides conform to the inequality theorem, so this triangle cannot exist.</p>
b03482a @igorT New exercise for triangle inequalities
igorT authored
102 </div>
103 </div>
104 </div>
8531c06 @spicyj triangle_inequality fixes
spicyj authored
105 </div>
b03482a @igorT New exercise for triangle inequalities
igorT authored
106 </body>
107 </html>
Something went wrong with that request. Please try again.