PHP Classes

File: examples/math.php

Recommend this page to a friend!
  Classes of Everton da Rosa   XtPHP   examples/math.php   Download  
File: examples/math.php
Role: Example script
Content type: text/plain
Description: Example script
Class: XtPHP
General purpose library of utility classes
Author: By
Last change:
Date: 9 years ago
Size: 883 bytes
 

Contents

Class file image Download
<?php

require '../math.php';
require
'../utils.php';

$array = array(1,5,9,7,6,8,8.9);

echo
"<p>Valores</p>";
XtUtils::printr($array);

echo
"<p>Soma</p>";
echo
XtMath::sum($array);
echo
"<p>Média</p>";
echo
XtMath::med($array);
echo
"<p>Máximo</p>";
echo
XtMath::max($array);
echo
"<p>Mínimo</p>";
echo
XtMath::min($array);
echo
"<p>Desvio Padrão</p>";
echo
XtMath::desvpad($array);
echo
"<p>Número de elementos</p>";
echo
XtMath::len($array);

echo
"<p>Correlação de projeções</p>";
$x = array(1.2,1.5,1.7,1.9,2);
$y = array(100,110,115,121,127);
$x1 = array(2.3);
echo
"<p>Valores de X</p>";
XtUtils::printr($x);
echo
"<p>Valores de Y</p>";
XtUtils::printr($y);

echo
"<p>Valores futuros de X</p>";
XtUtils::printr($x1);
echo
"<p>Correlação</p>";
echo
XtMath::correlation($x, $y);
echo
"<p>Projeção linear</p>";
XtUtils::printr(XtMath::linearProj($x, $y, $x1));
?>