# Khan/khan-exercises

Switch branches/tags
Nothing to show
Fetching contributors…
Cannot retrieve contributors at this time
304 lines (276 sloc) 13.2 KB
 Perimeter 1
randFromArray(metricUnits.concat([genericUnit]))
randRange(2, 9) i18n._("perimeter")

What is the perimeter of the square?

init({ range: [[-2, S + 1], [-1, S + 2]], scale: 30 }); path([[0, 0], [0, S], [S, S], [S, 0], true], {stroke: BLUE, fill: "#eee"}); label([S / 2, S], S + "\\text{ " + UNIT + "}", "above"); label([0, S / 2], S + "\\text{ " + UNIT + "}", "left");
4 * S plural_form(UNIT_TEXT)

The perimeter is the total length of all the sides of the shape added together.

path([[0, 0], [0, S]], { strokeWidth: 4, stroke: PINK }); path([[0, S], [S, S]], { strokeWidth: 4, stroke: BLUE }); path([[S, S], [S, 0]], { strokeWidth: 4, stroke: "purple" }); path([[S, 0], [0, 0]], { strokeWidth: 4, stroke: GREEN });

Add up the lengths of the sides:

\qquad\text{PERIMETER} = \pink{S} + \blue{S} + \purple{S} + \green{S}

\qquad\text{PERIMETER} = S * 4\text{ UNIT}

randRange(2, 9) randRange(2, 9) i18n._("perimeter")

What is the perimeter of the rectangle?

init({ range: [[-2, L + 1], [-1, W + 2]], scale: 30 }); path([[0, 0], [0, W], [L, W], [L, 0], true], {stroke: BLUE, fill: "#eee"}); label([L / 2, W], L + "\\text{ " + UNIT + "}", "above"); label([0, W / 2], W + "\\text{ " + UNIT + "}", "left");
L * 2 + W * 2 plural_form(UNIT_TEXT)

The perimeter is the total length of all the sides of the shape added together.

path([[0, 0], [0, W]], { strokeWidth: 4, stroke: PINK }); path([[0, W], [L, W]], { strokeWidth: 4, stroke: BLUE }); path([[L, W], [L, 0]], { strokeWidth: 4, stroke: "purple" }); path([[L, 0], [0, 0]], { strokeWidth: 4, stroke: GREEN });

Add up the lengths of the sides:

\qquad\text{PERIMETER} = \pink{W} + \blue{L} + \purple{W} + \green{L}

\qquad\text{PERIMETER} = L * 2 + W * 2\text{ UNIT}

randRange(2, 9, 3) ((A * A + B * B - C * C) / (2 * A * B)) * B sqrt(B * B - X * X) i18n._("perimeter")

What is the perimeter of the triangle?

init({ range: [[min(X, 0) - 2, max(X, A) + 2], [-1, Y + 2]], scale: 30 }); path([[0, 0], [A, 0], [X, Y], true], {stroke: BLUE, fill: "#eee"}); label([A / 2, 0], A + "\\text{ " + UNIT + "}", "below"); label([X / 2 - 0.5, Y / 2], B + "\\text{ " + UNIT + "}", "left"); label([(X + A) / 2 + 0.5, Y / 2], C + "\\text{ " + UNIT + "}", "right");
A + B + C plural_form(UNIT_TEXT)

The perimeter is the total length of all the sides of the shape added together.

path([[X, Y], [0, 0]], { strokeWidth: 4, stroke: PINK }); path([[A, 0], [X, Y]], { strokeWidth: 4, stroke: BLUE }); path([[0, 0], [A, 0]], { strokeWidth: 4, stroke: GREEN });

Add up the lengths of the sides:

\qquad\text{PERIMETER} = \pink{B} + \blue{C} + \green{A}

\qquad\text{PERIMETER} = A + B + C\text{ UNIT}

randRange(2, 3) randFromArray([ [5, i18n._("pentagon")], [6, i18n._("hexagon")], [8, i18n._("octagon")] ]) (2 * PI) / SIDES S / (2 * sin(PI / SIDES)) S / (2 * tan(PI / SIDES)) i18n._("perimeter")

What is the perimeter of the regular POLYGON?

init({ range: [[-RADIUS - 1, RADIUS + 1], [-RADIUS - 1, RADIUS + 2]], scale: 30 }); graph.path = []; _(SIDES).times(function(n) { graph.path.push([sin(ANGLE * (n + 0.5)) * RADIUS, cos(ANGLE * (n + 0.5)) * RADIUS]); }); graph.path.push(true); path(graph.path, {stroke: BLUE, fill: "#eee"}); graph.label = label([0, APOTHEM + 0.7], S + "\\text{ " + UNIT + "}");
S * SIDES plural_form(UNIT_TEXT)

The perimeter is the total length of all the sides of the shape added together.

graph.label.remove(); _(SIDES).times(function(n) { label([sin(ANGLE * n) * (APOTHEM + 0.7), cos(ANGLE * n) * (APOTHEM + 0.7)], S + "\\text{ " + UNIT + "}", {color: GREEN}); });

All of the sides of a regular POLYGON are the same length.

Saying a polygon is regular just means the sides are all the same.

Since there are SIDES sides that are all S plural_form(UNIT_TEXT, S) long, we can multiply:

\qquad\text{PERIMETER} = S * SIDES\text{ UNIT}

randRange(5, 10) randRange(5, 10) createOddShape({ width: WIDTH, height: HEIGHT }) SHAPE.sides

What is the perimeter of the shape? Each square in the grid is a 1 \times 1 UNIT_TEXT square.

init({ range: [[-1, WIDTH + 1], [-1, HEIGHT + 1]] }); var shape = []; _(WIDTH + 1).times(function(i) { line([i, 0], [i, HEIGHT], { "stroke-width": 1, stroke: "#bbb" }); }); _(HEIGHT + 1).times(function(i) { line([0, i], [WIDTH, i], { "stroke-width": 1, stroke: "#bbb" }); }); _.each(SHAPE.sides, function(side) { path([side.start, side.end], {stroke: BLUE}); });
SHAPE.perimeter plural_form(UNIT_TEXT)

The perimeter is the total length of all the sides of the shape added together.

SHAPE.labelSides();

Add up the lengths of all SHAPE.numSides sides.

\qquad _.map(SHAPE.sides, function(v) { return v.length; }).join("+") = \text{ ?}

The perimeter is SHAPE.perimeter plural_form(UNIT_TEXT, SHAPE.perimeter).