11

I must have a mental block, but I simply can't find the reverse of this math function:

x = pow(y, 5);

I have x and 5, how do I find y ?

Here is a snip of my current code:

+(float) linearVolumeToVolumeCurve:(float)volume
{
    return pow(volume, 5);
}

+(float) volumeCurveToLinearVolume:(float)volume
{
    return ???
}
7
  • 3
    I guess it called root of nth power. Commented Feb 16, 2012 at 10:05
  • 1
    Nope, it would be a logarithm if the base were 5 and the exponent were the y.
    – user529758
    Commented Feb 16, 2012 at 10:05
  • 1
    I knew I could count on you all here on StackOverflow! Thank you all for all the answers!
    – Benjamin
    Commented Feb 16, 2012 at 10:21
  • 1
    Haven't I said that? pow(5, y) means 5 is the base, y is the exponent. see my 1st comment.
    – user529758
    Commented Feb 16, 2012 at 10:56
  • 2
    @H2CO3, but the question is NOT to invert pow(5,Y), but pow(y,5). So your comment is not at all relevant to the question at hand. You might as well have told us that Mr Green did it, in the library, with the lead pipe, but again, it would not be relevant.
    – user85109
    Commented Feb 16, 2012 at 15:07

5 Answers 5

20

Try this (pseudo-code): y = pow (x, 1.0 / 5);

2
  • 2
    wrong, 1/5 will evaluate to 0 because it's integer division (no matter the 'pow' function takes a double).
    – user529758
    Commented Feb 16, 2012 at 10:05
  • 6
    @H2CO3 I've mention that it's pseudo-code -- I don't know Objective C. Though, have to admin it's pretty obvious thing for any C-derived language. Commented Feb 16, 2012 at 10:06
8

You have to find the 5th root of y, which is the 1/5th power:

return pow(volume, 1.0/5);
5

Try this

Y=Math.Log(x) / Math.Log(5)
1
  • This does not work for me. But Math.Pow(x,0.333333333333333D) does work to get a reverse of a power of 3.
    – Krythic
    Commented Apr 26, 2018 at 18:38
2

E.g.:

5 = pow(y, 5);

=>

   double y = pow(5, (1.0 / 5.0));
0

you can use this.

if x=y^5

then y =x^1/5 means y=x^0.2

+(float) volumeCurveToLinearVolume:(float)volume
{
    return powf(volume, 0.2);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.