# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
216 lines (204 sloc) 8.53 KB
 Area of squares and rectangles
randFromArray([ ["in", "inch"], ["ft", "foot"], ["m", "meter"], ["cm", "centimeter"], ["", "unit"] ])
randRange(2, 8)

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

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

The area is the length times the width.

_(S - 1).times(function(y) { style({ stroke: GRAY, strokeWidth: 1, strokeDasharray: "-" }, function() { path([[0, y + 61 / 60], [S, y + 61 / 60]]); path([[y + 61 / 60, 0], [y + 61 / 60, S]]); }); });

The length is plural(S, UNIT_TEXT) and the width is plural(S, UNIT_TEXT), so the area is S\timesS square plural(UNIT_TEXT).

\qquad\text{area} = S \times S = S * S

We can also count S * S square plural(UNIT_TEXT).

_(S * S).times(function(n) { label([n % S + 0.5, S - floor(n / S) - 0.5], n + 1, "center", false) .css({ color: GRAY }); });
randRange(2, 8)

The area of a square is S * S square plural(UNIT_TEXT). How long is each side?

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

The area is the length times the width.

\qquad \pink{\text{?}} \times \pink{\text{?}} = S * S\text{ UNIT}

\qquad \pink{S} \times \pink{S} = S * S\text{ UNIT}

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

randRange(2, 9) randRange(2, 9)

A rectangle is L plural(UNIT_TEXT, L) long and W plural(UNIT_TEXT, W) wide. What is its area?

L * W square plural(UNIT_TEXT)
init({ range: [[-1, L + 1], [-1, W + 1]], scale: 30 }); 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 area is the length times the width.

style({ stroke: GRAY, strokeWidth: 1, strokeDasharray: "-" },function() { _(L - 1).times(function(x) { path([[x + 61 / 60, 0], [x + 61 / 60, W]]); }); _(W - 1).times(function(y) { path([[0, y + 61 / 60], [L, y + 61 / 60]]); }); });

The length is plural(L, UNIT_TEXT) and the width is plural(W, UNIT_TEXT), so the area is L\timesW square plural(UNIT_TEXT).

\qquad\text{area} = L \times W = L * W

We can also count L * W square plural(UNIT_TEXT).

_(L * W).times(function(n) { label([n % L + 0.5, W - floor(n / L) - 0.5], n + 1, "center", false) .css({ color: GRAY }); });
Something went wrong with that request. Please try again.