Difference between revisions of "Draggable exponential function"

From JSXGraph Wiki
Jump to: navigation, search
Line 1: Line 1:
 
Plot the function
 
Plot the function
''y = e^{ax}''
+
$$y = e^{ax}$$
 
where the parameter ''a'' is determined by the Point ''A=(x_A, x_Y)''.
 
where the parameter ''a'' is determined by the Point ''A=(x_A, x_Y)''.
 
<jsxgraph width="400" height="400" box="box1">
 
<jsxgraph width="400" height="400" box="box1">

Revision as of 10:33, 16 February 2016

Plot the function $$y = e^{ax}$$ where the parameter a is determined by the Point A=(x_A, x_Y).


The JavaScript code

var board = JXG.JSXGraph.initBoard('box1', {boundingbox: [-5, 20, 5, -1], axis:true});

var p = board.create('point', [1, Math.exp(1)]);
var graph = board.create('functiongraph', [
         function(x) {
            var a = Math.log(p.Y()) / p.X();
            return Math.exp(a * x);
         }]);
           
var txt = board.create('text', [-3, 10, function () {
           return "a = " + (Math.log(p.Y()) / p.X()).toFixed(2);
          }], {fontSize: 16});