publicKhan/khan-exercises

Subversion checkout URL

You can clone with HTTPS or Subversion.

Older
100644 106 lines (105 sloc) 4.929 kb
 ``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 1 2 3 4 5 Triangle Inequality Theorem 6 7 22 23 24
25
26 randomTriangleWithSides() 27 rand( 3 ) 28 MAIN[ 1 ][ HIDDEN ] 29 MAIN[ 1 ].slice( 0, HIDDEN ).concat( MAIN[ 1 ].slice( HIDDEN + 1 ) ) ``` 92d6acdc » igorT ``` 2011-09-17 fix #2801 30 ( parseFloat( KNOWN[ 0 ] ) + parseFloat( KNOWN[ 1 ] ) ).toFixed( 1 ) ``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 31 Math.abs( KNOWN[ 0 ] - KNOWN[ 1 ] ).toFixed( 1 ) 32
33 34
35
36
``` 26b0aff0 » igorT ``` 2011-09-13 triangle inequality exercise finished 37 What is the range of possible sizes for side x? ``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 38
39
40
41 init({ ``` 4dbb802e » igorT ``` 2011-09-16 polish of geometry 42 range: [ [ -1, 10 ], [ -7.5, 1 ] ] ``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 43 }) ``` cef3c713 » igorT ``` 2011-09-15 made angle marking appear in similar triangles 44 var tr = new Triangle( [ 3, -6.5 ], MAIN[ 0 ], 5, { "c" : HIDDEN !== 2 ? MAIN[ 1 ][ 2 ] : "x" , "a" : HIDDEN !== 0 ? MAIN[ 1 ][ 0 ] : "x" , "b" : HIDDEN !== 1 ? MAIN[ 1 ][ 1 ] : "x" } ); ``` 4dbb802e » igorT ``` 2011-09-16 polish of geometry 45 tr.boxOut( [ [ [ -1, -10 ], [ -1, 10 ] ] ], [ 1, 0 ] ); 46 tr.boxOut( [ [ [ 10, -10 ], [ 10, 10 ] ] ], [ -1, 0 ] ); ``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 47 tr.draw(); 48 tr.drawLabels(); 49
50
51
52

Maximum = MAX

53

Minimum = MIN

54
55
56

Triangle inequality theorem states that a side cannot be larger than the sum of the other two sides.

``` 26b0aff0 » igorT ``` 2011-09-13 triangle inequality exercise finished 57

Therefore the the third side cannot be larger than KNOWN[ 0 ] + KNOWN[ 1 ] = MAX

58

By the same theorem, the side can also not be smaller than the difference between the two sides.

59

Therefore the third side cannot be smaller than | KNOWN[ 0 ] - KNOWN[ 1 ] | = MIN

``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 60
61
``` cef3c713 » igorT ``` 2011-09-15 made angle marking appear in similar triangles 62
``` 26b0aff0 » igorT ``` 2011-09-13 triangle inequality exercise finished 63
64 randomTriangleWithSides() 65 ( randRange( 0, 1 ) === 0 ) ``` cef3c713 » igorT ``` 2011-09-15 made angle marking appear in similar triangles 66
``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 67
``` 26b0aff0 » igorT ``` 2011-09-13 triangle inequality exercise finished 68 Can this triangle exist? ``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 69
70
71
72 init({ ``` 4dbb802e » igorT ``` 2011-09-16 polish of geometry 73 range: [ [-1, 10 ], [ -7.5, 1 ] ] ``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 74 }) ``` 26b0aff0 » igorT ``` 2011-09-13 triangle inequality exercise finished 75 if( !POSSIBLE ){ 76 var side = randRange( 0, 2 ); ``` 4dbb802e » igorT ``` 2011-09-16 polish of geometry 77 var sideValue = ( parseFloat( MAIN[ 1 ][ ( side + 1 ) % 3 ] ) + parseFloat( MAIN[ 1 ][ ( side + 2 ) % 3 ] ) + randRange( 1, 3 ) ).toFixed( 1 ); ``` 26b0aff0 » igorT ``` 2011-09-13 triangle inequality exercise finished 78 MAIN[ 1 ][ side ] = sideValue; 79 } ``` 4dbb802e » igorT ``` 2011-09-16 polish of geometry 80 var tr = new Triangle( [ 3, -6.9 ], MAIN[ 0 ], 5, { "c" : MAIN[ 1 ][ 2 ], "a" : MAIN[ 1 ][ 0 ] , "b" : MAIN[ 1 ][ 1 ] } ); 81 tr.boxOut( [ [ [ -1, -10 ], [ -1, 10 ] ] ], [ 1, 0 ] ); 82 tr.boxOut( [ [ [ 10, -10 ], [ 10, 10 ] ] ], [ -1, 0 ] ); ``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 83 tr.draw(); 84 tr.drawLabels(); 85
86
``` 26b0aff0 » igorT ``` 2011-09-13 triangle inequality exercise finished 87
POSSIBLE ? "Yes" : "No"
88
89
• Yes
• 90
• No
• 91
``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 92
``` 26b0aff0 » igorT ``` 2011-09-13 triangle inequality exercise finished 93

Triangle inequality theorem states that a side must be smaller than the sum of the other two sides.

94

Lets check for all three sides:

95
96

MAIN[ 1 ][ i ] + MAIN[ 1 ][ ( i + 1 ) % 3 ] = ( parseFloat( MAIN[ 1 ][ i ] ) + parseFloat( MAIN[ 1 ][ ( i + 1 ) % 3 ] ) ).toFixed( 1 )

97

MAIN[ 1 ][ ( i + 2 ) % 3 ] is not smaller than ( parseFloat( MAIN[ 1 ][ i ] ) + parseFloat( MAIN[ 1 ][ ( i + 1 ) % 3 ] ) ).toFixed( 1 ) so the theorem does not holdholds.

98
99

All three sides conform to the inequality theorem, so this triangle can exist.

100

Not all three sides conform to the inequality theorem, so this triangle cannot exist.

``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 101
102
103
``` 8531c068 » spicyj ``` 2011-09-03 triangle_inequality fixes 104
``` b03482a7 » igorT ``` 2011-09-02 New exercise for triangle inequalities 105 106
Something went wrong with that request. Please try again.