src/Alg/Math/Polynomial.php
public function getFormula()
	{
		$expression	= "";
		for( $i = $this->getRank() - 1; $i >= 0; $i-- )
		{
			$a = $this->coefficients[$i];
			if( $a != 0 )
			{
				$sign = $this->getSign( $a );
				if( $i )
				{
					if( abs( $a ) == 1 )
					{
						if( $expression || $a == -1 )
							$expression	.= $sign;
					}
					else
						$expression	.= $expression ? $sign.abs( $a )."*" : $a."*";
					$expression	.= "pow(x,".$i.")";
				}
				else
					$expression	.= $expression ? $sign.abs( $a ) : $a;
			}
		}
		$formula	= new Alg_Math_Formula( $expression, "x" );
		return $formula;
	}
public function getFormula()
	{
		$expression	= "";
		for( $i = $this->getRank() - 1; $i >= 0; $i-- )
		{
			$a = $this->coefficients[$i];
			if( $a != 0 )
			{
				$sign = $this->getSign( $a );
				if( $i )
				{
					if( abs( $a ) == 1 )
					{
						if( $expression || $a == -1 )
							$expression	.= $sign;
					}
					else
						$expression	.= $expression ? $sign.abs( $a )."*" : $a."*";
					$expression	.= "pow(x,".$i.")";
				}
				else
					$expression	.= $expression ? $sign.abs( $a ) : $a;
			}
		}
		$formula	= new Alg_Math_Formula( $expression, "x" );
		return $formula;
	}
public function getFormula ( ) { $ expression = "" ; for ( $ i = $ this -> getRank ( ) - 1 ; $ i >= 0 ; $ i -- ) { $ a = $ this -> coefficients [ $ i ] ; if ( $ a != 0 ) { $ sign = $ this -> getSign ( $ a ) ; if ( $ i ) { if ( abs ( $ a ) == 1 ) { if ( $ expression || $ a == - 1 ) $ expression .= $ sign ; } else $ expression .= $ expression ? $ sign . abs ( $ a ) . "*" : $ a . "*" ; $ expression .= "pow(x," . $ i . ")" ; } else $ expression .= $ expression ? $ sign . abs ( $ a ) : $ a ; } } $ formula = new Alg_Math_Formula ( $ expression , "x" ) ; return $ formula ; }
Returns Formula Object of Polynomial.
@access		public
@return		Alg_Math_Formula
@since		15.09.2006
Returns Formula Object of Polynomial .