<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<!--
A math practice sheet for factoring quadratic expressions and
solving quadratic equations.
Released under the Creative Commons Attribution-Share Alike 3.0
Unported License (http://creativecommons.org/licenses/by-sa/3.0/)
by Dr. Drang (http://www.leancre.com).
MOdified by Mr. Sentio Henry c/0 CODE+256 on 6:52 PM
Date 7/13/2013
-->
<head>
<title>Quadratic Practice</title>
<style type="text/css">
h1 {
text-align: center;
font-family: Sans-Serif;
font-weight: bold;
font-size: 36px;
margin: 20px 0 30px 0;
padding: 0;
}
table {
width: 100%;
margin-left: auto;
margin-right: auto;
font-family: Sans-Serif;
font-size: 28px;
}
td {
height: 9.5em;
width: 15em;
vertical-align: top;
text-align: center;
}
</style>
<script>
// function answer(a,b,c){
// //single_problem();
//
//
// var x;
// var y ;
// //document.write(Math.sqrt(4));
// x=( -b+ ( Math.sqrt((b*b)-(4*a*c))))/(2*a);
// //echo"X is = \t\t". varx."<br/>";
//
//// document.write(x);
// y=( -b- ( Math.sqrt((b*b)-(4*a*c))))/(2*a);
// term=("x = \t\t\t\t"+ x + "\t\t\t<br/>"+ "Or x =\t\t\t\t"+"\t\t\t"+ y+"<br/>")
// return term ;
//
// } //document.write(answer());
</script>
<script>
function single_problem() {
// Set to true for equations, false for expressions.
var eqn = true;
// Construct the parts of the binomial (a1*x + c1)(a2*x + c2)
// Coefficients. Small numbers, usually 1.
var coeffs = [1, 1, 1, 2, 3, 4]
var a1 = coeffs[Math.floor(Math.random()*6)];
var a2 = coeffs[Math.floor(Math.random()*6)];
// document.write(a2)
// Constants
var c1 = Math.floor(Math.random()*9 + 1);
var c2 = Math.floor(Math.random()*9 + 1);
// document.write();
// Change the signs of the constants at random.
if (Math.random() < .5) {
c1 = -c1;
}
if (Math.random() < .5) {
c2 = -c2;
}
// Put in standard form
var A = a1*a2;
//document.write(A);
var B = a1*c2 + a2*c1;
var C = c1*c2;
var opB = opC = '+';
var quad = 'x<sup>2</sup> '
var lin = 'x '
var a = A ;
var b = B ;
var c= C;
var x;
var y ;
// //document.write(Math.sqrt(4));
x=( -b+ ( Math.sqrt((b*b)-(4*a*c))))/(2*a);
// //echo"X is = \t\t". varx."<br/>";
//
//// document.write(x);
y=( -b- ( Math.sqrt((b*b)-(4*a*c))))/(2*a);
t="x = \t\t\t\t"+ x + "\t\t\t<br/>"+ "Or x =\t\t\t\t"+"\t\t\t"+ y+"<br/>";
//answer(w,z,o);
//document.write( o+"\n\t<br/>" );
// Determine the operators.
if (C < 0) {
opC = '−';
C = -C;
}
if (B < 0) {
opB = '−';
B = -B;
}
else if (B == 0) {
opB = '';
B = '';
lin = '';
}
// Don't show coefficients that are 1.
if (A == 1) A = '';
if (B == 1) B = '';
term = A + quad + opB + ' ' + B + lin + opC + ' ' + C;
terms = term + " = 0";
display =terms + "<br/>" + t;
if (eqn) {
return display ;
}else{
return term;
}
}
// document.write(single_problem());
</script>
</head>
<body bgcolor="000000"style="color:red"><h1
style="color:blue">Quadratic Exercises</h1>
<table id="whole" >
<script>
for (i=0; i<4; i++){
document.write("<tr >");
for (j=0; j<2; j++) {
document.write('<td>' + single_problem() + '</td>');
}
document.write('</tr>');
}
</script>
</table>
</body>
</html>