# Rational functions

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Polynomial $\displaystyle{ f }$:

Polynomial $\displaystyle{ g }$:

Rational function $\displaystyle{ \frac{f}{g} }$:

### The underlying JavaScript source code

var board = JXG.JSXGraph.initBoard('box1', {boundingbox: [-10, 4, 10, -4], axis:true});
var p = [];
var q = [];
p[0] = board.create('point', [-1,2], {size:4});
p[1] = board.create('point', [3,-1], {size:4});
var f = JXG.Math.Numerics.lagrangePolynomial(p);
var graph = board.create('functiongraph', [f,-10, 10]);

p.push(board.create('point',[(Math.random()-0.5)*10,(Math.random()-0.5)*3],{size:4}));
board.update();
}

var board2 = JXG.JSXGraph.initBoard('box2', {boundingbox: [-10, 4, 10, -4], axis:true});
q[0] = board2.create('point', [-1,2], {size:4});
q[1] = board2.create('point', [3,-1], {size:4});
var f2 = JXG.Math.Numerics.lagrangePolynomial(q);
var graph2 = board2.create('functiongraph', [f2, -10, 10]);