PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Julian Sanchez   Probabilistic   sample.php   Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Probabilistic
Perform common probabilistic analisis calculations
Author: By
Last change: Fix inputs bad names.
Date: 20 years ago
Size: 27,874 bytes
 

Contents

Class file image Download
<? include "./Probabilistica.obj.php"; ?> <html> <head> <title>FUNCIONES PROBABILISTICAS</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- td { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; } input { font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #666666; } .result { font-weight: bold; color: #FF0000; height: 20px; border: 1px dotted #CCCCCC; } --> </style> <style type="text/css"> <!-- body { font-family: Arial, Helvetica, sans-serif; color: #666666; } select { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #333333; } --> </style> </head> <body bgcolor="#F9F9F9"> <? //var_dump($HTTP_GET_VARS); $prob = new Probabilistica; switch ($funcion){ case 1: $factorial =$prob->fact($x); break; case 2: $combinatoria = $prob->comb($z,$w); break; case 3: $interpolar = $prob->interpolar($x1,$a1,$x2,$a2,$y); case 4: $media = $prob->media($n,$p); break; case 5: $desviacion = (!$q1) ? $prob->desviacion($n1,$p1) : $prob->desviacion($n1,$p1,$q1); if(!$q1) $q1 = 1 - $p1; break; case 6: $varianza = (!$q1) ? $prob->varianza($n1,$p1) : $prob->desviacion($n1,$p1,$q1); if(!$q1) $q1 = 1 - $p1; break; case 7: $densidad_de_Poison = $prob->dens_poison($k,$t); break; case 8: $distribucion_de_Poison = $prob->dist_poison($k,$t); break; case 9: $densidad_binomial = $prob->dens_binomial($k2,$n2,$p2); break; case 10: $distribucion_binomial = $prob->dist_binomial($k2,$n2,$p2); break; case 11: $densidad_hipergeometrica = $prob->dens_hiperg($k3,$n3,$m3,$j3); break; case 12: $distribucion_hipergeometrica = $prob->dist_hiperg($k3,$n3,$m3,$j3); break; case 13: $area = $prob->getAval($Zval); break; case 14: $Z =$prob->getZval($A); break; case 15: $desviacion_nomral = $prob->Z($X,$media,$desviacion); break; case 16: $distribucion_nomral = $prob->areaZ($X,$n4,$p4,$P,$signo); break; } ?> <center> <font size="5"><B>FUNCIONES PROBABILISTICAS</B></font> </center> <table width="760" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td><fieldset><legend>Funciones Generales</legend> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td width="50%"> <? $fnc = "factorial"; $fncN = 1; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?></legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><strong>Numero</strong> <input name="x" type="text" size="7" value="<?=$x?>"></td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc ?> &nbsp;</td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> <td> <? $fnc = "combinatoria"; $fncN = 2; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?></legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td width="25%" align="right"><strong>Valor 1</strong></td> <td width="25%"><input name="z" type="text" size="7" value="<?=$z?>"></td> <td width="25%" align="right"><strong>Valor 2</strong></td> <td width="25%"><input name="w" type="text" size="7" value="<?=$w?>"></td> </tr> </table> <strong> </strong> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc?> &nbsp;</td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form></td> </tr> </table> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td><? $fnc = "interpolar"; $fncN = 3; ?> <fieldset> <legend>Hallar <?=ucfirst($fnc)?></legend> <a name="<?=$fncN?>"></a> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" nowrap><strong>x1. <input name="x1" type="text" size="7" value="<?=$x1?>"> </strong></td> <td align="center">-----></td> <td align="center" nowrap><strong>a1. <input name="a1" type="text" size="7" value="<?=$a1?>"> </strong></td> </tr> <tr> <td align="center"></td> <td align="center"></td> <td align="center" nowrap><strong>Y&nbsp;&nbsp;&nbsp; <input name="y" type="text" size="7" value="<?=$y?>"> </strong></td> </tr> <tr> <td align="center" nowrap><strong>x2. <input name="x2" type="text" size="7" value="<?=$x2?>"> </strong></td> <td align="center">-----></td> <td align="center" nowrap><strong>a2. <input name="a2" type="text" size="7" value="<?=$a2?>"> </strong></td> </tr> </table> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc?> &nbsp;</td> </tr> </table> <input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </fieldset> </td> <td width="30%^"> <? $fnc = "desviacion"; $fncN = 5; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?></legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <br> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td align="right" width="50%"><strong>Numero de exitos </strong></td> <td><input name="n1" type="text" size="7" value="<?=$n1?>"></td> </tr> <tr> <td align="right"><strong>Probabilidad de exito </strong></td> <td><input name="p1" type="text" size="7" value="<?=$p1?>"></td> </tr> <tr> <td align="right"><strong>Pro. fracaso </strong>(opcional) </td> <td><input name="q1" type="text" size="7" value="<?=$q1?>"></td> </tr> </table> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc ?> &nbsp;<br> </td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> <td width="30%"> <? $fnc = "varianza"; $fncN = 6; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?></legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <br> <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td align="right" width="50%"><strong>Numero de exitos </strong></td> <td><input name="n1" type="text" size="7" value="<?=$n1?>"></td> </tr> <tr> <td align="right"><strong>Probabilidad de exito</strong></td> <td><input name="p1" type="text" size="7" value="<?=$p1?>"></td> </tr> <tr> <td align="right"><strong>Pro. fracaso </strong>(opcional) </td> <td><input name="q1" type="text" size="7" value="<?=$q1?>"></td> </tr> </table> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc ?> &nbsp;<br> </td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> </tr> </table> </fieldset> </td> </tr> <tr> <td> <fieldset> <legend>Funciones de Densidad y Distribucion de Poison</legend> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td width="50%"> <? $fnc = "densidad_de_Poison"; $fncN = 7; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?></legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td align="right" width="50%"><strong>Numero de Sucesos</strong></td> <td><input name="k" type="text" size="7" value="<?=$k?>"></td> </tr> <tr> <td align="right"><strong>Media</strong></td> <td><input name="t" type="text" size="7" value="<?=$t?>"></td> </tr> </table> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc?> &nbsp;</td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> <td><? $fnc = "distribucion_de_Poison"; $fncN = 8; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?> (Acumulado) </legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td align="right" width="50%"><strong>Numero de Sucesos</strong></td> <td><input name="k" type="text" size="7" value="<?=$k?>"></td> </tr> <tr> <td align="right"><strong>Media</strong></td> <td><input name="t" type="text" size="7" value="<?=$t?>"></td> </tr> </table> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc?> &nbsp;</td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> </tr> </table> <table width="100%" border="0" cellspacing="5" cellpadding="0"> </table> </fieldset> </td> </tr> <tr> <td> <fieldset> <legend>Funciones de Densidad y Distribucion Binomial</legend> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td width="50%"> <? $fnc = "densidad_binomial"; $fncN = 9; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?></legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td width="50%" align="right"><strong>Numero de exitos</strong></td> <td><input name="k2" type="text" size="7" value="<?=$k2?>"></td> </tr> <tr> <td align="right"><strong>Ensayos</strong></td> <td><input name="n2" type="text" size="7" value="<?=$n2?>"></td> </tr> <tr> <td align="right"><strong>Probabilidad</strong></td> <td><input name="p2" type="text" size="7" value="<?=$p2?>"></td> </tr> </table> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc?> &nbsp;</td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> <td><? $fnc = "distribucion_binomial"; $fncN = 10; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?> (Acumulado) </legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td width="50%" align="right"><strong>Numero de exitos</strong></td> <td><input name="k2" type="text" size="7" value="<?=$k2?>"></td> </tr> <tr> <td align="right"><strong>Ensayos</strong></td> <td><input name="n2" type="text" size="7" value="<?=$n2?>"></td> </tr> <tr> <td align="right"><strong>Probabilidad</strong></td> <td><input name="p2" type="text" size="7" value="<?=$p2?>"></td> </tr> </table></td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc?> &nbsp;</td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> </tr> </table> <table width="100%" border="0" cellspacing="5" cellpadding="0"> </table> </fieldset> </td> </tr> <tr> <td><fieldset> <legend>Funciones de Densidad y Distribucion Hipergeometrica</legend> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td width="50%"> <? $fnc = "densidad_hipergeometrica"; $fncN = 11; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?></legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td width="50%" align="right"><strong>Exitos en la muestra </strong></td> <td><input name="k3" type="text" size="7" value="<?=$k3?>"></td> </tr> <tr> <td align="right"><strong>Tamaņo Muestra</strong></td> <td><input name="n3" type="text" size="7" value="<?=$n3?>"></td> </tr> <tr> <td align="right"><strong>Exitos en poblacion</strong></td> <td><input name="m3" type="text" size="7" value="<?=$m3?>"></td> </tr> <tr> <td align="right"><strong>Poblacion</strong></td> <td><input name="j3" type="text" size="7" value="<?=$j3?>"></td> </tr> </table> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc?> &nbsp;</td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> <td><? $fnc = "distribucion_hipergeometrica"; $fncN = 12; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?> (Acumulado) </legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td width="50%" align="right"><strong>Exitos en la muestra </strong></td> <td><input name="k3" type="text" size="7" value="<?=$k3?>"></td> </tr> <tr> <td align="right"><strong>Tamaņo Muestra</strong></td> <td><input name="n3" type="text" size="7" value="<?=$n3?>"></td> </tr> <tr> <td align="right"><strong>Exitos en poblacion</strong></td> <td><input name="m3" type="text" size="7" value="<?=$m3?>"></td> </tr> <tr> <td align="right"><strong>Poblacion</strong></td> <td><input name="j3" type="text" size="7" value="<?=$j3?>"></td> </tr> </table> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc?> &nbsp;</td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> </tr> </table> <table width="100%" border="0" cellspacing="5" cellpadding="0"> </table> </fieldset> </td> </tr> <tr> <td><fieldset> <legend>Funciones de valores en la tabla Normal</legend> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td width="50%"> <? $fnc = "area"; $fncN = 13; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?></legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <strong>Valor de Z</strong> <input name="Zval" type="text" size="7" value="<?=$Zval?>"> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc?> &nbsp;</td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> <td><? $fnc = "Z"; $fncN = 14; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?></legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <strong>Area</strong> <input name="A" type="text" size="7" value="<?=$A?>"> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <? if(is_array($$fnc)){ ?> <select> <? foreach($$fnc as $val){ ?> <option><?=$val?></option> <? } ?> </select> <? } else echo $$fnc; ?> &nbsp; </td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> </tr> </table> <table width="100%" border="0" cellspacing="5" cellpadding="0"> </table> </fieldset></td> </tr> <tr> <td><fieldset> <legend>Funciones Distribucion Normal</legend> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td width="50%"> <? $fnc = "desviacion_nomral"; $fncN = 15; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?></legend> <a name="<?=$fncN?>"></a> <br> <br> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td width="50%" align="right"><strong>Tama&ntilde;o muestra (X) </strong></td> <td> <input name="X" type="text" size="7" value="<?=$X?>"></td> </tr> <tr> <td align="right"><strong>Media (&micro;)</strong></td> <td><input name="media" type="text" size="7" value="<?=$media?>"></td> </tr> <tr> <td align="right"><strong>Desviacion (<font face="Courier New, Courier, mono">&Otilde;</font>)</strong></td> <td><input name="desviacion" type="text" size="7" value="<?=$desviacion?>"></td> </tr> </table> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc?> &nbsp;</td> </tr> </table> <br> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> <td><? $fnc = "distribucion_nomral"; $fncN = 16; ?> <form action="#<?=$fnc?>" method="post" name="<?=$fnc?>"> <fieldset> <legend>Hallar <?=ucfirst($fnc)?> (Acumulado) </legend> <a name="<?=$fncN?>"></a> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td width="50%" align="right"><strong>Tama&ntilde;o muestra (X) </strong></td> <td><input name="X" type="text" size="7" value="<?=$X?>"></td> </tr> <tr> <td align="right"><strong>Numero de exitos (n)</strong></td> <td><input name="n4" type="text" size="7" value="<?=$n4?>"></td> </tr> <tr> <td align="right"><strong>Probabilidad de exito (p)</strong></td> <td><input name="p4" type="text" size="7" value="<?=$p4?>"></td> </tr> <tr> <td align="right"><strong>Signo</strong> (opcional)</td> <td> <select name="signo"> <option value="" <?=(!$signo)?"selected":""?>>none</option> <option value="&gt=" <?=($signo==">=")?"selected":""?>>&gt;=</option> <option value="&gt" <?=($signo==">")?"selected":""?>>&gt;</option> <option value="&lt;" <?=($signo=="<=")?"selected":""?>>&lt;=</option> <option value="&lt;" <?=($signo=="<")?"selected":""?>>&lt;</option> </select> </td> </tr> <tr> <td align="right"><strong>P </strong>(opcional)</td> <td><input name="P" type="text" size="7" value="<?=$P?>"></td> </tr> </table> </td> </tr> <tr> <td align="center"><input name="<?=$fnc?>" type="submit" value="Hallar"></td> </tr> <tr> <td align="center" class="result"> <?=$$fnc?> &nbsp;</td> </tr> </table> </fieldset><input type="hidden" name="funcion" value="<?=$fncN?>"> </form> </td> </tr> </table> <table width="100%" border="0" cellspacing="5" cellpadding="0"> </table> </fieldset> </td> </tr> </table> </body> </html>