Location: PHPKode > scripts > bNewton > bnewton/binomial.php
<?
include("binomial.class.php");
?>
Newton's binomial<br>
Negative sample:<br>
(5x - 54y)<sup>3</sup> = 
<?

$b = new bNewton();
// show the solution to binomial
// you can use the negative signal in second parameter too

$b->calculate('5x', '-45y', 3);
// sample to calculate a binomial number
?>
<br>
Positive sample:<br>
(2a + 3b)<sup>4</sup> = 
<?
$b = new bNewton();
// show the solution to binomial
// you can use the negative signal in second parameter too

$b->calculate('2a', '3b', 4);
// sample to calculate a binomial number
?>
<br><br>
Binomial number
<table border="0" cellpading="0" cellspacing="0">
	<tr>
		<td rowspan="2"><big><big><big><big>(</big></big></big></big></td>
		<td>9</td>
		<td rowspan="2"><big><big><big><big>)</big></big></big></big></td>
		<td rowspan="2"> = 
		<?
		echo $b->binomialNumber(9,4);
		?>		
		</td>
	</tr>
	<tr>
		<td>4</td>
	</tr>
</table>

<br><br>
Fatorial
<br>

5! = 
<?
// fatorial sample
echo $b->fat(5);


?>
Return current item: bNewton