# Solver Computing the Discriminant

Algebra ->  Algebra  -> Quadratic Equations and Parabolas -> Solver Computing the Discriminant      Log On

 Ad: You enter your algebra equation or inequality - Algebrator solves it step-by-step while providing clear explanations. Free on-line demo . Ad: Algebrator™ solves your algebra problems and provides step-by-step explanations! Ad: Algebra Solved!™: algebra software solves algebra homework problems with step-by-step help!

### Source code of 'Computing the Discriminant'

This Solver (Computing the Discriminant) was created by by jim_thompson5910(28536)  : View Source, Show, Put on YOUR site
About jim_thompson5910: I charge \$2 a problem (for steps shown) or \$1 a problem for answers only. Email: jim_thompson5910@hotmail.com Website: http://www.freewebs.com/jimthompson5910/home.html

From {{{\$exp}}} we can see that {{{a=\$a}}}, {{{b=\$b}}}, and {{{c=\$c}}}

" if \$print==1; print "

" if \$print==1; print "

{{{D=(\$b)^2-4(\$a)(\$c)}}} Plug in {{{a=\$a}}}, {{{b=\$b}}}, and {{{c=\$c}}}

" if \$print==1; my \$b_sq=reduce(rat(\$b,2,"^")); print "

{{{D=\$b_sq-4(\$a)(\$c)}}} Square {{{\$b}}} to get {{{\$b_sq}}}

" if \$print==1; my \$ac_temp=reduce(rat(4,\$a,"*")); my \$ac=reduce(rat(\$ac_temp,\$c,"*")); print "

{{{D=\$b_sq-\$ac}}} Multiply {{{4(\$a)(\$c)}}} to get {{{(\$ac_temp)(\$c)=\$ac}}}

" if \$print==1; my \$discriminant=reduce(rat(\$b_sq,\$ac,"-")); if(\$ac=~m/^\-/) { \$ac=~s/^\-//; print "

{{{D=\$b_sq+\$ac}}} Rewrite {{{D=\$b_sq--\$ac}}} as {{{D=\$b_sq+\$ac}}}

" if \$print==1; print "

{{{D=\$discriminant}}} Add {{{\$b_sq}}} to {{{\$ac}}} to get {{{\$discriminant}}}

" if \$print==1; } else {print "

{{{D=\$discriminant}}} Subtract {{{\$ac}}} from {{{\$b_sq}}} to get {{{\$discriminant}}}

" if \$print==1;} if(\$discriminant==0) {print "

Since the discriminant is equal to zero, this means that there is one real solution.

" if \$print==1; return \$discriminant;} if(\$discriminant=~m/^\-/) {print "

Since the discriminant is less than zero, this means that there are two complex solutions. In other words, there are no real solutions.

" if \$print==1;} else {print "

Since the discriminant is greater than zero, this means that there are two real solutions.

" if \$print==1;} return \$discriminant; } #chomp(my \$exp=<>); my \$ans=discriminant(\$exp,1); #print "\n\nANS:\$ans\n\n"; ==section output ==section check