# Khan/khan-exercises

Switch branches/tags
Nothing to show
Fetching contributors…
Cannot retrieve contributors at this time
88 lines (69 sloc) 4.47 KB
 Evaluating composite functions
shuffle(["f", "g", "h"]) ["x", "n", "t"] new Polynomial( randRange(0, 2), randRangeWeighted(1, 3, 3, 0.2), null, randFromArray(FUNC_VARIABLES), FUNC_NAMES[0] ) new CompositePolynomial( randRange(0, 2), randRangeWeighted(1, 3, 3, 0.2), null, randFromArray(FUNC_VARIABLES), FUNC_NAMES[1], INNER )
shuffle([INNER, OUTER]) shuffle([INNER, OUTER]) randRange(-10, 10) SOLVE_FOR[1].evalOf(VALUE) SOLVE_FOR[0].evalOf(INNER_VALUE)
• FUNCTIONS[0].name(FUNCTIONS[0].variable) = FUNCTIONS[0].text()
• FUNCTIONS[1].name(FUNCTIONS[1].variable) = FUNCTIONS[1].text()

SOLVE_FOR[0].name(SOLVE_FOR[1].name(VALUE)) = {?}

OUTER_VALUE

new CompositePolynomial( randRange(0, 2), randRange(1, 3), null, randFromArray(FUNC_VARIABLES), FUNC_NAMES[2], randFromArray([INNER, OUTER]) ) shuffle([INNER, OUTER, OUTER2]) shuffle([INNER, OUTER, OUTER2]) randRange(-10, 10) SOLVE_FOR[1].evalOf(VALUE) SOLVE_FOR[0].evalOf(INNER_VALUE)
• FUNCTIONS[0].name(FUNCTIONS[0].variable) = FUNCTIONS[0].text()
• FUNCTIONS[1].name(FUNCTIONS[1].variable) = FUNCTIONS[1].text()
• FUNCTIONS[2].name(FUNCTIONS[2].variable) = FUNCTIONS[2].text()

SOLVE_FOR[0].name(SOLVE_FOR[1].name(VALUE)) = {?}

OUTER_VALUE

First, let's solve for the value of the inner function, SOLVE_FOR[1].name(VALUE). Then we'll know what to plug into the outer function.

value

Now we know that SOLVE_FOR[1].name(VALUE) = INNER_VALUE. Let's solve for SOLVE_FOR[0].name(SOLVE_FOR[1].name(VALUE)), which is SOLVE_FOR[0].name(INNER_VALUE).

value