Jessica Posted April 30, 2012 Share Posted April 30, 2012 y = x*(x-1)*5; Given $y, calculate $x. I can get this far, it's been so long since I took a math class that I'm not even sure this makes sense. y/5 = x*(x+1) (y/5)/x = x+1 ((y/5)/x)-1 = x My problem is: Given $y = 60, how do I get $x = 4 (using php) 60 = x*(x-1)*5; 12 = x*(x-1); 12/x = x-1 (12/x)+1 = x And I'm stuck. (I know $x = 4 because I made a spreadsheet plugging in 1-100 as x and then getting y, so where x = 4 y = 60) Link to comment https://forums.phpfreaks.com/topic/261856-reversing-an-equation/ Share on other sites More sharing options...
xyph Posted April 30, 2012 Share Posted April 30, 2012 I'd tell you to expand the brackets, then solve, but we're on the internet here. http://www.wolframalpha.com/input/?i=y+%3D+x*%28x-1%29*5 -5x²+5x+y = 0 Link to comment https://forums.phpfreaks.com/topic/261856-reversing-an-equation/#findComment-1341761 Share on other sites More sharing options...
Jessica Posted April 30, 2012 Author Share Posted April 30, 2012 I don't get how that gives me x? I see on wolfram alpha the two alternate forms but neither gives you x when you know y I want to write a calculation in PHP that if I say I have 60 for y, it can tell me x = 4. Or y=100, and it tells me x = 5. And so on. If I give it 80 it should calculate for x and then round down to 4 but I can handle that part Link to comment https://forums.phpfreaks.com/topic/261856-reversing-an-equation/#findComment-1341777 Share on other sites More sharing options...
xyph Posted April 30, 2012 Share Posted April 30, 2012 x will have two values for any given y, generally. Link to comment https://forums.phpfreaks.com/topic/261856-reversing-an-equation/#findComment-1341794 Share on other sites More sharing options...
Jessica Posted April 30, 2012 Author Share Posted April 30, 2012 Ah, I get it. hence the parabola. Thanks Is there any mathematical way to determine the positive value? Probably not... Link to comment https://forums.phpfreaks.com/topic/261856-reversing-an-equation/#findComment-1341796 Share on other sites More sharing options...
kicken Posted April 30, 2012 Share Posted April 30, 2012 http://www.wolframalpha.com/input/?i=y+%3D+x*%28x-1%29*5+solve+for+x Neat tool that wolfram alpha is. I should use that more. Link to comment https://forums.phpfreaks.com/topic/261856-reversing-an-equation/#findComment-1341810 Share on other sites More sharing options...
Jessica Posted May 1, 2012 Author Share Posted May 1, 2012 http://www.wolframalpha.com/input/?i=y+%3D+x*%28x-1%29*5+solve+for+x Neat tool that wolfram alpha is. I should use that more. Seriously. I am bookmarking that site, I'd heard of it but never used it before. You guys rock. So let's see in PHP this would be... <?php $y = 60; $x = .1*((sqrt(5)*sqrt((4*$y)+5))+5); echo $x; ?> And it echoed 4. Perfect!! Link to comment https://forums.phpfreaks.com/topic/261856-reversing-an-equation/#findComment-1341920 Share on other sites More sharing options...
phpdevelopers Posted September 27, 2012 Share Posted September 27, 2012 It was really a helpful content. Keep sharing… Link to comment https://forums.phpfreaks.com/topic/261856-reversing-an-equation/#findComment-1381277 Share on other sites More sharing options...
ManiacDan Posted September 27, 2012 Share Posted September 27, 2012 If you don't want to be big fat cheaters, the way to do this on paper is to use the quadratic formula For this equation, it's as easy as: y = x*(x-1)*5; y = 5x^2 - 5x; //jesi, you messed up here by moving X back to both sides of the equation. Don't do that 0 = 5x^2 - 5x - y; //everything has to equal zero //here, we substitute Jesi's value for Y and use the Quadratic Formula x = (5 +/- sqrt(25 - 4 * 5 * -60)) / 10; x = (5 +/- 35) / 10; x = 4,3; The parabola formed by the equation cuts the Y axis at 4 and 3. Both are valid answers, but only the larger one satisfies the original equation. Also, I just now noticed this thread is 6 months old and newbie here bumped it, but I did all the math so you're getting the post anyway. Link to comment https://forums.phpfreaks.com/topic/261856-reversing-an-equation/#findComment-1381324 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.