behnampmdg3 Posted April 27, 2015 Share Posted April 27, 2015 HelloI have simple math formula I wanna convert to PHP, but for some weird reason I can't!(X*X)*(3X)=1200Its should be easy to calculate it on paper but how can I convert this to PHP? Maybe it's too simple and my retardness has poped!Maybe something like? pow($y, 3)= 1200/3 Still not sure how to get thew reply from that. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/295894-convert-simple-math-formual-to-php-code/ Share on other sites More sharing options...
requinix Posted April 27, 2015 Share Posted April 27, 2015 Just because it uses the same = symbol doesn't mean it works the same way. Take the number 1200, divide by 3, then assign the result to the result of the function call pow($y, 3)That does not make sense. Rewrite the expression in terms of X alone. Meaning you have to end up at X = .... Quote Link to comment https://forums.phpfreaks.com/topic/295894-convert-simple-math-formual-to-php-code/#findComment-1510067 Share on other sites More sharing options...
racken Posted August 8, 2015 Share Posted August 8, 2015 surely its just $x=240 ? (X*X)*(3X)=1200 => 5X=1200 => X=240 why do you need this in php? Quote Link to comment https://forums.phpfreaks.com/topic/295894-convert-simple-math-formual-to-php-code/#findComment-1518278 Share on other sites More sharing options...
Barand Posted August 8, 2015 Share Posted August 8, 2015 // pow($x, 3) == 1200/3; // therefore $x = pow(1200/3 , 1/3); echo $x; //--> 7.3680629972808 (not 240, but close) to confirm echo 3 * 7.3680629972808 * 7.3680629972808 * 7.3680629972808; // --> 1200 Quote Link to comment https://forums.phpfreaks.com/topic/295894-convert-simple-math-formual-to-php-code/#findComment-1518289 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.