quadratic




JavaScript Source Code 3000: Calculators: Quadratic Equation

































Quadratic Equation








Why didn't I have one of these during high school math? Just enter the coefficients for the 'Ax^2 + Bx + C = 0' equation and JavaScript will output the solutions (if they are not imaginary!). Neat!










Quadratic Equation:Ax2 + Bx + C = 0





A =



B =



C =










X1 =



X2 =












JavaScript Source Code 3000: Calculator: Quadratic Equation
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!




    





<!-- TWO STEPS TO INSTALL QUADRATIC EQUATION:

1. Paste the first coding into the HEAD of your HTML document
2. Put the last script into the BODY of your HTML document -->

<!-- STEP ONE: Copy this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Songzi Du (xdu1@iupui.edu) -->
<!-- Web site: http://members.tripod.com/~Songzidu/mainpageindex.html -->

<! >
<! >

<!-- Begin
function quad(form) {
a=eval(form.a.value);
b=eval(form.b.value);
c=eval(form.c.value);
x1=-b/2/a+Math.pow(Math.pow(b,2)-4*a*c,0.5)/2/a;
x2=-b/2/a-Math.pow(Math.pow(b,2)-4*a*c,0.5)/2/a;
form.x1.value = x1;
form.x2.value = x2;
if (form.x1.value == "NaN") form.x1.value="Imag.!";
if (form.x2.value == "NaN") form.x2.value="Imag.!";
}
// End -->
</SCRIPT>
</head>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>

<center>
<form name=form>
<table border=1 cellpadding=2>
<tr>
<td colspan=2 align=center><b>Quadratic Equation:<br>Ax<sup>2</sup> + Bx + C = 0</b></td>
</tr>
<tr>
<td>
<center><table border=1 width=100% cellpadding=2>
<tr>
<td align=center><b>A = </b></td>
<td align=center><input type=text size=6 name="a"></td>
</tr>
<tr>
<td align=center><b>B = </b></td>
<td align=center><input type=text size=6 name="b"></td>
</tr>
<tr>
<td align=center><b>C = </b></td>
<td align=center><input type=text size=6 name="c"></td>
</tr>
</table>
</td>
<td>
<center><table border=1 width=100% cellpadding=2>
<tr>
<td colspan=2 align=center>
<input type=button value="Solve" onClick="quad(this.form)"></td>
</tr>
<tr>
<td align=center><b>X1 = </b></td>
<td align=center><input type=text size=6 name="x1"></td>
</tr>
<tr>
<td align=center><b>X2 = </b></td>
<td align=center><input type=text size=6 name="x2"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</center>


<!-- Script Size: 2.01 KB -->










Wyszukiwarka

Podobne podstrony:
Pronator Quadratus tape SP
Pronator Quadratus KT method
Quadratus Lumborum testSCR
Quadratus Lumborum Muscle and Iliotibial Band tapeSP
Quadratisches Tuch Anleitung
Quadragesimo anno
Quadratus Lumborum tapeSP
Quadratus Plantae test
Quadratus Lumborum Muscle and Iliotibial Band KT method
1931 05 15 Quadragesimo Anno
Quadratus Lumborum test
The cashflow quadrant

więcej podobnych podstron