当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPExcel_Calculation_MathTrig::FACT方法代码示例

本文整理汇总了PHP中PHPExcel_Calculation_MathTrig::FACT方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Calculation_MathTrig::FACT方法的具体用法?PHP PHPExcel_Calculation_MathTrig::FACT怎么用?PHP PHPExcel_Calculation_MathTrig::FACT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPExcel_Calculation_MathTrig的用法示例。


在下文中一共展示了PHPExcel_Calculation_MathTrig::FACT方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: BESSELJ

 /**
  *	BESSELJ
  *
  *	Returns the Bessel function
  *
  *	Excel Function:
  *		BESSELJ(x,ord)
  *
  *	@access	public
  *	@category Engineering Functions
  *	@param	float		$x		The value at which to evaluate the function.
  *								If x is nonnumeric, BESSELJ returns the #VALUE! error value.
  *	@param	integer		$ord	The order of the Bessel function. If n is not an integer, it is truncated.
  *								If $ord is nonnumeric, BESSELJ returns the #VALUE! error value.
  *								If $ord < 0, BESSELJ returns the #NUM! error value.
  *	@return	float
  *
  */
 public static function BESSELJ($x, $ord)
 {
     $x = is_null($x) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x);
     $ord = is_null($ord) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
     if (is_numeric($x) && is_numeric($ord)) {
         $ord = floor($ord);
         if ($ord < 0) {
             return PHPExcel_Calculation_Functions::NaN();
         }
         $fResult = 0;
         if (abs($x) <= 30) {
             $fResult = $fTerm = pow($x / 2, $ord) / PHPExcel_Calculation_MathTrig::FACT($ord);
             $ordK = 1;
             $fSqrX = $x * $x / -4;
             do {
                 $fTerm *= $fSqrX;
                 $fTerm /= $ordK * ($ordK + $ord);
                 $fResult += $fTerm;
             } while (abs($fTerm) > 1.0E-12 && ++$ordK < 100);
         } else {
             $f_PI_DIV_2 = M_PI / 2;
             $f_PI_DIV_4 = M_PI / 4;
             $fXAbs = abs($x);
             $fResult = sqrt(M_2DIVPI / $fXAbs) * cos($fXAbs - $ord * $f_PI_DIV_2 - $f_PI_DIV_4);
             if ($ord & 1 && $x < 0) {
                 $fResult = -$fResult;
             }
         }
         return is_nan($fResult) ? PHPExcel_Calculation_Functions::NaN() : $fResult;
     }
     return PHPExcel_Calculation_Functions::VALUE();
 }
开发者ID:ljhchshm,项目名称:weixin,代码行数:50,代码来源:Engineering.php

示例2: POISSON

 /**
  * POISSON
  *
  * Returns the Poisson distribution. A common application of the Poisson distribution
  * is predicting the number of events over a specific time, such as the number of
  * cars arriving at a toll plaza in 1 minute.
  *
  * @param	float		$value
  * @param	float		$mean		Mean Value
  * @param	boolean		$cumulative
  * @return	float
  *
  */
 public static function POISSON($value, $mean, $cumulative)
 {
     $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
     $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
     if (is_numeric($value) && is_numeric($mean)) {
         if ($value <= 0 || $mean <= 0) {
             return PHPExcel_Calculation_Functions::NaN();
         }
         if (is_numeric($cumulative) || is_bool($cumulative)) {
             if ($cumulative) {
                 $summer = 0;
                 for ($i = 0; $i <= floor($value); ++$i) {
                     $summer += pow($mean, $i) / PHPExcel_Calculation_MathTrig::FACT($i);
                 }
                 return exp(0 - $mean) * $summer;
             } else {
                 return exp(0 - $mean) * pow($mean, $value) / PHPExcel_Calculation_MathTrig::FACT($value);
             }
         }
     }
     return PHPExcel_Calculation_Functions::VALUE();
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:35,代码来源:Statistical.php

示例3: BESSELJ

	/**
	 * BESSELJ
	 *
	 * Returns the Bessel function
	 *
	 * @param float $x        	
	 * @param float $n        	
	 * @return int
	 */
	public static function BESSELJ($x, $n) {
		$x = (is_null ( $x )) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue ( $x );
		$n = (is_null ( $n )) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue ( $n );
		
		if ((is_numeric ( $x )) && (is_numeric ( $n ))) {
			$n = floor ( $n );
			if ($n < 0) {
				return PHPExcel_Calculation_Functions::NaN ();
			}
			$f_PI_DIV_2 = M_PI / 2;
			$f_PI_DIV_4 = M_PI / 4;
			
			$fResult = 0;
			if (abs ( $x ) <= 30) {
				$fTerm = pow ( $x / 2, $n ) / PHPExcel_Calculation_MathTrig::FACT ( $n );
				$nK = 1;
				$fResult = $fTerm;
				$fSqrX = ($x * $x) / - 4;
				do {
					$fTerm *= $fSqrX;
					$fTerm /= ($nK * ($nK + $n));
					$fResult += $fTerm;
				} while ( (abs ( $fTerm ) > 1e-10) && (++ $nK < 100) );
			} else {
				$fXAbs = abs ( $x );
				$fResult = sqrt ( M_2DIVPI / $fXAbs ) * cos ( $fXAbs - $n * $f_PI_DIV_2 - $f_PI_DIV_4 );
				if (($n && 1) && ($x < 0)) {
					$fResult = - $fResult;
				}
			}
			return $fResult;
		}
		return PHPExcel_Calculation_Functions::VALUE ();
	} // function BESSELJ()
开发者ID:nanpeixoto,项目名称:cide,代码行数:43,代码来源:Engineering.php


注:本文中的PHPExcel_Calculation_MathTrig::FACT方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。