Solver Quadratic Formula
Algebra
->
Algebra
->
Quadratic Equations and Parabolas
-> Solver Quadratic Formula
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:
Algebra Solved!™
: algebra software solves algebra homework problems with step-by-step help!
Ad:
Algebrator™
solves your algebra problems and provides step-by-step explanations!
Quadratics: solvers
Practice!
Problems, free tutors
Lessons
Word Problems
In Depth
Source code of 'Quadratic Formula'
This Solver (Quadratic Formula)
was created by by
jim_thompson5910(13794)
:
View Source
,
Show
,
Put on YOUR site
About jim_thompson5910
:
==section input Enter the coefficients of the quadratic in the form of {{{ax^2+bx+c=0}}} (note: a cannot equal zero). For instance, if you want to solve the quadratic {{{x^2+2x+3=0}}} enter {{{a=1}}}, {{{b=2}}}, and {{{c=3}}} a=*[input a=1] b=*[input b=2] c=*[input c=3] Make sure you enter <font size="4"><b>whole</b></font> numbers for a, b, and c. If you have something like {{{0.2x^2+5x+6=0}}} multiply both sides by 10 to get {{{2x^2+50x+60=0}}} which makes every coefficient whole. If you have something like {{{(1/2)x^2+(2/3)x+6=0}}} multiply both sides by the LCD 6 to get {{{3x^2+4x+36=0}}} which makes every coefficient whole. and enter a variable to solve for variable: *[input variable=x] note: This solver is <font size="4"><i>far</i></font> from perfect. If you see an error in either the steps or the solution, please let me know. Also, email me to send me any solver suggestions you would like to see on the site. ==section solution perl $test="$a, $b, $c"; if(($test=~m/\//)&&($test=~m/\./)) { print " Make sure you enter <font size=\"4\"><b>whole</b></font> numbers for a, b, and c. If you have something like {{{0.2x^2+5x+6=0}}} multiply both sides by 10 to get {{{2x^2+50x+60=0}}} which makes every coefficient whole. If you have something like {{{(1/2)x^2+(2/3)x+6=0}}} multiply both sides by the LCD 6 to get {{{3x^2+4x+36=0}}} which makes every coefficient whole. "; return; } if((($a=~/\./)||($b=~/\./))||($c=~/\./)) {print " Once again make sure you enter <font size=\"4\"><b>whole</b></font> numbers for a, b, and c. If you have something like {{{0.2x^2+5x+6=0}}} multiply both sides by 10 to get {{{2x^2+50x+60=0}}} which makes every coefficient whole. "; return;} if((($a=~/\//)||($b=~/\//))||($c=~/\//)) {print "Once again make sure you enter <font size=\"4\"><b>whole</b></font> numbers for a, b, and c. If you have something like {{{(1/2)x^2+(2/3)x+6=0}}} multiply both sides by the LCD 6 to get {{{3x^2+4x+36=0}}} which makes every coefficient whole. "; return;} sub square_root{ my ($sq,$input,$input1,$num,$count,@gcf,$ret,$tick,$square_root_value,$num1,$num2,$sq1,$temp); $input=$_[0]; #my ($sq); $sq= sqrt($input); $square_root_value=sqrt($input); $value=$input; $input1="sqrt($input)"; #$input="sqrt(75)"; if($input=~ m/(\d+)/) {$num=$1;} if($sq!~/\./) { $ret="$sq"; return $ret; } $tick=0; for($count=1;$count<$num;$count++) { if($num%$count==0) {$gcf[$tick]=$count; $tick++;} } if($tick==0) {$ret="$input1"; return $ret;} for($count=1;$count<($size=@gcf);$count++) { $sq=sqrt($gcf[$count]); if($sq!~/\./) {#print "\n $gcf[$count] is a perfect square \n"; $num1=$gcf[$count]} } if($num1==0) {$ret="$input1"; return $ret; } if($num1!=0) {$num2=$num/$num1; $sq1=sqrt($num2); $sq=sqrt($num1); if($sq1!~/\./) { $temp=$sq*$sq1; $ret="$temp"; return $ret; } if($sq1=~/\./) { $ret="$sq*sqrt($num2)"; return $ret; } } } ################################### sub mult{ my ($split,@arr1,@arr2,$temp1,$temp2, @hold); $split=$_[0]; @hold=split(/;/,$split); @arr1=split(/,/,$hold[0]); $arr1[2]=$arr1[1]; $arr1[1]="/"; @arr2=split(/,/,$hold[1]); $arr2[2]=$arr2[1]; $arr2[1]="/"; #print "arr1=@arr1\n\n"; $temp1=$arr1[0]*$arr2[0]; $temp2=$arr1[2]*$arr2[2]; #$temp1=$numer1*$numer2; #$temp2=$denom1*$denom2; return ($temp1,"/",$temp2); } sub add{ my ($split,@arr1,@arr2, @hold, @tempfrac, $gcf); $split=$_[0]; @hold=split(/;/,$split); @arr1=split(/,/,$hold[0]); $arr1[2]=$arr1[1]; $arr1[1]="/"; @arr2=split(/,/,$hold[1]); $arr2[2]=$arr2[1]; $arr2[1]="/"; if(($arr1[2]!=$arr2[2])&&(($arr1[2]!=0)&&($arr2[2]!=0))) { for(my $count=1;$count<abs($arr1[2]*$arr2[2]);$count++) {if(($arr1[2]%$count==0)&&($arr2[2]%$count==0)) {$gcf=$count;} } my $lcm=($arr1[2]*$arr2[2])/$gcf; my $temp=$lcm/$arr1[2]; $exported_lcm=$lcm; $exported_gcf=$gcf; $arr1[0]=($lcm/$arr1[2])*$arr1[0]; $arr2[0]=($lcm/$arr2[2])*$arr2[0]; $arr1[2]=($lcm/$arr1[2])*$arr1[2]; $arr2[2]=($lcm/$arr2[2])*$arr2[2]; } $tempfrac1[0]=$arr1[0]+$arr2[0]; $tempfrac2[0]=$arr1[2]; return ($tempfrac1[0],"/",$tempfrac2[0]); } sub subtract{ my ($split,@arr1,@arr2, @hold, @tempfrac, $gcf); $split=$_[0]; @hold=split(/;/,$split); @arr1=split(/,/,$hold[0]); $arr1[2]=$arr1[1]; $arr1[1]="/"; @arr2=split(/,/,$hold[1]); $arr2[2]=$arr2[1]; $arr2[1]="/"; if(($arr1[2]!=$arr2[2])&&(($arr1[2]!=0)&&($arr2[2]!=0))) { for($count=1;$count<abs($arr1[2]*$arr2[2]);$count++) {if(($arr1[2]%$count==0)&&($arr2[2]%$count==0)) {$gcf=$count;} } my $lcm=($arr1[2]*$arr2[2])/$gcf; my $temp=$lcm/$arr1[2]; $exported_lcm=$lcm; $exported_gcf=$gcf; $arr1[0]=($lcm/$arr1[2])*$arr1[0]; $arr2[0]=($lcm/$arr2[2])*$arr2[0]; $arr1[2]=($lcm/$arr1[2])*$arr1[2]; $arr2[2]=($lcm/$arr2[2])*$arr2[2]; } $tempfrac1[0]=$arr1[0]-$arr2[0]; $tempfrac2[0]=$arr1[2]; return ($tempfrac1[0],"/",$tempfrac2[0]); } sub reduce{ my (@arr1, @original_arr1, $flag); #$arr1[0]=$_[0]; #$arr1[1]="/"; #$arr1[2]=$_[1]; @arr1=@_; $arr1[2]=$arr1[1]; $arr1[1]="/"; @original_arr1=@arr1; $flag=$_[2]; if($arr1[0]==0) {return $arr1[0];} if($arr1[2]!=0) { $store=$arr1[0]/$arr1[2]; if($store>0) { $arr1[0]=abs($arr1[0]); $arr1[2]=abs($arr1[2]); } if(($store<0)&&($arr1[2]<0)) { $arr1[0]=0-$arr1[0]; $arr1[2]=abs($arr1[2]); } if($arr1[0]%$arr1[2]==0) { if($flag==1) {$arr1[0]=$arr1[0]/$arr1[2]; return $arr1[0];} if($flag==2) {$arr1[0]=$arr1[0]/$arr1[2]; $arr1[2]=1; return ($arr1[0],"/",$arr1[2]);} # if($flag==0) # {return $quotient;} } } for (my $i=abs($arr1[0]*$arr1[2]); $i>1; $i--) { if (($arr1[0]%$i==0)&&($arr1[2]%$i==0)) { $arr1[0]/=$i; $arr1[2]/=$i; my $j=$i; } } if($original_arr1[0]==$arr1[0]) {$exported_no_reduce=1;} return ($arr1[0],"/",$arr1[2]); } sub invert{ my(@arr1,$temp); @arr1=@_; $temp=$arr1[0]; $arr1[0]=$arr1[1]; $arr1[1]=$temp; return ($arr1[0], "/", $arr1[1]); } sub divide{ my ($split,@arr1,@arr2,$temp1,$temp2, @hold); $split=$_[0]; @hold=split(/;/,$split); @arr1=split(/,/,$hold[0]); $arr1[2]=$arr1[1]; $arr1[1]="/"; @arr2=split(/,/,$hold[1]); $arr2[2]=$arr2[1]; $arr2[1]="/"; #print "arr1=@arr1\n\n"; $temp1=$arr1[0]*$arr2[2]; $temp2=$arr1[2]*$arr2[0]; #$temp1=$numer1*$numer2; #$temp2=$denom1*$denom2; return ($temp1,"/",$temp2); } ################################### if($a==0) {print "<font size=4 color=red><b>ERROR: NOT A QUADRATIC</b></font> When a=0, this means we have the equation {{{0x^2+$b $variable +$c=0}}} which becomes {{{$b $variable+$c=0}}} which is a linear equation and <font size=4><b>not</b></font> a quadratic. So that means the quadratic formula does not apply. "; return undef;} #################### ERROR AND INPUT CHECK my @temp=($a,$b,$c); @temp=map{s/\-//g;$_} @temp; for(my $i=0; $i<@temp; $i++) { if($temp[$i]=~m/\D/) { print "<font color=red>Error: Enter WHOLE numbers only.</font>"; print " If you need to enter fractions, multiply EVERY term by the LCD to make the numbers whole. If you need to enter decimal values, multiply EVERY number by some factor of 10 (to move the decimal point) to make the values whole. "; return; } } ###############Convert decimal to whole (insert back in if needed) ## EXTRA STUFF $extra_toggle=0; $vertex=-$b/(2*$a); $negated_eval=$a*(-$b/(2*$a))**2+$b*(-$b/(2*$a))+$c; $negated_original="-$a*(x-$vertex)^2+$negated_eval"; $negated_original_string=$negated_original; $negated_original_string=~s/\-\-/\+/g; $negated_original_string=~s/\+\-/\-/g; if((-$negated_eval/-$a)>0) {$negated_root1=sqrt(-$negated_eval/-$a)+$vertex; $negated_root2=-sqrt(-$negated_eval/-$a)+$vertex;} #$negated_root2=(-$negated_b-sqrt($negated_b**2-4*$negated_a*$negated_c))/(2*$negated_a); $complex_radius=abs($negated_root1-$negated_root2)/2; $complex_center=($negated_root1+$negated_root2)/2; $original_string="$a*$variable^2+$b*$variable+$c"; $original_string_with_zero=$original_string; #$original_string=~s/\D0\*x//; ## needs work? $original_string=~s/\D0\*[a-z]//; ## needs work? $original_string=~s/\+\+/\+/g; $original_string=~s/\+\-/\-/g; $original_string=~s/^1\*//g; $original_string=~s/\-1\*/\-/g; $original_string=~s/\+1\*/\+/g; $original_graph=$original_string; $original_graph=~s/[a-z]/x/g; $original_string_with_zero=~s/\+\+/\+/g; $original_string_with_zero=~s/\+\-/\-/g; $original_string_with_zero=~s/^1\*//g; $original_string_with_zero=~s/\-1\*/\-/g; $original_string_with_zero=~s/\+1\*/\+/g; print "Let's use the quadratic formula to solve for $variable:\n\n"; $start_string_quadratic= print " Starting with the general quadratic {{{a$variable^2+b$variable+c=0}}} the general solution using the quadratic equation is: {{{$variable = (-b +- sqrt( b^2-4*a*c ))/(2*a)}}}"; $equa="-$b +- sqrt( ($b)^2-4*$a*$c ))/(2*$a)"; $equa=~s/^\-/q/; $equa=~s/\-\-/\+/g; $equa=~s/^\+//; $equa=~s/q/\-/; $equa=~s/^\-0/0/; ## remove -0 if(($b==0)||($c==0)) { if($b==0) { $note1="(note: since the polynomial does not have an \"x\" term, the 2nd coefficient is zero. In other words, b=0. So that means the polynomial really looks like {{{$original_string_with_zero=0}}} ";} if($c==0) { $note1="(note: since the polynomial does not have a constant term, the 3rd coefficient is zero. In other words, c=0. So that means the polynomial really looks like {{{$original_string_with_zero=0}}} ";} if(($b==0)&&($c==0)) { $note1="(note: since the polynomial does not have an \"x\" term or a constant term, the 2nd and 3rd coefficient are zero. In other words, b=0 and c=0. So that means the polynomial really looks like {{{$original_string_with_zero=0}}} ";} } else {$note1="(";} print " So lets solve {{{$original_string=0}}} $note1 notice {{{a=$a}}}, {{{b=$b}}}, and {{{c=$c}}}) {{{$variable = ($equa}}} Plug in a=$a, b=$b, and c=$c "; if($equa=~m/\-\-/) {$equa=~s/\-\-/\+/g; $equa=~s/^\+//; #$test=abs($b); print " {{{$variable = ($equa}}} Negate $b to get ", abs($b)," ";} $b_temp=$b**2; $c_temp=-4*$c*$a; $equa="-$b +- sqrt( $b_temp-4*$a*$c ))/(2*$a)"; $equa=~s/\-\-/\+/g; $equa=~s/^\+//; $equa=~s/^\-0/0/; ## remove -0 print " {{{$variable = ($equa}}} Square $b to get $b_temp ", ($b<0)? "(note: remember when you square $b, you must square the negative as well. This is because {{{($b)^2=$b*$b=$b_temp}}}.)":""; print" "; $equa="-$b +- sqrt( $b_temp+$c_temp ))/(2*$a)"; $equa=~s/\-\-/\+/g; $equa=~s/^\+//; $equa=~s/^\-0/0/; ## remove -0 print " {{{$variable = ($equa}}} Multiply {{{-4*$c*$a}}} to get {{{$c_temp}}} "; $add=(-4*$c*$a)+$b_temp; $equa="-$b +- sqrt( $add ))/(2*$a)"; $equa=~s/\-\-/\+/g; $equa=~s/^\+//; $equa=~s/^\-0/0/; ## remove -0 print " {{{$variable = ($equa}}} Combine like terms in the radicand (everything under the square root) "; if($add<0) { #$imaginary="i"; $original_add=$add; $add=abs($add); $radicand1=square_root($add); $radicand1=~s/sqrt/i*sqrt/; if($radicand1!~/sqrt/) {$radicand1="$radicand1"."*i";} $equa="-$b +- $radicand1)/(2*$a)"; $equa=~s/\-\-/\+/g; $equa=~s/^\+//; $equa=~s/^\-0/0/; ## remove -0 # since we cannot take the square root of a negative value, we must factor {{{sqrt($original_add)}}} #to {{{i*sqrt($add)}}} to make the radicand positive. print " {{{$variable = ($equa}}} Simplify the square root (note: If you need help with simplifying the square root, check out this <a href=http://www.algebra.com/algebra/homework/Radicals/simplifying-square-roots.solver> solver</a>) "; $equa="-$b +- $radicand1)/(".2*$a.")"; $equa=~s/\-\-/\+/g; $equa=~s/^\+//; $equa=~s/^\-0/0/; ## remove -0 print " {{{$variable = ($equa}}} Multiply 2 and $a to get ", 2*$a ," "; if($radicand1=~/sqrt/) { if($radicand1=~m/(\d+)\*i\*sqrt\((\d+)/) {#@arr1=($1,"/",2*$a); @temp=reduce($1,2*$a); $square_root_value="$temp[0]*sqrt($2)/$temp[2]"; $square_root_value=~s/1\*//;} if(($radicand1!~m/(\d+)\*i\*sqrt\((\d+)/)&&($radicand1=~m/i\*sqrt\((\d+)/)) {#@arr1=(1,"/",2*$a); @temp=reduce(1,2*$a,1); $square_root_value="$temp[0]*sqrt($1)/$temp[2]"; $square_root_value=~s/1\*//;} } else { if($radicand1=~m/(\d+)\*i/) {#@arr1=($1,"/",2*$a); @temp=reduce($1,2*$a,1); $square_root_value="@temp"; #$square_root_value="$arr1[0]/$arr1[2]"; $square_root_value=~s/1\*//;} } #@arr1=(-$b,"/",2*$a); @temp=reduce(-$b,2*$a,1); $first="@temp"; $first=~s/\s//g; $root1="$first + $square_root_value*i"; $root2="$first - $square_root_value*i"; $root1=~s/\+\-/\-/g; $root1=~s/\-\-/\+/g; $root2=~s/\+\-/\-/g; $root2=~s/\-\-/\+/g; $root1=~s/(\D)1\*/\1/g; $root2=~s/(\D)1\*/\1/g; $x_vertex=-$b/(2*$a); $y_vertex=$a*$x_vertex**2+$b*$x_vertex+$c; $root1=~s/\/i/i/; $root2=~s/\/i/i/; $root1=~s/\s//g; $root2=~s/\s//g; $root1=~s/\+\-/\-/g; $root1=~s/\-\-/\+/g; $root2=~s/\+\-/\-/g; $root2=~s/\-\-/\+/g; $x_min=$x_vertex-15; $x_max=$x_vertex+15; $y_min=$y_vertex-15; $y_max=$y_vertex+15; print " After simplifying, the quadratic has roots of {{{$variable=$root1}}} or {{{$variable=$root2}}} Notice if we graph the quadratic {{{y=$original_graph}}}"; if($variable!~m/x/) {print " (just replace $variable with x)";} print ", we get {{{ graph( 500, 500, $x_min, $x_max, $y_min, $y_max, $original_graph) }}} graph of {{{y=$original_graph}}} And we can see that there are no real roots To visually verify the answer, check out <a href=http://www.math.hmc.edu/funfacts/ffiles/10005.1.shtml>this page</a> to see a visual representation of imaginary roots "; #we can see that the quadratic has no x-intercepts. This means there are no real solutions. So this verifies our answer. if($extra_toggle==1) { print " EXTRA: Reflect {{{y=$original_string}}} (red) over the dotted line {{{y=$negated_eval}}} to get {{{y=$negated_original_string}}} (green) {{{drawing( 900, 900, $x_min, $x_max, $y_min, $y_max, graph( 900, 900, $x_min, $x_max, $y_min, $y_max, $original_string,$negated_original), graph( 900, 900, $x_min, $x_max, $y_min, $y_max, $negated_eval*sqrt(sin(5x))/sqrt(sin(5x))) ) }}} Draw a circle in which fits right between the roots of the reflected graph. Plot two points on the circle where the real roots are {{{drawing( 900, 900, $x_min, $x_max, $y_min, $y_max, graph( 900, 900, $x_min, $x_max, $y_min, $y_max, $original_string,$negated_original), graph( 900, 900, $x_min, $x_max, $y_min, $y_max, $negated_eval*sqrt(sin(5x))/sqrt(sin(5x))), circle($complex_center,0,$complex_radius), circle($negated_root1,0,0.08), circle($negated_root1,0,0.10), circle($negated_root2,0,0.08), circle($negated_root2,0,0.10) ) }}} Rotate this circle 90 degrees so the points are now on the top and bottom of the circle {{{drawing( 900, 900, $x_min, $x_max, $y_min, $y_max, graph( 900, 900, $x_min, $x_max, $y_min, $y_max, $original_string,$negated_original), graph( 900, 900, $x_min, $x_max, $y_min, $y_max, $negated_eval*sqrt(sin(5x))/sqrt(sin(5x))), circle($complex_center,0,$complex_radius), circle($complex_center,$complex_radius,0.08), circle($complex_center,$complex_radius,0.10), circle($complex_center,-$complex_radius,0.08), circle($complex_center,-$complex_radius,0.10) ) }}} Now if you use the x-axis as the real axis and the y-axis as the imaginary axis, you can see that the real component is $complex_center and the imaginary component is $complex_radius So this means that the complex roots are \*\[Tex \\LARGE x=$complex_center \\pm $complex_radius i\]. So this visually verifies our answer. "; } #$negated_root1=($b+sqrt((-$b)**2-4*-$a*-$c))/(2*-$a); #$negated_root2=($b-sqrt((-$b)**2-4*-$a*-$c))/(2*-$a); #$complex_radius=abs($negated_root1-$negated_root2)/2; #$complex_center=($negated_root1+$negated_root2)/2; return undef; } #### $radicand=square_root($add); $equa="-$b +- $radicand)/(2*$a)"; $equa=~s/\-\-/\+/g; $equa=~s/^\+//; $equa=~s/^\-0/0/; ## remove -0 print " {{{$variable = ($equa}}} Simplify the square root (note: If you need help with simplifying the square root, check out this <a href=http://www.algebra.com/algebra/homework/Radicals/simplifying-square-roots.solver> solver</a>) "; $a_temp=2*$a; $equa="-$b +- $radicand)/$a_temp"; $equa1="-$b + $radicand)/$a_temp"; $equa2="-$b - $radicand)/$a_temp"; $equa=~s/\-\-/\+/g; $equa=~s/^\+//; $equa1=~s/\-\-/\+/g; $equa1=~s/^\+//; $equa2=~s/\-\-/\+/g; $equa2=~s/^\+//; $equa=~s/^\-0/0/; ## remove -0 $equa1=~s/^\-0/0/; ## remove -0 $equa2=~s/^\-0/0/; ## remove -0 print " {{{$variable = ($equa}}} Multiply 2 and $a to get $a_temp So now the expression breaks down into two parts {{{$variable = ($equa1}}} or {{{$variable = ($equa2}}} "; if($radicand!~m/sqrt/) {$add=-$b+$radicand; print " Lets look at the first part: {{{x=($equa1}}} {{{$variable=$add/$a_temp}}} Add the terms in the numerator"; #@arr1=($add,"/",$a_temp); @final_array=reduce($add,$a_temp); $final="@final_array"; $final=~s/\s//g; $final=~s/\/1$//g; print " {{{$variable=$final}}} Divide So one answer is {{{$variable=$final}}} "; $ans[0]=$final; $add=-$b-$radicand; print " Now lets look at the second part: {{{x=($equa2}}} {{{$variable=$add/$a_temp}}} Subtract the terms in the numerator"; #@arr1=($add,"/",$a_temp); @final_array=reduce($add,$a_temp); $final="@final_array"; $final=~s/\s//g; $final=~s/\/1$//g; print " {{{$variable=$final}}} Divide So another answer is {{{$variable=$final}}}"; $ans[1]=$final; if($ans[0]>$ans[1]) {$x_min=$ans[1]-10; $x_max=$ans[0]+10;} if($ans[1]>=$ans[0]) {$x_min=$ans[0]-10; $x_max=$ans[1]+10;} if($ans[0]!=$ans[1]) {print " So our solutions are: {{{$variable=$ans[0]}}} or {{{$variable=$ans[1]}}} Notice when we graph {{{$original_graph}}}"; if($variable!~m/x/) {print " (just replace $variable with x)";} print ", we get: {{{ graph( 500, 500, $x_min, $x_max, $x_min, $x_max,$a*x^2+$b*x+$c) }}} and we can see that the roots are {{{$variable=$ans[0]}}} and {{{$variable=$ans[1]}}}. This verifies our answer";} if($ans[0]==$ans[1]) {print " So our solutions are: {{{$variable=$ans[0]}}} or {{{$variable=$ans[1]}}} which means we only have one solution {{{x=$ans[0]}}} Notice when we graph {{{$original_graph}}}"; if($variable!~m/x/) {print " (just replace $variable with x)";} print ", we get: {{{ graph( 500, 500, $x_min, $x_max, $x_min, $x_max,$a*x^2+$b*x+$c) }}} and we can see that the only root is {{{$variable=$ans[0]}}}. This verifies our answer";} } if($radicand=~m/sqrt/) {$approx_answer[0]=(-$b + sqrt( $b**2-4*$a*$c ))/(2*$a); $approx_answer[1]=(-$b - sqrt( $b**2-4*$a*$c ))/(2*$a); if($approx_answer[0]>$approx_answer[1]) {$x_min=$approx_answer[1]-10; $x_max=$approx_answer[0]+10;} if($approx_answer[1]>=$approx_answer[0]) {$x_min=$approx_answer[0]-10; $x_max=$approx_answer[1]+10;} @arr1=(); #@arr1=(-$b,"/",2*$a); @tempor1=reduce(-$b,2*$a,1); $frac1="@tempor1"; if($radicand=~m/(\d+)\*sqrt\((\d+)/) { @arr1=(); #@arr1=($1,"/",2*$a); @tempor2=reduce($1,2*$a); $frac2="@tempor2"; $argument=$2; } else { @arr1=(); #@arr1=(1,"/",2*$a); @tempor2=reduce(1,2*$a); $frac2="@tempor2"; $frac2="1/".2*$a."";} if($radicand=~m/sqrt\((\d+)/) {$argument=$1;} $split1="{{{$variable=-$b/".2*$a."+$radicand/".2*$a."}}}"; $split2="{{{$variable=-$b/".2*$a."-$radicand/".2*$a."}}}"; $simplified_ans1="{{{$variable=$frac1+$tempor2[0]*sqrt($argument)/$tempor2[2]}}}"; $simplified_ans2="{{{$variable=$frac1-$tempor2[0]*sqrt($argument)/$tempor2[2]}}}"; #$simplified_ans2="{{{$variable=$frac1-$frac2*sqrt($argument)}}}"; $simplified_ans1=~s/\+\-/\-/; $simplified_ans1=~s/\-\-/\+/; $simplified_ans2=~s/\+\-/\-/; $simplified_ans2=~s/\-\-/\+/; $simplified_ans1=~s/1\*//; $simplified_ans2=~s/1\*//; $simplified_ans1=~s/\/1}}}$/}}}/; $simplified_ans2=~s/\/1}}}$/}}}/; $split1=~s/\+\-/\-/; $split1=~s/\-\-/\+/; $split2=~s/\+\-/\-/; $split2=~s/\-\-/\+/; $split1=~s/=\-0/=0/; ## remove -0 $split2=~s/=\-0/=0/; ## remove -0 print " Now break up the fraction $split1 or $split2 Simplify $simplified_ans1 or $simplified_ans2 So these expressions approximate to {{{$variable=$approx_answer[0]}}} or {{{$variable=$approx_answer[1]}}} So our solutions are: {{{$variable=$approx_answer[0]}}} or {{{$variable=$approx_answer[1]}}} Notice when we graph {{{$original_graph}}}"; if($variable!~m/x/) {print " (just replace $variable with x)";} print ", we get: {{{ graph( 500, 500, $x_min, $x_max, $x_min, $x_max,$a*x^2+$b*x+$c) }}} when we use the root finder feature on a calculator, we find that {{{x=$approx_answer[0]}}} and {{{x=$approx_answer[1]}}}.So this verifies our answer"; } ==section output ==section check angle=40 angle1=50