alvaroxz Posted March 16, 2008 Report Share Posted March 16, 2008 (edited) la wea es que mi hermano me estaba pidiendo ayuda como con 234534875893 ejercisios de ec. 2º con grafico y todo lo primero que dije: puta el profe qliao pesao la kgo y no estaba ni ahi con ayudar a mi hermano xD esa tarea era facil pero tediosa y como andaba haciendo unas weas con php se me ocurrio hacerle un tabulador de ec de 2º: Le dije a mi bro: http://www.mipagina.cl/formulario.php xD y no me wei ma bueno aca esta el script: formulario.php: PD: le agrege html para los mal intencionados que en vez de numero colocan letras entoces con el script de head no se puede escribir solo mas que numeros <html> <head><script language="JavaScript"> var nav4 = window.Event ? true : false; function acceptNum(evt){ // NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57 var key = nav4 ? evt.which : evt.keyCode; return (key <= 13 || (key >= 48 && key <= 57)); } </script> </head> <body> <form action="calculo.php" METHOD="POST"> <table> <tr> <td> <input value="a" type="text" name="a" size="1" maxlength="4" onKeyPress="return acceptNum(event)"><b>X²</b> </td> <td> <input value="b" type="text" name="b" size="1" maxlength="4" onKeyPress="return acceptNum(event)"><b>X</b> </td> <td> <input value="c" type="text" name="c" size="1" maxlength="4" onKeyPress="return acceptNum(event)"> </td> </tr> </table> <input type="submit" value="Calcular"> <input type="reset" value="Limpiar"> </form> </body> </html> ______________________________________________ calculo.php PD: aca el html va para poder escribir ese triangulo del discriminante (Δ) sin ocupar imagenes <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $a = $_POST['a']; $b = $_POST['b']; $c = $_POST['c']; $x = $_POST['x']; if($a == 0) { echo <<<EOT <script> alert('Que no sabes nada, eso pasa a ser una ecuacion de pirmer grado'); </script> EOT; echo '<a href="java script:history.go(-1);">Volver</a>'; } else { $bc = $b*$b; $x1 = (-$b+pow($bc-(4*$a*$c),1/2))/(2*$a); $x2 = (-$b-pow($bc-(4*$a*$c),1/2))/(2*$a); $dis = $bc-4*$a*$c; $abs = -$b/(2*$a); $min_max_rel = $a*$abs*$abs+$b*$abs+$c; echo '<table border="1" bgcolor="yellow"><tr><td>X<sub>1</sub></td><td>'.$x1.'</td></tr><tr><td>X<sub>2</sub></td><td>'.$x2.'</td></tr><tr><td>Conjuto solucion</td><td>'; if($x1 == $x2) { echo '={'.$x1.'}</td></tr>'; } else { echo '={'.$x1.','.$x2.'}'; } echo '<tr><td>Δ</td>'; if($dis == 0) { echo '<td>'.$dis.', la funcion es un cuadrado de binomio</td></tr>'; } else { if($dis < 0) { echo '<td>'.$dis.', la funcion no es factorable</td></tr>'; } else { echo '<td>'.$dis.', la funcion es factorable</td></tr>'; } } echo '<tr><td>Abcisa de la funcion</td><td>'.$abs.'</td></tr><tr><td>Minimo maximo relativo</td><td>'.$min_max_rel.'</td></tr><tr><td>tiene solucion?</td><td>'; if($dis > 0) { echo 'SI, tiene 2 valores reales</td></tr>'; } else { if($dis < 0) { echo 'NO, la funcion nunca toca el eje x</td></tr>'; } else { echo 'Unica, la funcion es tangente al eje x</td></tr>'; } } echo '</table>'; } ?> </body> </html> Edited March 18, 2008 by alvaroxz Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now