# Khan/khan-exercises

### Subversion checkout URL

You can clone with HTTPS or Subversion.

Fetching contributors…

Cannot retrieve contributors at this time

59 lines (53 sloc) 3.489 kb
 Logarithms 1.5
randRange(2, 16) randRange(-4, 4) pow(BASE, abs(EXP)) (EXP < 0 ? "\\dfrac{1}{" + ABS_NUM + "}" : "" + ABS_NUM)

What is the value of the following logarithm?

\log_{BASE} EXP < 0 ? "\\left(" + NUM_STR + "\\right)" : NUM_STR

EXP

If b^y = x, then \log_{b} x = y.

Therefore, we want to find the value y such that BASE^{y} = NUM_STR.

Any number raised to the power 1 is simply itself, so BASE^{1} = BASE and thus \log_{BASE} BASE = 1.

Any non-zero number raised to the power 0 is simply 1, so BASE^0 = 1 and thus \log_{BASE} 1 = 0.

Any number raised to the power -1 is its reciprocal, so BASE^{-1} = \dfrac{1}{BASE} and thus \log_{BASE} \left(\dfrac{1}{BASE}\right) = -1.

In this case, BASE^{EXP} = NUM_STR, so \log_{BASE} EXP < 0 ? "\\left(" + NUM_STR + "\\right)" : NUM_STR = EXP.

randRange(2, 16) randRange(2, 5) pow(BASE, EXP)

What is the value of the following logarithm?

\log_{NUM} BASE

1/EXP

If b^y = x, then \log_{b} x = y.

Notice that BASE is the ["square", "cube", "fourth", "fifth"][EXP - 2] root of NUM.

That is, \sqrtEXP === 2 ? "" : "[" + EXP + "]"{NUM} = NUM^{1/EXP} = BASE.

Thus, \log_{NUM} BASE = \dfrac{1}{EXP}.

Something went wrong with that request. Please try again.