note 30961 deleted from function.sqrt by nlopess
| From: | nlopess@php.net | Date: | Sat, 09 Oct 2004 09:01:42 +0000 |
| Subject: | note 30961 deleted from function.sqrt by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-78216@lists.php.net to get a copy of this message | ||
Note Submitter: Oromian
----
Here is a snipplet of something that i created for Pythagorean Theorem. Look for the entire site to
be release on hotscripts.com/PHP under calculators.
<?
// this is the function that formulates the answer if the hypotenuse is not given
function no_hypot ($nohypota, $nohypotb){
$a1 = $nohypota;
$a2 = $nohypota;
$b1 = $nohypotb;
$b2 = $nohypotb;
$asq = $a1*$a2;
$bsq = $b1*$b2;
$semidone = $asq+$bsq;
$answer = sqrt(($a1*$a2)+($b1*$b2));
echo "
Formula:<br>
(a²)+(b²)=c²
<br><br>
In this case, a = <b>$a1</b>, and b = <b>$b1</b>.
<br><br>
($a1 multiplied by $a2) added to ($b1 multiplied by $b2) = c²
<br><br>
a² = $a1*$a2 = $asq
<br><br>
b² = $b1*$b2 = $bsq
<br><br>
$asq added to $bsq = c²
<br><br>
$semidone = c²
<br><br>so after square rooting the last answer, finally our conclusion
is...<br><br>
<b><u><h3>$answer</u> = c</b><br><br>";
}
// this is the function that formulates the answer if the hypotenuse is given
function yes_hypot ($hypota, $hypotb){
$c1 = $hypota;
$c2 = $hypota;
$b1 = $hypotb;
$b2 = $hypotb;
$csq = $c1*$c2;
$bsq = $b1*$b2;
$semidone = $csq-$bsq;
$answer = sqrt(($c1*$c2)-($b1*$b2));
echo "Formula:<br>
(c²)-(b²)=a²
<br><br>
In this case, c = <b><u>$c1</u></b>, and b =
<b><u>$b1</u></b>.
<br><br>
($c1 multiplied by $c2) subtracted by ($b1 multiplied by $b2) = a²
<br><br>
c² = $c1*$c2 = $csq
<br><br>
b² = $b1*$b2 = $bsq
<br><br>
$csq subtracted by $bsq = a²
<br><br>
$semidone = a²
<br><br>so after square rooting the last answer, finally our conclusion
is...<br><br>
<b><u><h3>$answer</u> = a</b><br><br>";
}
?>