# BlueShirtBill/khan-exercises forked from Khan/khan-exercises

Merge pull request #9800 from hans/chain-rule-simplify

Issue #8317 (chain rule 1) - Special derivative simplifications
2 parents 5b4e438 + 16a9419 commit b1bd8807a0a6c99650f6cd77765cebbbdc3c91d3 beneater committed
Showing with 33 additions and 1 deletion.
1. +33 −1 exercises/chain_rule_1.html
34 exercises/chain_rule_1.html
 @@ -10,6 +10,13 @@
generateFunction("x") new CalcFunctions[randRange(1, CalcFunctions.length - 1)](INNER.f) + + + ( ( OUTER.f[0] === '^' && OUTER.f[1] === 'e' && INNER.f[0] === 'ln' ) + || ( OUTER.f[0] === 'ln' && INNER.f[0] === '^' && INNER.f[1] == 'e' ) ) + ? 'x' + : null +
randFromArray( INNER.wrongs ) @@ -20,8 +27,22 @@ randFromArray( INNER.wrongs ) randFromArray( OUTER.wrongs )
+ + ['*', OUTER.ddxF, INNER.ddxF] + + + ( ( OUTER.f[0] === '^' && OUTER.f[1] === 'e' && INNER.f[0] === 'ln' ) + || ( OUTER.f[0] === 'ln' && INNER.f[0] === '^' && INNER.f[1] == 'e' ) ) + ? [['frac', 'x', 'x'], '1'] + : [] + + + + DERIVATIVE_SIMPLIFICATIONS.length === 0 + ? expr(UNSIMPLIFIED_DERIVATIVE) + : expr(DERIVATIVE_SIMPLIFICATIONS[DERIVATIVE_SIMPLIFICATIONS.length - 1]) + - expr(["*", OUTER.ddxF, INNER.ddxF]) funcNotation("x")
@@ -60,6 +81,9 @@
• expr(randFromArray(OUTER.wrongs))
• +
• + 1 +
• @@ -70,8 +94,16 @@

The derivative of OUTER.fText with respect to INNER.fText is OUTER.ddxFText.

The derivative of INNER.fText with respect to x is INNER.ddxFText.

+ +

The derivative at this point is expr(UNSIMPLIFIED_DERIVATIVE), but this expression can be simplified.

+ +
+

expr( i === 0 ? UNSIMPLIFIED_DERIVATIVE : DERIVATIVE_SIMPLIFICATIONS[i - 1] ) can be simplified to expr(newexpr).

+

So NOTATION.ddxF = DERIVATIVE.

+ +

Interestingly, if we simplify the function before we take the derivative, we can reach the answer more quickly: OUTER.fText simplifies to expr(PRE_SIMPLIFICATION), and \frac{d}{dx}(expr(PRE_SIMPLIFICATION)) is DERIVATIVE.