Professional Documents
Culture Documents
htm -->
<html><!-- AUTHOR - Robert Gagnon --><!-- AUTHOR - Robert Gagnon --><!-- AUTHOR
- Robert Gagnon --><!-- AUTHOR - Robert Gagnon --><!-- AUTHOR - Robert Gagnon -><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QUARTIC EQUATION CALCULATOR</title>
<meta name="DESCRIPTION" content="QUARTIC equation calculator, 4th degree
polynomial, algebra, algebraic equation calculator">
<meta name="keywords" content="QUARTIC equation calculator, 4th degree polynomia
l,
algebra, algebraic equation calculator">
<script type="text/javascript" async="" src="./QUARTIC EQUATION CALCULATOR_files
/ga.js"></script><script language="JavaScript">
<!-if (parent.frames.length > 0)
{
parent.location.href = location.href;
}
// -->
</script>
<script language="JavaScript">
<!-- Declaring QUARTIC variables -->
<!-- Note that QUARTIC variables end in Q -->
var
var
var
var
var
var
var
var
var
var
var
var
aq=0;
bq=0;
cq=0;
dq=0;
eq=0;
fq=0;
gq=0;
hq=0;
kq=0;
lq=0;
mq=0;
nq=0;
m2=0;
n2=0;
theta=0;
y1=0;
y2=0;
y3=0;
<!-- These are the real and imaginary portions of the cubic equation roots-->
<!-- y2i is ALWAYS POSITIVE y3i is ALWAYS NEGATIVE -->
<!-- y2r and y3r are ALWAYS the SAME SIGN -->
var y2r=0;
var y2i=0;
var y3r=0;
var y3i=0;
<!-- This tests for complex numbers '0' ALL Positive '1' Imaginary '2' Complex->
var compsw=0;
<!-<!-<!-<!-<!-<!-<!-<!-<!--
var negcon=0;
<!-<!-<!-<!--
SWITCH -->
-->
-->
-->
var zercon=0;
var
var
var
var
p=0;
q=0;
r=0;
s=0;
<script language="JavaScript">
function calculate(equations)
{
compsw=0;
document.output.x1.value="";
document.output.x2.value="";
document.output.x3.value="";
document.output.x4.value="";
pxq=0;
aq =
bq =
<!-cq =
dq =
eq =
eval(document.equations.a.value);
eval(document.equations.b.value);bqin=bq;
THIS KEEPS ORIGINAL VALUE OF BQ -->
eval(document.equations.c.value);
eval(document.equations.d.value);
eval(document.equations.e.value);
dnm=aq;
<!--Simplifying by dividing all terms by the aq term called 'dnm' meaning denomi
nator-->
bq=bq/dnm;cq=cq/dnm;dq=dq/dnm;eq=eq/dnm;
<!--Which yields an equation of the form X^4 + AX^3 + BX^2 + CX + D = 0 -->
fq= cq-((3*bq*bq)/8);
gq= dq+ (bq*bq*bq/8) -(bq*cq/2);
hq= eq- (3*bq*bq*bq*bq/256) + (bq*bq*cq/16) - (bq*dq/4);
document.output2.f.value="
"+fq;
document.output2.g.value="
"+gq;
document.output2.h.value="
"+hq;
<!-- CREATING CUBIC EQUATION COEFFICIENTS-->
a=1; b=fq/2; c=((fq*fq)-(4*hq))/16; d= ((gq*gq)/64)*-1;
<!-- *****************************************************************-->
<!-- SOLVING THE RESULTANT CUBIC EQUATION------------------------------->
f = eval(((3*c)/a) - (((b*b)/(a*a))))/3
<!--EVALUATING THE 'g'TERM -->
g = eval((2*((b*b*b)/(a*a*a))-(9*b*c/(a*a)) + ((27*(d/a)))))/27
<!--EVALUATING THE 'h'TERM -->
h = eval(((g*g)/4) + ((f*f*f)/27))
if (h > 0)
{
m = eval(-(g/2)+ (Math.sqrt(h)))
<!-- K is used because math.pow cannot compute negative cube roots -->
k=1
if (m < 0) k=-1; else k=1
m2 = eval(Math.pow((m*k),(1/3)))
m2 = m2*k
k=1
n = eval(-(g/2)- (Math.sqrt(h)))
if (n < 0) k=-1; else k=1
n2 = eval(Math.pow((n*k),(1/3)))
n2 = n2*k
k=1
x1= eval ((m2 + n2) - (b/(3*a)))
<!-((S+U)
- (b/(3*a)))-->
if (h<=0)
{
r = (eval(Math.sqrt((g*g/4)-h)))
k=1
if (r<0) k=-1
<!-- rc is the cube root of 'r' -->
rc = Math.pow((r*k),(1/3))*k
k=1
theta =Math.acos((-g/(2*r)))
x1=eval (2*(rc*Math.cos(theta/3))-(b/(3*a)))
x2a=rc*-1
x2b= Math.cos(theta/3)
x2c= Math.sqrt(3)*(Math.sin(theta/3))
x2d= (b/3*a)*-1
x2=eval(x2a*(x2b + x2c))-(b/(3*a))
x3=eval(x2a*(x2b - x2c))-(b/(3*a))
x1=x1*1E+14;x1=Math.round(x1);x1=(x1/1E+14);
x2=x2*1E+14;x2=Math.round(x2);x2=(x2/1E+14);
x3=x3*1E+14;x3=Math.round(x3);x3=(x3/1E+14);
}
if ((f+g+h)==0)
{
if (d<0) {sign=-1};if (d>=0) {sign=1};
if (sign>0){dans=Math.pow((d/a),(1/3));dans=dans*-1};
if (sign<0){d=d*-1;dans=Math.pow((d/a),(1/3))};
x1=dans; x2=dans;x3=dans;
}
<!-- END OF CUBIC SUBROUTINE -->
<!-- ******************************************************************** -->
y1=x1;y2=x2;y3=x3;
if (Math.abs(y1)<1E-13){y1=0};
if (Math.abs(y2)<1E-13){y2=0};
if (Math.abs(y3)<1E-13){y3=0};
document.output2.y1.value="
document.output2.y2.value="
document.output2.y3.value="
"+y1;
"+y2;
"+y3;
compsw=2;
negcon=0;
zercon=0;
<!-- COMPLEX NUMBER TEST, NEGATIVE TEST AND ZERO TEST -->
<!-- This routine does NOT apply to COMPSW=2 -->
if (h<=0){compsw=0;
<!-- Zero Condition of Resultant Cubic Calculated Here-->
<!-- zercon=0 NO Zeroes; zercon=1 y1=0; zercon=2 y2=0; zercon=4 y3=0; -->
<!-- zercon=3 y1&y2=0; zercon=5 y1&y3=0 -->
<!-- zercon=6 y2&y3=0; zercon=7 ALL Zeroes -->
if (zercon==0){p=Math.sqrt(y1);q=Math.sqrt(y2)}
if (y1==0) {p=Math.sqrt(y2);q=Math.sqrt(y3);zercon=1};
if (y2==0) {p=Math.sqrt(y1);q=Math.sqrt(y3);zercon=zercon+2};
if (y3==0) {p=Math.sqrt(y1);q=Math.sqrt(y2);zercon=zercon+4};
if (zercon==3){p=Math.sqrt(y3);q=0;r=0}
if (zercon==5){p=Math.sqrt(y2);q=0;r=0}
if (zercon==6){p=Math.sqrt(y1);q=0;r=0}
if (zercon==7){p=0;q=0;r=0}
if
if
if
if
}
<!-- COMPSW=0 CUBIC ROOTS ARE REAL AND NONE ARE NEGATIVE -->
if (compsw==0){
if (zercon==0 || zercon==1 || zercon==2 || zercon==4) {r=((-gq)/(8*p*q))};
s=(bqin/(4*aq));
x1=p+q+r-s;
x2=p-q-r-s;
x3=-p+q-r-s;
x4=-p-q+r-s;
document.output.x1.value="
document.output.x2.value="
document.output.x3.value="
document.output.x4.value="
document.output2.p.value="
document.output2.q.value="
document.output2.r.value="
document.output2.s.value="
"+x1;
"+x2;
"+x3;
"+x4;
"+p;
"+q;
"+r;
"+s;
<!-- IF COMPSW=1 CUBIC EQUATION ROOTS ARE REAL BUT AT LEAST -->
<!-- 1 IS NEGATIVE AND 1 ROOT MAY BE ZERO -->
<!-- AND ALL FOUR QUARTIC ROOTS ARE COMPLEX -->
if (compsw==1){
<!-- Determining p q r & s when BOTH p & q are imaginary -->
if(negcon==3){p=Math.sqrt(y1*-1);q=Math.sqrt(y2*-1)};
if(negcon==5){p=Math.sqrt(y1*-1);q=Math.sqrt(y3*-1)};
if(negcon==6 || negcon==7){p=Math.sqrt(y2*-1);q=Math.sqrt(y3*-1)}
if(negcon==3 || negcon==5 ||negcon==6 || negcon==7){
r=((-gq)/(8*p*q*-1));s=(bqin/(4*aq));x1=r-s ;x1a= (p+q); x1a= "i*"+x1a;
x2=-r-s ;x2a= (p-q); x2a= "i*"+x2a; x3=-r-s ;x3a= (-p+q); x3a= "i*"+x3a;
x4=r-s ;x4a= (-p-q); x4a= "i*"+x4a};
<!-- Determining p q r & s when ONLY p is imaginary -->
if(negcon==1){y2=y2+y3; p=Math.sqrt(y1*-1);q=Math.sqrt(y2)};
if(negcon==2){y3=y1+y3; p=Math.sqrt(y2*-1);q=Math.sqrt(y3)};
if(negcon==4){y1=y1+y2; p=Math.sqrt(y3*-1);q=Math.sqrt(y1)};
if(negcon==1 || negcon==2 || negcon==4){
r=((-gq)/(8*p*q*-1));s=(bqin/(4*aq));
x1=r-s+q ; x1a=p; x1a= "i*"+x1a;
x2=-r-s -q; x2a=p; x2a= "i*"+x2a;
x3=-r-s+q ; x3a=-p; x3a= "i*"+x3a;
x4=r-s-q ; x4a=-p; x4a= "i*"+x4a}
<!-- X1= p+q+r-s
X2= p-q-r-s
document.output.x1.value="
document.output.x2.value="
document.output.x3.value="
document.output.x4.value="
document.output2.p.value="
document.output2.q.value="
document.output2.r.value="
document.output2.s.value="
}
if (compsw==2){
"+ x1
"+ x2
"+ x3
"+ x4
i*"+p;
i*"+q;
"+r;
"+s;
"
"
"
"
&
&
&
&
"
"
"
"
+x1a;
+x2a;
+x3a;
+x4a;
<!-<!-<!-<!-<!--
<!-- Y1 Rounding ONLY for test purposes Y2 and Y3 are ALWAYS USED HERE -->
if (Math.abs(y1)<1E-13){y1=0};
<!-- CALCULATING SQUARE ROOTS OF Y2 and Y3 WHICH ARE ALWAYS COMPLEX NUMBERS -->
r2mod=Math.sqrt(y2r*y2r + y2i*y2i);
y2mod=Math.sqrt((r2mod-y2r)/2);
x2mod=y2i/(2*y2mod);
if (Math.abs(r2mod)<1E-13){r2mod=0};
if (Math.abs(x2mod)<1E-13){x2mod=0};
if (Math.abs(y2mod)<1E-13){y2mod=0};
p=x2mod + y2mod;
r3mod=Math.sqrt(y3r*y3r + y3i*y3i);
y3mod=Math.sqrt((r3mod-y3r)/2);
x3mod=y3i/(2*y3mod);
if (Math.abs(r3mod)<1E-13){r3mod=0};
if (Math.abs(y3mod)<1E-13){y3mod=0};
if (Math.abs(x3mod)<1E-13){x3mod=0};
q=x3mod+y3mod;
pxq=(x2mod*x3mod)+(y2mod*y3mod);
r=((-gq)/(8*pxq));
s=(bqin/(4*aq));
if
if
if
if
(Math.abs(p)<1E-13){p=0};
(Math.abs(q)<1E-13){q=0};
(Math.abs(r)<1E-13){r=0};
(Math.abs(s)<1E-13){s=0};
<!--x1=p+q+r-s;x2=p-q-r-s;x3=-p+q-r-s;x4=-p-q+r-s;-->
x1=x2mod+x3mod+r-s;
if (Math.abs(x1)<1E-13){x1=0};
x2=x2mod-x3mod-r-s;
x3=-x2mod+x3mod-r-s;
x4=-x2mod-x3mod+r-s;
if (Math.abs(x4)<1E-13){x4=0};
document.output.x1.value="
document.output.x2.value="
document.output.x3.value="
document.output.x4.value="
document.output2.p.value="
document.output2.q.value="
document.output2.r.value="
document.output2.s.value="
}
}
"+x1;
"+x2 +" +i* "+(y2mod+y3mod);
"+x3 +" -i* "+(y2mod+y3mod);
"+x4;
"+x2mod +" +i*"+ y2mod;
"+x3mod +" -i*"+ y3mod;
"+r;
"+s;
</script>
<script src="./QUARTIC EQUATION CALCULATOR_files/google_analytics_auto.js"></scr
ipt></head>
<!-- B O D Y ************************************************** -->
<body bgcolor="EEEEEE" text="#CC0000">
<p>
<font face="Arial">
</font></p><center><font face="Arial">
<script type="text/javascript"><!-google_ad_client = "pub-5439459074965585";
/* quartic.htm */
google_ad_slot = "0234747521";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript" src="./QUARTIC EQUATION CALCULATOR_files/show_ads
.js">
</script><ins style="display:inline-table;border:none;height:250px;margin:0;padd
ing:0;position:relative;visibility:visible;width:300px"><ins id="aswift_0_anchor
" style="display:block;border:none;height:250px;margin:0;padding:0;position:rela
tive;visibility:visible;width:300px"><iframe width="300" height="250" frameborde
r="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="
true" scrolling="no" onload="var i=this.id,s=window.google_iframe_oncopy,H=s&
;&s.handlers,h=H&&H[i],w=this.contentWindow,d;try{d=w.document}catch
(e){}if(h&&d&&(!d.body||!d.body.firstChild)){if(h.call){setTimeo
ut(h,0)}else if(h.match){w.location.replace(h)}}" id="aswift_0" name="aswift_0"
style="left:0;position:absolute;top:0;"></iframe></ins></ins>
</font></center><font face="Arial">
<b><hr size="3" noshade="" width="55%" color="000066">
<font size="6">
<center>Quartic Equation Calculator</center>
<hr size="3" noshade="" width="55%" color="000066">
<p>
</p><center>
<table border="0" cellpadding="0" cellspacing="0" width="85%">
<tbody><tr>
<td>
<center>
<font face="Arial"><font size="3"><font color="000099"><b>
<script type="text/javascript"><!-google_ad_client = "pub-5439459074965585";
/* quartic.htm */
google_ad_slot = "0234747521";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript" src="./QUARTIC EQUATION CALCULATOR_files/show_ads
.js">
</script><ins style="display:inline-table;border:none;height:250px;margin:0;padd
ing:0;position:relative;visibility:visible;width:300px"><ins id="aswift_1_anchor
" style="display:block;border:none;height:250px;margin:0;padding:0;position:rela
tive;visibility:visible;width:300px"><iframe width="300" height="250" frameborde
r="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="
true" scrolling="no" onload="var i=this.id,s=window.google_iframe_oncopy,H=s&
;&s.handlers,h=H&&H[i],w=this.contentWindow,d;try{d=w.document}catch
(e){}if(h&&d&&(!d.body||!d.body.firstChild)){if(h.call){setTimeo
<p><b>
</b></p><hr size="3" noshade="" width="55%" color="000066"><b>
<font color="#CC0000">
<center><u>I N S T R U C T I O N S</u></center><p>
</p><center>
<script type="text/javascript"><!-google_ad_client = "pub-5439459074965585";
/* quartic.htm */
google_ad_slot = "0234747521";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript" src="./QUARTIC EQUATION CALCULATOR_files/show_ads
.js">
</script><ins style="display:inline-table;border:none;height:250px;margin:0;padd
ing:0;position:relative;visibility:visible;width:300px"><ins id="aswift_2_anchor
" style="display:block;border:none;height:250px;margin:0;padding:0;position:rela
tive;visibility:visible;width:300px"><iframe width="300" height="250" frameborde
r="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="
true" scrolling="no" onload="var i=this.id,s=window.google_iframe_oncopy,H=s&
;&s.handlers,h=H&&H[i],w=this.contentWindow,d;try{d=w.document}catch
(e){}if(h&&d&&(!d.body||!d.body.firstChild)){if(h.call){setTimeo
ut(h,0)}else if(h.match){w.location.replace(h)}}" id="aswift_2" name="aswift_2"
style="left:0;position:absolute;top:0;"></iframe></ins></ins>
</center>
<font size="3"><font color="#000099">
1) Do NOT enter commas.<br>
2) Make sure that you have entered a number in ALL boxes (A, B, C, D and E).<br>
3) If you are entering an equation with a 'missing' term (for example, no X<sup>
3</sup>
term, then enter it as zero. (Do NOT leave the field blank).<p>
4) If an equation has a term with no coefficient, enter it as 1 (and not 0 or bl
ank). For
example, the equation X<sup>4</sup> + 6 X<sup>3</sup> + 10 X<sup>2</sup> + X &nb
sp; =
0
would be entered as:</p><p>
</p><center>A=1 B=6 C=10 D=1 E=0 </cente
r>
<br>
NOTE: This calculator has been rigorously debugged.<br>
However, if you think it may have calculated an incorrect answer, please send
us an E-Mail.<br>
And remember - you should <i>always</i> check your answers. Thank you.
<p><b>
</b></p><hr size="3" noshade="" width="55%" color="000066"><b>
<br><p>
</p><center>
<font color="#000099">
<font size="3">
To see the method for solving quartic equations, click <a href="http://www.1728.
org/quartic2.htm">HERE</a>
</font></font></center><font color="#000099"><font size="3">
<p>
If you want to use the "long hand" method for solving quartics, you may
find the information in the boxes below very helpful to check your
work as you go along.<br>
Remember, doing this by hand is VERY laborious, time-consuming and the
possibility for making errors is HUGE.
</p><center>
<form name="output2">