Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 58 lines (57 sloc) 2.928 kb
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
<!DOCTYPE html>
<html data-require="math">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Significant figures</title>
    <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
    <div class="vars">
        <var id="LEADING"> Array( randRange( 0, 2 ) ).join( '0' ) </var>
        <var id="RIGHTLEADING"> Array( randRange( 0, 2) ).join( '0' ) </var>
        <var id="TRAILING"> Array( randRange( 0, 4 ) ).join( '0' ) </var>
        <var id="IS_ZERO"> random() &gt; 0.5 </var>
        <var id="HAS_DOT"> IS_ZERO ? true : random() &gt; 0.5 </var>
        <var id="RIGHTSIDE"> randRange( 1, 9, randRange( 1, 6 ) ).join('') </var>
        <var id="LEFTSIDE"> IS_ZERO ? '0' : randRange( 1, 9, randRange( 1, 4 ) ).join('') </var>
        <var id="TOTAL"> HAS_DOT ?
            LEADING + LEFTSIDE + '.' + RIGHTLEADING + RIGHTSIDE + TRAILING :
            LEADING + LEFTSIDE + TRAILING </var>
        <var id="SOLUTION"> IS_ZERO ?
            RIGHTSIDE.length + TRAILING.length :
            HAS_DOT ?
                LEFTSIDE.length + RIGHTLEADING.length + RIGHTSIDE.length + TRAILING.length :
                LEFTSIDE.length </var>
        <var id="PROPER_LEADING"> IS_ZERO ? LEADING + LEFTSIDE + '.' + RIGHTLEADING : LEADING </var>
        <var id="INBETWEEN"> IS_ZERO ? RIGHTSIDE : HAS_DOT ?
            LEFTSIDE + '.' + RIGHTLEADING + RIGHTSIDE : LEFTSIDE </var>
    </div>
    <div class="problems">
        <div>
            <p class="question">How many significant figures does <code><var>TOTAL</var></code> have?</p>
            <p class="solution" data-forms="integer"><var>SOLUTION</var></p>
        </div>
    </div>
    <div class="hints">
        <div>
            <p>Identify the non-zero digits and any zeros between them. These are all significant.</p>
            <p><code><var>PROPER_LEADING</var>\color{blue}{<var>INBETWEEN</var>}<var>TRAILING</var></code></p>
        </div>
        <div data-if="PROPER_LEADING.length > 0">
            <p>Leading zeros are not significant.</p>
            <p><code>\color{orange}{<var>PROPER_LEADING</var>}\color{blue}{<var>INBETWEEN</var>}<var>TRAILING</var></code></p>
        </div>
        <div data-if="TRAILING.length > 0 && HAS_DOT">
            <p>Since there is a decimal, trailing zeros are significant.</p>
            <p><code>\color{orange}{<var>PROPER_LEADING</var>}\color{blue}{<var>INBETWEEN</var><var>TRAILING</var>}</code></p>
        </div>
        <div data-if="TRAILING.length > 0 && !HAS_DOT">
            <p>Since there is no decimal, trailing zeros are not significant.</p>
            <p><code>\color{orange}{<var>PROPER_LEADING</var>}\color{blue}{<var>INBETWEEN</var>}\color{orange}{<var>TRAILING</var>}</code></p>
        </div>
        <p>Counting all the significant digits gives us <var>SOLUTION</var>.</p>
    </div>
</div>
</body>
</html>
Something went wrong with that request. Please try again.