Difference between revisions of "Vertex equations of a quadratic function and it's inverse"
From JSXGraph Wiki
Jump to navigationJump to searchA WASSERMANN (talk | contribs) (Created page with "<jsxgraph width="300" height="300" box="box1"> (function() { var b = JXG.JSXGraph.initBoard('box1', {boundingbox: [-5, 5, 5, -5], grid:true}); var v = b.create('point', [0,0], {n...") |
A WASSERMANN (talk | contribs) |
||
(37 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | A parabola can be uniquely defined by its vertex <math>V=(v_x, v_y)</math> and one more point <math>P=(p_x, p_y)</math>. | ||
+ | The function term of the parabola then has the form | ||
+ | |||
+ | :<math>y = a (x-v_x)^2 + v_y.</math> | ||
+ | |||
+ | <math>a</math> can be determined by solving | ||
+ | |||
+ | :<math>p_y = a (p_x-v_x)^2 + v_y</math> for <math>a</math> which gives | ||
+ | |||
+ | :<math> a = (p_y - v_y) / (p_x - v_x)^2 .</math> | ||
+ | |||
+ | |||
<jsxgraph width="300" height="300" box="box1"> | <jsxgraph width="300" height="300" box="box1"> | ||
(function() { | (function() { | ||
var b = JXG.JSXGraph.initBoard('box1', {boundingbox: [-5, 5, 5, -5], grid:true}); | var b = JXG.JSXGraph.initBoard('box1', {boundingbox: [-5, 5, 5, -5], grid:true}); | ||
var v = b.create('point', [0,0], {name:'V'}), | var v = b.create('point', [0,0], {name:'V'}), | ||
− | p = b.create('point', [3,3], { | + | p = b.create('point', [3,3], {name:'P'}), |
f = b.create('functiongraph', [ | f = b.create('functiongraph', [ | ||
function(x) { | function(x) { | ||
var den = p.X()- v.X(), | var den = p.X()- v.X(), | ||
a = (p.Y() - v.Y()) / (den * den); | a = (p.Y() - v.Y()) / (den * den); | ||
− | return a * (x - v.X()) + v.Y(); | + | return a * (x - v.X()) * (x - v.X()) + v.Y(); |
}]); | }]); | ||
})(); | })(); | ||
</jsxgraph> | </jsxgraph> | ||
+ | === JavaScript code === | ||
+ | <source lang="javascript"> | ||
+ | var b = JXG.JSXGraph.initBoard('box1', {boundingbox: [-5, 5, 5, -5], grid:true}); | ||
+ | var v = b.create('point', [0,0], {name:'V'}), | ||
+ | p = b.create('point', [3,3], {name:'P'}), | ||
+ | f = b.create('functiongraph', [ | ||
+ | function(x) { | ||
+ | var den = p.X()- v.X(), | ||
+ | a = (p.Y() - v.Y()) / (den * den); | ||
+ | return a * (x - v.X()) * (x - v.X()) + v.Y(); | ||
+ | }]); | ||
+ | |||
+ | })(); | ||
+ | </source> | ||
+ | |||
+ | ===Inverse quadratic function=== | ||
+ | Conversely, also the inverse quadratic function can be uniquely defined by its vertex <math>V</math> and one more point <math>P</math>. | ||
+ | The function term of the inverse function has the form | ||
+ | |||
+ | :<math>y = \sqrt{(x-v_x)/a} + v_y.</math> | ||
+ | |||
+ | <math>a</math> can be determined by solving | ||
+ | |||
+ | :<math>p_y = \sqrt{(p_x-v_x)/a} + v_y</math> for <math>a</math> which gives | ||
+ | |||
+ | :<math>a = (p_x - v_x) / (p_y - v_y)^2.</math> | ||
+ | |||
+ | |||
+ | <jsxgraph width="300" height="300" box="box2"> | ||
+ | (function() { | ||
+ | var b = JXG.JSXGraph.initBoard('box2', {boundingbox: [-5, 5, 5, -5], grid:true}); | ||
+ | var v = b.create('point', [0,0], {name:'V'}), | ||
+ | p = b.create('point', [3,3], {name:'P'}), | ||
+ | f = b.create('functiongraph', [ | ||
+ | function(x) { | ||
+ | var den = p.Y()- v.Y(), | ||
+ | a = (p.X() - v.X()) / (den * den), | ||
+ | sign = (p.Y() >= 0) ? 1 : -1; | ||
+ | return sign * Math.sqrt((x - v.X()) / a) + v.Y(); | ||
+ | }]); | ||
+ | |||
+ | })(); | ||
+ | </jsxgraph> | ||
+ | === JavaScript code === | ||
+ | <source lang="javascript"> | ||
+ | var b = JXG.JSXGraph.initBoard('box2', {boundingbox: [-5, 5, 5, -5], grid:true}); | ||
+ | var v = b.create('point', [0,0], {name:'V'}), | ||
+ | p = b.create('point', [3,3], {name:'P'}), | ||
+ | f = b.create('functiongraph', [ | ||
+ | function(x) { | ||
+ | var den = p.Y()- v.Y(), | ||
+ | a = (p.X() - v.X()) / (den * den), | ||
+ | sign = (p.Y() >= 0) ? 1 : -1; | ||
+ | return sign * Math.sqrt((x - v.X()) / a) + v.Y(); | ||
+ | }]); | ||
+ | </source> | ||
+ | |||
[[Category:Examples]] | [[Category:Examples]] | ||
[[Category:Calculus]] | [[Category:Calculus]] | ||
[[Category:Interpolation]] | [[Category:Interpolation]] |
Latest revision as of 16:18, 15 January 2021
A parabola can be uniquely defined by its vertex [math]V=(v_x, v_y)[/math] and one more point [math]P=(p_x, p_y)[/math]. The function term of the parabola then has the form
- [math]y = a (x-v_x)^2 + v_y.[/math]
[math]a[/math] can be determined by solving
- [math]p_y = a (p_x-v_x)^2 + v_y[/math] for [math]a[/math] which gives
- [math] a = (p_y - v_y) / (p_x - v_x)^2 .[/math]
JavaScript code
var b = JXG.JSXGraph.initBoard('box1', {boundingbox: [-5, 5, 5, -5], grid:true});
var v = b.create('point', [0,0], {name:'V'}),
p = b.create('point', [3,3], {name:'P'}),
f = b.create('functiongraph', [
function(x) {
var den = p.X()- v.X(),
a = (p.Y() - v.Y()) / (den * den);
return a * (x - v.X()) * (x - v.X()) + v.Y();
}]);
})();
Inverse quadratic function
Conversely, also the inverse quadratic function can be uniquely defined by its vertex [math]V[/math] and one more point [math]P[/math]. The function term of the inverse function has the form
- [math]y = \sqrt{(x-v_x)/a} + v_y.[/math]
[math]a[/math] can be determined by solving
- [math]p_y = \sqrt{(p_x-v_x)/a} + v_y[/math] for [math]a[/math] which gives
- [math]a = (p_x - v_x) / (p_y - v_y)^2.[/math]
JavaScript code
var b = JXG.JSXGraph.initBoard('box2', {boundingbox: [-5, 5, 5, -5], grid:true});
var v = b.create('point', [0,0], {name:'V'}),
p = b.create('point', [3,3], {name:'P'}),
f = b.create('functiongraph', [
function(x) {
var den = p.Y()- v.Y(),
a = (p.X() - v.X()) / (den * den),
sign = (p.Y() >= 0) ? 1 : -1;
return sign * Math.sqrt((x - v.X()) / a) + v.Y();
}]);