I'm wondering if it's possible to reverse calculations containing multiple pow()
functions, with different (but known) exponents. Given the forward calculation, I need the reverse calculation.
<?php
# Forward calculation
$in = 9;
$out = pow($in, 2) + pow($in, 3); // = 810
# My attempt at an reverse calculation
$result = pow($out, 1/2) + pow($out, 1/3); // = 37.7821...
I want the reverse $result
to be 9, but seeing 37.7821... Which seems to be because $out
needs to be divided among each pow()
function, but unless the exponents are the same I'm not sure how to distribute that. As individually each pow() reverse works, but not when added together.
My goal in the end is to reverse a 4th order polynomial curve. I'm mostly self taught in maths, so prefer code examples to equations.
As meowgoesthedog and Nico Schertler pointed out, it's not easy to solve this (At least far outside my expertise).
I've solved it by using curve fitting on data from the forward calculation (mycurvefit.com). It doesn't produce identical results, but close enough approximation for my use (point distribution for a leveling system).