示例#1
0
 public function getY($x)
 {
     $value = 0;
     foreach ($this->equationDefinition as $exponent => $coefficient) {
         $value = BCProvider::add($value, BCProvider::multiply($coefficient, BCProvider::exp($x, $exponent)));
     }
     return Numbers::make($this->numberType, $value);
 }
示例#2
0
 public function PDFByValue($value)
 {
     $value = Numbers::makeOrDont($this->numberType, $value);
     return Numbers::make($this->numberType, BCProvider::multiply(BCProvider::divide(1, BCProvider::multiply($this->standardDev->getValue(), BCProvider::squareRoot(M_2_PI))), BCProvider::exp(M_E, BCProvider::multiply(-1, BCProvider::divide(BCProvider::exp(BCProvider::subtract($value->getValue(), $this->mean->getValue()), 2), BCProvider::multiply(2, $this->variance->getValue()))))), $value->getPrecision(), $value->getBase());
 }
示例#3
0
 public function exp($num)
 {
     $num = Numbers::makeOrDont($this, $num, $this->getPrecision());
     $oldBase = $this->convertForModification();
     $numOldBase = $num->convertForModification();
     $value = BCProvider::exp($this->getValue(), $num->getValue());
     $this->convertFromModification($oldBase);
     $num->convertFromModification($numOldBase);
     return $this->setValue($value);
 }