Solver Convert to Vertex Form and Graph
Algebra
->
Quadratic Equations and Parabolas
->
Quadratic Equations Lessons
->
Quadratic Equation Lesson
-> Solver Convert to Vertex Form and Graph
Log On
Quadratics: solvers
Quadratics
Practice!
Practice
Answers archive
Answers
Lessons
Lessons
Word Problems
Word
In Depth
In
Source code of 'Convert to Vertex Form and Graph'
This Solver (Convert to Vertex Form and Graph)
was created by by
ccs2011(207)
:
View Source
,
Show
,
Put on YOUR site
About ccs2011
:
==section input Enter quadratic equation in standard form: --> *[input a=a] x<SUP>2</SUP> + *[input b=b] x + *[input c=c] ==section solution perl if ($a == 0) { print "Sorry, that is not a valid quadratic equation.\n Please try again\n"; return; } my $mid = $b/$a; my $h = $mid/2; my $sq = $h*$h; my $c1 = $a*$sq; my $k = $c - $c1; my $x0 = -$h; my ($txt,$x1,$x2,$y1,$y2); if ($a < 0) { $txt = down; $x1 = $x0 - 10; $x2 = $x0 + 10; $y1 = $k -25; $y2 = $k + 1; }else { $txt = up; $x1 = $x0 - 10; $x2 = $x0 + 10; $y1 = $k -1; $y2 = $k + 25; } print "--> {{{$a*x^2 + ($b)*x + ($c)}}} \n\n"; print "\n Step 1: Group the first 2 terms together, separating them from the constant term.\n\n"; print "\n -->{{{($a*x^2 + ($b)*x) + ($c)}}} \n\n"; print "\n Step 2: Factor out leading coefficient, for completing the square to work, the coefficient of x<SUP>2</SUP> must be 1.\n\n"; print "\n -->{{{$a(x^2 + ($mid)*x) + ($c)}}}\n\n"; print "\n Step 3: Complete the square, Take half of x coefficient and square it. Notice to keep equation balanced you must add this number and subtract it making the net effect zero.\n\n"; print "\n --> {{{$a(x^2 + ($mid)*x + $sq - $sq)+ ($c)}}}\n\n"; print "\n --> {{{$a((x+($h))^2 - $sq)+ ($c)}}}\n\n"; print "\n Step 4: Distribute and add constants.\n\n"; print "\n --> {{{$a(x+($h))^2 -$c1 + $c}}}\n\n"; print "\n --> {{{$a(x+($h))^2 + ($k)}}}\n\n"; print "\n Now it is successfully in vertex form and can be easily graphed.\n The vertex is at ($x0,$k)\n The parabola opens $txt and has a y-intercept at (0, $c)\n Here is a graph of this parabola: \n\n {{{graph(300,300,$x1,$x2, $y1, $y2, $a*x^2+($b)*x+$c)}}}"; ==section output x ==section check = = = a=1 b=0 c=0 k=0