JSXGraph logo
JSXGraph
JSXGraph share

Share

Discontinuous derivative
QR code
<iframe 
    src="https://www.jsxgraph.org/share/iframe/discontinuous-derivative" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: Discontinuous derivative" 
    allowfullscreen
></iframe>
This code has to
<div id="board-0-wrapper" class="jxgbox-wrapper " style="width: 100%; ">
   <div id="board-0" class="jxgbox" style="aspect-ratio: 1 / 1; width: 100%;" data-ar="1 / 1"></div>
</div>
<div id="board-1-wrapper" class="jxgbox-wrapper " style="width: 100%; ">
   <div id="board-1" class="jxgbox" style="aspect-ratio: 1 / 1; width: 100%;" data-ar="1 / 1"></div>
</div>

<script type = "text/javascript"> 
    /*
    This example is licensed under a 
    Creative Commons Attribution 4.0 International License.
    https://creativecommons.org/licenses/by/4.0/
    
    Please note you have to mention 
    The Center of Mobile Learning with Digital Technology
    in the credits.
    */
    
    const BOARDID0 = 'board-0';
    const BOARDID1 = 'board-1';
    const BOARDID = BOARDID0;

    (function() {
        const board = JXG.JSXGraph.initBoard(BOARDID0, {axis:true, boundingbox:[-1/2, 1/2, 1/2, -1/2]});
    
        var g = board.create('functiongraph', ["2*x*sin(1/x) - cos(1/x)"], {strokeColor: 'red'});
        var f = board.create('functiongraph', ["x^2*sin(1/x)"], {strokeWidth:2});
    })();
    
    (function() {
        const board = JXG.JSXGraph.initBoard(BOARDID1, {axis:true, boundingbox:[-1/2, 0.08, 1.5, -0.02]});
    
        var g_der = board.create('functiongraph', [
            "(0 < x && x < 1) ? ((sin((1 / ((PI * x) * (1 - x)))) * ((2 * (x * ((1 - x)^2))) - (2 * ((x^2) * (1 - x))))) - (((x^2) * ((1 - x)^2)) * (cos((1 / ((PI * x) * (1 - x)))) * (((PI * (1 - x)) - (PI * x)) / (((PI * x) * (1 - x))^2))))) : 0"], 
            {strokeColor: 'red'});
        var g = board.create('functiongraph', ["(0 < x && x < 1) ? x^2*(1-x)^2*sin(1/(PI* x*(1-x))) : 0"],  
            {strokeWidth:2});
    })();
    
 </script> 
/*
This example is licensed under a 
Creative Commons Attribution 4.0 International License.
https://creativecommons.org/licenses/by/4.0/

Please note you have to mention 
The Center of Mobile Learning with Digital Technology
in the credits.
*/

const BOARDID0 = 'your_div_id_0'; // Insert your 1st board id here!
const BOARDID1 = 'your_div_id_1'; // Insert your 2nd board id here!

(function() {
    const board = JXG.JSXGraph.initBoard(BOARDID0, {axis:true, boundingbox:[-1/2, 1/2, 1/2, -1/2]});

    var g = board.create('functiongraph', ["2*x*sin(1/x) - cos(1/x)"], {strokeColor: 'red'});
    var f = board.create('functiongraph', ["x^2*sin(1/x)"], {strokeWidth:2});
})();

(function() {
    const board = JXG.JSXGraph.initBoard(BOARDID1, {axis:true, boundingbox:[-1/2, 0.08, 1.5, -0.02]});

    var g_der = board.create('functiongraph', [
        "(0 < x && x < 1) ? ((sin((1 / ((PI * x) * (1 - x)))) * ((2 * (x * ((1 - x)^2))) - (2 * ((x^2) * (1 - x))))) - (((x^2) * ((1 - x)^2)) * (cos((1 / ((PI * x) * (1 - x)))) * (((PI * (1 - x)) - (PI * x)) / (((PI * x) * (1 - x))^2))))) : 0"], 
        {strokeColor: 'red'});
    var g = board.create('functiongraph', ["(0 < x && x < 1) ? x^2*(1-x)^2*sin(1/(PI* x*(1-x))) : 0"],  
        {strokeWidth:2});
})();
<jsxgraph width="100%, 100%" aspect-ratio="1 / 1, 1 / 1" numberOfBoards="2" title="Discontinuous derivative" description="This construction was copied from JSXGraph examples database: BTW HERE SHOULD BE A GENERATED LINKuseGlobalJS="false">
   /*
   This example is licensed under a 
   Creative Commons Attribution 4.0 International License.
   https://creativecommons.org/licenses/by/4.0/
   
   Please note you have to mention 
   The Center of Mobile Learning with Digital Technology
   in the credits.
   */
   
   (function() {
       const board = JXG.JSXGraph.initBoard(BOARDID0, {axis:true, boundingbox:[-1/2, 1/2, 1/2, -1/2]});
   
       var g = board.create('functiongraph', ["2*x*sin(1/x) - cos(1/x)"], {strokeColor: 'red'});
       var f = board.create('functiongraph', ["x^2*sin(1/x)"], {strokeWidth:2});
   })();
   
   (function() {
       const board = JXG.JSXGraph.initBoard(BOARDID1, {axis:true, boundingbox:[-1/2, 0.08, 1.5, -0.02]});
   
       var g_der = board.create('functiongraph', [
           "(0 < x && x < 1) ? ((sin((1 / ((PI * x) * (1 - x)))) * ((2 * (x * ((1 - x)^2))) - (2 * ((x^2) * (1 - x))))) - (((x^2) * ((1 - x)^2)) * (cos((1 / ((PI * x) * (1 - x)))) * (((PI * (1 - x)) - (PI * x)) / (((PI * x) * (1 - x))^2))))) : 0"], 
           {strokeColor: 'red'});
       var g = board.create('functiongraph', ["(0 < x && x < 1) ? x^2*(1-x)^2*sin(1/(PI* x*(1-x))) : 0"],  
           {strokeWidth:2});
   })();
   
</jsxgraph>

Discontinuous derivative

Examples of continuous, differentiable functions with discontinuous derivative. #### First example Consider the function (blue curve) $$f: \mathbb{R} \to \mathbb{R}, x \mapsto \cases{ x^2\sin(1/x),& $x\neq 0$\cr 0,& $x=0$. } $$ $f$ is a continuous and differentiable function. The derivative of $f$ is the function (red curve) $$ f': \mathbb{R} \to \mathbb{R}, x \mapsto \cases{ 2x\sin(1/x) - \cos(1/x), & $x \neq 0$\cr 0,& $x=0$. } $$ We observe that $f'(0) = 0$, but $\lim_{x\to0}f'(x)$ does not exist. Therefore, $f'$ is an example of a derivative which is not continuous. #### Second example $$ g: \mathbb{R} \to \mathbb{R}, x \mapsto \cases{ x^2(1-x)^2\sin( \frac{1}{\pi x(1-x)}),& $0 < x < 1$\cr 0,& otherwise }\,. $$ Here, the derivative is not continuous for $x=0$ and $x=1$.
// Define the ids of your boards in BOARDID0, BOARDID1,...

(function() {
    const board = JXG.JSXGraph.initBoard(BOARDID0, {axis:true, boundingbox:[-1/2, 1/2, 1/2, -1/2]});

    var g = board.create('functiongraph', ["2*x*sin(1/x) - cos(1/x)"], {strokeColor: 'red'});
    var f = board.create('functiongraph', ["x^2*sin(1/x)"], {strokeWidth:2});
})();

(function() {
    const board = JXG.JSXGraph.initBoard(BOARDID1, {axis:true, boundingbox:[-1/2, 0.08, 1.5, -0.02]});

    var g_der = board.create('functiongraph', [
        "(0 < x && x < 1) ? ((sin((1 / ((PI * x) * (1 - x)))) * ((2 * (x * ((1 - x)^2))) - (2 * ((x^2) * (1 - x))))) - (((x^2) * ((1 - x)^2)) * (cos((1 / ((PI * x) * (1 - x)))) * (((PI * (1 - x)) - (PI * x)) / (((PI * x) * (1 - x))^2))))) : 0"], 
        {strokeColor: 'red'});
    var g = board.create('functiongraph', ["(0 < x && x < 1) ? x^2*(1-x)^2*sin(1/(PI* x*(1-x))) : 0"],  
        {strokeWidth:2});
})();

license

This example is licensed under a Creative Commons Attribution 4.0 International License.
Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.