<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE page SYSTEM "gen/gandraxa.dtd">
<?xml-stylesheet type="text/xsl" href="gen/gandraxa.xsl"?>
<!--
	To see this page properly, install a browser capable of
	interpreting XML/XSL, for example a recent version of:
	- Mozilla Firefox, see http://www.mozilla.com/
	- Google Chrome, see http://www.google.com/
	- Internet Explorer, see http://www.microsoft.com/
	Javascript must be enabled to use this particular page
	containing a form.
-->
<page>
	<head>
		<title>Using the Quadratic Formula</title>
		<url>http://www.gandraxa.com/using_the_quadratic_formula.xml?Var1=3;Var2=1/4;Var3=4</url>
		<menuimg>

			<img>
				<url>img/uqf_menu.jpg</url>
				<alt>Cannonballs have trajectories expressed by quadratic formulas</alt>
				<magnify>img/uqf.jpg</magnify>
			</img>
		</menuimg>
		
		<context>
			<path>
				<home>
					<link loc="int">
						<url>home.xml</url>
						<text>Home</text>
					</link>
				</home>
				<dir>
					<link loc="int">
						<url>articles.xml</url>
						<text>Articles</text>
					</link>
				</dir>
				<doc>Using the Quadratic Formula</doc>
			</path>
		</context>
		
		<author>
			<mail>
				<recipient>hg</recipient>
				<server>gandraxa.com</server>
				<name>Herbert Glarner</name>
			</mail>
		</author>
		
		<publ>
			<event>
				<eventdate><y>2011</y><m>Jun</m><d>02</d></eventdate>
				<eventtext>First published.</eventtext>
			</event>
		</publ>
		
		<furtherreading>
			<readitem>
				<link loc="wiki">
					<url>http://en.wikipedia.org/wiki/Quadratic_equation</url>
					<text>Quadratic equation</text>
				</link> 
				on Wikipedia
			</readitem>
			<readitem>
				<link loc="ext">
					<url>http://www.purplemath.com/modules/sqrquad2.htm</url>
					<text>Deriving the formula</text>
				</link> 
				on Purplemath
			</readitem>
			<readitem>
				<link loc="ext">
					<url>http://ocw.mit.edu/courses/physics/8-01-physics-i-classical-mechanics-fall-1999/video-lectures/lecture-4/</url>
					<text>The Motion of Projectiles</text>
				</link>,
				video lecture 4 of MIT course 18.01 Physics I 
				(in which Prof. Walter Lewin shoots a monkey).
			</readitem>
		</furtherreading>

	</head>
	
	<abstract>
		<p><ptitle>Abstract</ptitle>
			Demonstrates how the solutions of a quadratic equation can be found
			by using the quadratic formula.</p>
	</abstract>


	<part>
		<heading id="A">About</heading>

		<body>
			<p>When a polynomial equation of second degree (quadratic equation) is given in the form</p>
			<math><m_expr><m_lit>ax<sup>2</sup> + bx + c = 0</m_lit></m_expr></math>
			<p>then this page will find the up to 2 real or complex solutions
 
				<formula>x<sub>1</sub></formula> and <formula>x<sub>2</sub></formula>
				(called <em>roots</em>) via the quadratic formula</p>
			<math>
				<m_expr><m_lit valign="16">x<sub>1</sub>, x<sub>2</sub> =<ent>nbsp</ent></m_lit></m_expr>
				<m_expr>
					<m_div>
						<m_numer rows="2">
							<m_expr valign="bottom">
								<m_lit>-b <ent>plusmn</ent><ent>nbsp</ent></m_lit>
							</m_expr>
							<m_expr>
								<m_root>
									<m_radicand rows="1">
										<m_expr><m_lit>b<sup>2</sup> - 4ac</m_lit></m_expr>
									</m_radicand>
								</m_root>
							</m_expr>
						</m_numer>
						<m_denom rows="1"><m_expr><m_lit>2a</m_lit></m_expr></m_denom>
					</m_div>
				</m_expr>
			</math>
			
		</body>
	</part>
	
	<part>
		<heading id="B">Instructions</heading>

		<body>
			<p>Enter the 3 coefficients <code>a</code>, <code>b</code> and <code>c</code>. 
				This page will then find the up to 2 real or complex roots.</p>
			<list>
				<li>Only integers and well-formed fractions will be accepted.
					A denominator of 0 will return an error.</li>
				<li>Use fractions, not decimals (enter <code>1/4</code>, not 
					<code>0.25</code>)</li>
				<li>Don't use mixed numbers (enter <code>5/3</code>, not 
					<code>1 2/3</code>)</li>
				<li>When negative, use the minus sign before the numerator
					(enter <code>-1/3</code>, not <code>1/-3</code>)</li>
				<li>All individual numbers (numerator, denominator) 
					may not exceed 6 digits: this should be enough to demonstrate
					how the formula is used.
					However, even if you make sure, that your input stays 
					within this limit, any intermediate calculation may still exceed 
					the internal maximum number length (28 digits), especially when working
					with fractions, eventhough it uses the 
					<link loc="int">
						<url>visualising_the_euclidean_algorithm.xml</url>
						<text>Euclidean algorithm</text>
					</link> to keep fractions as small as possible.
					You might also experience a timeout, when the server decides
					that you consumed enough of its time.</li>
			</list>
		</body>
	</part>


	<part>
		<heading id="C">Input</heading>

		<body>
			<p>Enter the 3 coefficients <formula>a</formula>, <formula>b</formula> and <formula>c</formula>,
				where <formula>a <ent>ne</ent> 0</formula> 
				(with <formula>a = 0</formula> the quadratic equation would become a linear equation):</p>
			<form id="Sequence">
				a = <input id="Var1" type="text" size="10" maxlength="14" />, 
				b = <input id="Var2" type="text" size="10" maxlength="14" />, 
				c = <input id="Var3" type="text" size="10" maxlength="14" />.
				<input type="submit" value="Show instructions" />
			</form>
		</body>
	</part>
	

	<part>
		<heading id="D">Solutions</heading>

		<body>
<p>With <formula>a = 3</formula>, <formula>b = 1/4</formula>, <formula>c = 4</formula>, we have the quadratic equation:</p><math eq="1"><m_expr><m_div><m_numer rows="2"><m_expr valign="bottom"><m_lit>-1/4 <ent>plusmn</ent><ent>nbsp</ent></m_lit></m_expr><m_expr><m_root><m_radicand rows="1"><m_expr><m_lit>(1/4)<sup>2</sup> - 4<ent>times</ent>3<ent>times</ent>4</m_lit></m_expr></m_radicand></m_root></m_expr></m_numer><m_denom rows="1"><m_expr><m_lit>2<ent>times</ent>3</m_lit></m_expr></m_denom></m_div></m_expr></math><math eq="2"><m_expr><m_div><m_numer rows="2"><m_expr valign="bottom"><m_lit>-1/4 <ent>plusmn</ent><ent>nbsp</ent></m_lit></m_expr><m_expr><m_root><m_radicand rows="1"><m_expr><m_lit>1/16 - 48</m_lit></m_expr></m_radicand></m_root></m_expr></m_numer><m_denom rows="1"><m_expr><m_lit>6</m_lit></m_expr></m_denom></m_div></m_expr></math><math eq="3"><m_expr><m_div><m_numer rows="2"><m_expr valign="bottom"><m_lit>-1/4 <ent>plusmn</ent><ent>nbsp</ent></m_lit></m_expr><m_expr><m_root><m_radicand rows="1"><m_expr><m_lit>-767/16</m_lit></m_expr></m_radicand></m_root></m_expr></m_numer><m_denom rows="1"><m_expr><m_lit>6</m_lit></m_expr></m_denom></m_div></m_expr></math><p>The term underneath the root, <formula>b<sup>2</sup> - 4ac</formula>, is called <em>Discriminant</em>. Its value governs, how many solutions we get, and of what type these solutions are. <ent>dash</ent> Here, the discriminant has a value of <formula>-767/16</formula>. Whenever the discriminant is not 0, there are two solutions, and because the value is negative, both solutions are complex.</p>Simplifying the root by integer factorization, if possible (using the <link loc="wiki"><url>http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes</url><text>Sieve of Eratosthenes</text></link>):<math eq="4"><m_expr><m_root><m_radicand rows="2"><m_expr><m_lit>-</m_lit></m_expr><m_expr><m_div><m_numer rows="1"><m_expr valign="bottom"><m_lit>13 <ent>times</ent> 59</m_lit></m_expr></m_numer><m_denom rows="1"><m_expr><m_lit>2<sup>4</sup></m_lit></m_expr></m_denom></m_div></m_expr></m_radicand></m_root></m_expr><m_expr><m_lit valign="16"><ent>nbsp</ent>=<ent>nbsp</ent></m_lit></m_expr><m_expr valign="bottom"><m_lit></m_lit></m_expr><m_expr valign="bottom"><m_div><m_numer rows="1"><m_expr><m_lit>1</m_lit></m_expr></m_numer><m_denom rows="1"><m_expr><m_lit>4</m_lit></m_expr></m_denom></m_div></m_expr><m_expr><m_lit valign="16">i</m_lit></m_expr><m_expr valign="bottom"><m_root><m_radicand rows="1"><m_expr><m_lit>767</m_lit></m_expr></m_radicand></m_root></m_expr></math><p>Plugging the discriminant back into the formula:</p><math eq="5"><m_expr><m_div><m_numer rows="2"><m_expr valign="bottom"><m_lit>-1/4</m_lit></m_expr><m_expr valign="bottom"><m_lit><ent>nbsp</ent><ent>plusmn</ent><ent>nbsp</ent></m_lit></m_expr><m_expr valign="bottom"><m_lit>(1/4)</m_lit></m_expr><m_expr valign="bottom"><m_lit>i</m_lit></m_expr><m_expr valign="bottom"><m_root><m_radicand rows="1"><m_expr><m_lit>767</m_lit></m_expr></m_radicand></m_root></m_expr></m_numer><m_denom rows="1"><m_expr><m_lit>6</m_lit></m_expr></m_denom></m_div></m_expr></math><p>Calculating the formula's simplest terms:</p><math eq="6"><m_expr valign="bottom"><m_lit>-1/24</m_lit></m_expr><m_expr valign="bottom"><m_lit><ent>nbsp</ent><ent>plusmn</ent><ent>nbsp</ent></m_lit></m_expr><m_expr valign="bottom"><m_lit>(1/24)</m_lit></m_expr><m_expr valign="bottom"><m_lit>i</m_lit></m_expr><m_expr valign="bottom"><m_root><m_radicand rows="1"><m_expr><m_lit>767</m_lit></m_expr></m_radicand></m_root></m_expr></math><p>Hence the two solutions are:</p><math eq="7"><m_expr valign="bottom"><m_lit>-1/24</m_lit></m_expr><m_expr valign="bottom"><m_lit><ent>nbsp</ent>+<ent>nbsp</ent></m_lit></m_expr><m_expr valign="bottom"><m_lit>(1/24)</m_lit></m_expr><m_expr valign="bottom"><m_lit>i</m_lit></m_expr><m_expr valign="bottom"><m_root><m_radicand rows="1"><m_expr><m_lit>767</m_lit></m_expr></m_radicand></m_root></m_expr><m_expr valign="bottom"><m_lit><ent>nbsp</ent> (decimal approx. -0.0416666666666667 + 1.15394853534385<em>i</em>)</m_lit></m_expr></math><p>and</p><math eq="8"><m_expr valign="bottom"><m_lit>-1/24</m_lit></m_expr><m_expr valign="bottom"><m_lit><ent>nbsp</ent>-<ent>nbsp</ent></m_lit></m_expr><m_expr valign="bottom"><m_lit>(1/24)</m_lit></m_expr><m_expr valign="bottom"><m_lit>i</m_lit></m_expr><m_expr valign="bottom"><m_root><m_radicand rows="1"><m_expr><m_lit>767</m_lit></m_expr></m_radicand></m_root></m_expr><m_expr valign="bottom"><m_lit><ent>nbsp</ent> (decimal approx. -0.0416666666666667 - 1.15394853534385<em>i</em>)</m_lit></m_expr></math>
		</body>
	</part>
</page>
