Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 675
Prem Avatar asked Oct 25 '10 15:10

Prem


People also ask

What is the opposite of Math POW?

A logarithm is the opposite of a power. In other words, if we take a logarithm of a number, we undo an exponentiation. Let's start with simple example.

What is the output of Math power (- 2 3?

The expression math:pow(-2, -3) returns -0.125e0 .

Does Math POW return a double?

The method calculates multiplication of the base with itself exponent times and returns the result of type double .

What does Math POW mean?

The Math. pow() function returns the base to the exponent power, as in base exponent , the base and the exponent are in decimal numeral system.


2 Answers

c = Math.log(a)/Math.log(b) 
like image 110
dusan Avatar answered Sep 22 '22 04:09

dusan


Logarithms. You want the logarithm of a. B is the base, c is the exponent, so

logb a = c

like image 44
Charlie Martin Avatar answered Sep 24 '22 04:09

Charlie Martin