Bueno, os dejo un tipo de libreria de matematicas con diversas funciones utiles, raiz cuadrada y raiz cubica dadas por SnakeDrak
(Thx)
<?php
function mcd($x, $y){ // saber el mcd de dos cifras
$aux = $x;
if($x<$y){
$x=$y;
$y=$aux;
}
while(($r=$x%$y)!=0){
$x=$y;
$y=$r;
}
return $y;
}
function mcm($x, $y){ // se requiere mcd() - Saber el mcm de dos cifras
return (($x*$y)/(mcd($x,$y)));
}
function nPrimo($n){ // saber si un numero es primo
$ret=1;
for($i=2; $i<$n && $ret==1;$i++){
if(($n%$i)==0) $ret=0;
}
return $ret;
}
function nxPrimo($i){ // saber el primo que va detras de otro
$ret=$i+1;
while(nPrimo($ret)==0)
$ret++;
return $ret;
}
function cateto($h, $c){ // saber el cateto de una hipotenusa
$c1 = $c * $c;
$h1 = $h * $h;
$a = $c1 - $h1;
return raiz_q($a);
}
function hipotenusa($c1, $c2){
$cc1 = $c1*$c1;
$cc2 = $c2*$c2;
$a = $cc1+$cc2;
return raiz_q($a);
}
function elevar($n, $c){ // elevar un numero a otro
$ret = 1;
for($i = 0; $i < $c; $i++){
$ret = $ret*$n;
}
return $ret;
}
function raiz_q($n,$c=2){ // raices
}
?>