I was wondering how to get the inversion of electricity in Ruby?
2 ** 4 # = & gt; 16 And then I want to reverse it, and I'm not sure which operator to use
16 ?? 2 # = & gt; 4
The inversion of exponentation is logarithmic.
If a b = c , then log a c = b .
You can find the logarithm in the module this logarithm base-E ( log ) or base-10 ( log 10 ). To obtain a logarithm for base-N, use the formula:
log
Where x is a value such as e log x or 10 . For your special case:
log
Whether you consider the explanation because it expands your knowledge or is bad because you hate high school mathematics, you are dependent on: -)
Comments
Post a Comment