function polynomial_regression($points = array(), $degree) { $mX = array(); foreach ($points as $i => $point) { $x = 1; for ($j = 0; $j <= $degree; $j++) { $mX[$i][$j] = $x; $x *= $point['x']; } $mY[$i] = array($point['y']); } $left = matrix_invert(matrix_multiply(matrix_transpose($mX), $mX)); $right = matrix_multiply(matrix_transpose($mX), $mY); $coefficients = matrix_multiply($left, $right); foreach ($coefficients as &$c) { $c = $c[0]; } return $coefficients; }
function de($method, $s) { switch ($method) { case 'snd': break; case 'bin': $s = bin_de($s); break; case 'dec': $s = dec_de($s); break; case 'oct': $s = oct_de($s); break; case 'hex': $s = hex_de($s); break; case 'rot': $s = rotate($s, 26 - $_POST['rot'], 10 - $_POST['nrot']); break; case 'url': $s = $_POST['url_raw'] == 'on' ? rawurldecode($s) : urldecode($s); break; case 'ur2': $s = urldecode($s); break; case 'raw': break; case 'stmwth': break; case 'rev': $s = str_rev($s); break; case 'spe': $s = html_entity_decode($s); break; case 'hen': break; case 'nbase': $s = base_conv($s, 1); break; case 'base': $s = base_de($s); break; case 'md5': addmsg(INFO, '<a href="http://gdataonline.com/seekhash.php" target="_blank">http://gdataonline.com/seekhash.php</a>'); break; case 'crypt': break; case 'stu': break; case 'crv': $s = case_rev($s); break; case 'stl': break; case 'ucw': break; case 'bbs': break; case 'bsd': break; case 'srt': $s = mysort($s, 1); break; case 'rpt': break; case 'unq': $s = uniq($s, 1); break; case 'rf': $s = sqr($s, 1); break; case 'pcr': break; case 'acc': $s = accumulation($s, 1); break; case 'uue': $s = convert_uudecode($s); break; case 'det': break; case 'ttb': break; case 'mut': break; case 'sha1': break; case 'msk': break; case 'ref': $s = sqr_reflect($s); break; case 'crc16': break; case 'crc32': break; case 'sta': break; case 'rep': $s = gen_rep_de($s); break; case 'cor': break; case 'pcm': break; case 'ascii': $s = ASCIIFilter_de($s); break; case 'ave': break; case 'miv': break; case 'mmtp': break; case 'mro': $s = matrix_rotate($s, 1); break; case 'mtr': $s = matrix_transpose($s); break; case 'cac': break; case 'ctr': break; case 'swd': break; case 'che': break; case 'key': $s = key_xor($_POST['key'], $s); break; case 'bre': $s = bit_rev($s); break; case 'bod': $s = bitorder_de($_POST['order'], $s); break; case 'tra': $s = tran(12 - $_POST['transpose'], $s, 1); break; case 'quot': break; default: addmsg(ERR, 'Undefined Method: ' . $method); } return $s; }