# Khan/khan-exercises

Switch branches/tags
Nothing to show
Fetching contributors…
Cannot retrieve contributors at this time
201 lines (189 sloc) 8.75 KB
 Finding perimeter
randFromArray(metricUnits.concat([genericUnit]))
randRange(1, 8) i18n._("perimeter")

One side of a square is S UNIT_TEXT long. What is its perimeter? One side of a square is S plural_form(UNIT_TEXT, S) long. What is its perimeter?

4 * S plural_form(UNIT_TEXT)
init({ range: [[-1, 6], [-1, 6]] }); path([[0, 0], [5, 0], [5, 5], [0, 5], true], { stroke: BLUE, fill: "#eee" }); path([[0, 0], [0, 5]], { "stroke": PINK }); label([0, 2.5], S + "\\text{ " + UNIT + "}", "left", { "color": PINK });

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

path([[0, 0], [0, 5]], { strokeWidth: 4, stroke: PINK }); path([[0, 5], [5, 5]], { strokeWidth: 4, stroke: BLUE }); path([[5, 5], [5, 0]], { strokeWidth: 4, stroke: "purple" }); path([[5, 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(1, 8)

The perimeter of a square is 4 * S plural_form(UNIT_TEXT, 4 * S). How long is each side?

S plural_form(UNIT_TEXT)
init({ range: [[-1, 6], [-1, 6]] }); path([[0, 0], [5, 0], [5, 5], [0, 5], true], { stroke: BLUE, fill: "#eee" }); path([[0, 0], [0, 5]], { "stroke": PINK }); label([0, 2.5], "\\text{" + i18n._("? %(UNIT)s", {UNIT: UNIT}) + "}", "left", { "color": PINK });
path([[0, 0], [0, 5]], { strokeWidth: 4, stroke: PINK }); path([[0, 5], [5, 5]], { strokeWidth: 4, stroke: BLUE }); path([[5, 5], [5, 0]], { strokeWidth: 4, stroke: PURPLE }); path([[5, 0], [0, 0]], { strokeWidth: 4, stroke: GREEN });

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

\qquad \pink{\text{?}} + \blue{\text{?}} + \purple{\text{?}} + \green{\text{?}} = 4 * S\text{ UNIT}

\qquad \pink{S} + \blue{S} + \purple{S} + \green{S} = 4 * S\text{ UNIT}

The sides of a square are all the same length, so each side must be S UNIT_TEXT long.

The sides of a square are all the same length, so each side must be S plural_form(UNIT_TEXT, S) long.

randRange(1, 8) randRange(1, 8) i18n._("perimeter")

One side of a rectangle is L UNIT_TEXT. One side of a rectangle is L plural_form(UNIT_TEXT, L). Another side is W UNIT_TEXT. Another side is W plural_form(UNIT_TEXT, W). What is its perimeter?

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

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} = 2 * L + 2 * W\text{ UNIT}