What's the opposite of JavaScript's Math.pow?

Premasagar picture Premasagar · Oct 25, 2010 · Viewed 16.4k times · Source

I'm having a mental block here, and algebra not really being my thing, can you tell me how to re-write the JavaScript code below to derive the variable, c, in terms of a and b?:

a = Math.pow(b, c);
c = ?

Thanks!

Answer

dusan picture dusan · Oct 25, 2010
c = Math.log(a)/Math.log(b)