N-th root: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 1: Line 1:
This example show the various possibilities to plot the graph of the function
:<math> \mathbb{R} \to \mathbb{R}, x \mapsto x^{1/3}</math> 
<jsxgraph width="500" height="500">
<jsxgraph width="500" height="500">
var board = JXG.JSXGraph.initBoard('jxgbox', {
var board = JXG.JSXGraph.initBoard('jxgbox', {
Line 18: Line 22:
===The underlying JavaScript code===
===The underlying JavaScript code===
<source lang="javascript">
<source lang="javascript">
var board = JXG.JSXGraph.initBoard('jxgbox', {
        axis:true,
        boundingbox:[-5, 5, 5, -5],
        showFullscreen: true
});
var plot1 = board.create('functiongraph', ["nthroot(x, 3)"], {withLabel: true, name:'nthroot(x,3)'});
var plot2 = board.create('functiongraph', ["cbrt(x) + 1"], {withLabel: true, name:'cbrt(x)+1', strokeColor: 'black'});
var plot3 = board.create('functiongraph', [(x) => Math.pow(x, 1/3) - 1], {
        withLabel: true,
        name:'Math.pow(x, 1/3) - 1',
        strokeColor: 'red',
        label: {position: 'rt', offset:[-100,-20]}
    });
</source>
</source>


[[Category:Examples]]
[[Category:Examples]]
[[Category:Calculus]]
[[Category:Calculus]]

Revision as of 11:53, 2 April 2020

This example show the various possibilities to plot the graph of the function

[math]\displaystyle{ \mathbb{R} \to \mathbb{R}, x \mapsto x^{1/3} }[/math]

The underlying JavaScript code

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

var plot1 = board.create('functiongraph', ["nthroot(x, 3)"], {withLabel: true, name:'nthroot(x,3)'});
var plot2 = board.create('functiongraph', ["cbrt(x) + 1"], {withLabel: true, name:'cbrt(x)+1', strokeColor: 'black'});
var plot3 = board.create('functiongraph', [(x) => Math.pow(x, 1/3) - 1], {
        withLabel: true, 
        name:'Math.pow(x, 1/3) - 1', 
        strokeColor: 'red',
        label: {position: 'rt', offset:[-100,-20]}
    });