PHP 8.5.0 Beta 3 available for testing

Math Funzioni

Indice dei contenuti

  • abs β€” Valore assoluto
  • acos β€” Arco coseno
  • acosh β€” Inverso del coseno iperbolico
  • asin β€” Arco seno
  • asinh β€” Inverso del seno iperbolico
  • atan β€” Arco tangente
  • atan2 β€” Arco tangente di due variabili
  • atanh β€” Inverso della tangente iperbolica
  • base_convert β€” Converte un numero fra basi arbitrarie
  • bindec β€” Da binario a decimale
  • ceil β€” arrotonda le frazioni all'intero superiore
  • cos β€” Coseno
  • cosh β€” Coseno iperbolico
  • decbin β€” Da decimale a binario
  • dechex β€” Da decimale a esadecimale
  • decoct β€” Da decimale a ottale
  • deg2rad β€” Converte il numero dato in gradi nell'equivalente espresso in radianti
  • exp β€” Calcola l'esponente di e (la base logaritmica naturale o di Nepero)
  • expm1 β€” Restituisce exp(numero) - 1, computato in maniera tale da essere accurato anche se il valore del numero Γ¨ vicino a zero
  • fdiv β€” Divides two numbers, according to IEEE 754
  • floor β€” Arrotonda le frazioni all'intero inferiore
  • fmod β€” Returns the floating point remainder (modulo) of the division of the arguments
  • fpow β€” Raise one number to the power of another, according to IEEE 754
  • hexdec β€” Da esadecimale a decimale
  • hypot β€” Restituisce sqrt(num1*num1 + num2*num2)
  • intdiv β€” Integer division
  • is_finite β€” Verifica se un numero dato Γ¨ un numero finito
  • is_infinite β€” Verifica se un dato valore Γ¨ infinito
  • is_nan β€” Verifica se un dato valore non sia un numero
  • log β€” Logaritmo naturale
  • log10 β€” Logaritmo base-10
  • log1p β€” Restituisce log(1 + numero), computato in maniera tale da essere accurato anche se il valore del numero Γ¨ vicino a zero
  • max β€” Trova il valore massimo
  • min β€” Trova il valore minimo
  • octdec β€” Da ottale a decimale
  • pi β€” Restituisce il valore di pi
  • pow β€” Espressione esponenziale
  • rad2deg β€” Converte un numero in radianti nell'equivalente numero in gradi
  • round β€” Arrotonda un float
  • sin β€” Seno
  • sinh β€” Seno iperbolico
  • sqrt β€” Radice quadrata
  • tan β€” Tangente
  • tanh β€” Tangente iperbolica
οΌ‹add a note

User Contributed Notes 2 notes

up
12
pat.mat AT sympatico DOT com ΒΆ
21 years ago
For people interest in Differential Equations, I've done a function that receive a string like: x^2+x^3 and put it in
2x+3x^2 witch is the differantial of the previous equation.

In the code there is one thing missing: the $string{$i} is often going outOfBound (Uninitialized string offset: 6 in...)
if your error setting is set a little too high... I just dont know how to fix this.

So there is the code for differential equation with (+ and -) only:

<?
function differentiel($equa)
{
$equa = strtolower($equa);
echo "Equation de depart: ".$equa."<br>";
$final = "";

for($i = 0; $i < strlen($equa); $i++)
{
//Make a new string from the receive $equa
if($equa{$i} == "x" && $equa{$i+1} == "^")
{
$final .= $equa{$i+2};
$final .= "x^";
$final .= $equa{$i+2}-1;
}
elseif($equa{$i} == "+" || $equa{$i} == "-")
{
$final .= $equa{$i};
}
elseif(is_numeric($equa{$i}) && $i == 0)
{
//gerer parenthese et autre terme generaux + gerer ^apres: 2^2
$final .= $equa{$i}."*";
}
elseif(is_numeric($equa{$i}) && $i > 0 && $equa{$i-1} != "^")
{
//gerer ^apres: 2^2
$final .= $equa{$i}."*";
}
elseif($equa{$i} == "^")
{
continue;
}
elseif(is_numeric($equa{$i}) && $equa{$i-1} == "^")
{
continue;
}
else
{
if($equa{$i} == "x")
{
$final .= 1;
}
else
{
$final .= $equa{$i};
}
}
}
//
//Manage multiplication add in the previous string $final
//
$finalMul = "";
for($i = 0; $i < strlen($final); $i++)
{
if(is_numeric($final{$i}) && $final{$i+1} == "*" && is_numeric($final{$i+2}))
{
$finalMul .= $final{$i}*$final{$i+2};
}
elseif($final{$i} == "*")
{
continue;
}
elseif(is_numeric($final{$i}) && $final{$i+1} != "*" && $final{$i-1} == "*")
{
continue;
}
else
{
$finalMul .= $final{$i};
}
}
echo "equa final: ".$finalMul;
}
?>

I know this is not optimal but i've done this quick :)
If you guys have any comment just email me.
I also want to do this fonction In C to add to phpCore maybe soon...
Patoff
up
2
daniel at g-loc dot org ΒΆ
19 years ago
If you're an aviator and needs to calculate windcorrection angles and groundspeed (e.g. during flightplanning) this can be very useful.

$windcorrection = rad2deg(asin((($windspeed * (sin(deg2rad($tt - ($winddirection-180))))/$tas))));
$groundspeed = $tas*cos(deg2rad($windcorrection)) + $windspeed*cos(deg2rad($tt-($winddirection-180)));

You can probably write these lines more beautiful, but they work!
To Top