Discontinuous derivative: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(11 intermediate revisions by the same user not shown)
Line 2: Line 2:
:<math> f: \mathbb{R} \to \mathbb{R}, x \mapsto  
:<math> f: \mathbb{R} \to \mathbb{R}, x \mapsto  
\begin{cases}
\begin{cases}
x^2\sin(1/x),& x\neq 0\\
x^2\sin(1/x),& x\neq 0,\\
0,& x=0
0,& x=0\,.
\end{cases}\,.
\end{cases}
</math>
</math>
<math>f</math> is a continous and differentiable.
<math>f</math> is a continous and differentiable function.
The derivative of <math>f</math> is the function (red curve)
The derivative of <math>f</math> is the function (red curve)
:<math>
:<math>
f': \mathbb{R} \to \mathbb{R}, x \mapsto
f': \mathbb{R} \to \mathbb{R}, x \mapsto
\begin{cases}
\begin{cases}
2\sin(1/x) - \cos(1/x), &x \neq 0\\
2x\sin(1/x) - \cos(1/x), &x \neq 0,\\
0,& x=0
0,& x=0\,.
\end{cases}\,.
\end{cases}
</math>
</math>
We observe that <math>f'(0) = 0</math>, but <math>\lim_{x\to0}f'(x)</math> does not exist.
We observe that <math>f'(0) = 0</math>, but <math>\lim_{x\to0}f'(x)</math> does not exist.
Line 22: Line 22:
var board = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[-1/2,1/2,1/2,-1/2]});
var board = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[-1/2,1/2,1/2,-1/2]});


var g = board.create('functiongraph', ["2*sin(1/x) - cos(1/x)"], {strokeColor: 'red'});
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});
var f = board.create('functiongraph', ["x^2*sin(1/x)"], {strokeWidth:2});
</jsxgraph>
</jsxgraph>
Line 30: Line 30:
g: \mathbb{R} \to \mathbb{R}, x \mapsto
g: \mathbb{R} \to \mathbb{R}, x \mapsto
\begin{cases}
\begin{cases}
x^2(1-x)^2\sin(1/(\pi x(1-x)),& 0<x< 1\\
x^2(1-x)^2\sin(1/(\pi x(1-x)),& 0 < x < 1\\
0,& \mbox{otherwise}
0,& \mbox{otherwise}
\end{cases}\,.
\end{cases}\,.
Line 36: Line 36:


<jsxgraph width="500" height="500" box="jxgbox2">
<jsxgraph width="500" height="500" box="jxgbox2">
var board = JXG.JSXGraph.initBoard('jxgbox2', {axis:true, boundingbox:[-1/2,0.02,1.5,-0.01]});
var board = JXG.JSXGraph.initBoard('jxgbox2', {axis:true, boundingbox:[-1/2,0.08,1.5,-0.02]});


//var g = board.create('functiongraph', ["2*sin(1/x) - cos(1/x)"], {strokeColor: 'red'});
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 f = board.create('functiongraph', ["x^2*(1-x)^2*sin(1/(PI* x*(1-x)))"], {strokeWidth:2});
var g = board.create('functiongraph', ["(0 < x && x < 1) ? x^2*(1-x)^2*sin(1/(PI* x*(1-x))) : 0"], {strokeWidth:2});
</jsxgraph>
</jsxgraph>


Line 50: Line 50:
var g = board.create('functiongraph', ["2*sin(1/x) - cos(1/x)"], {strokeColor: 'red'});
var g = board.create('functiongraph', ["2*sin(1/x) - cos(1/x)"], {strokeColor: 'red'});
var f = board.create('functiongraph', ["x^2*sin(1/x)"], {strokeWidth:2});
var f = board.create('functiongraph', ["x^2*sin(1/x)"], {strokeWidth:2});
</source>
Second example:
<source lang="javascript">
var board = JXG.JSXGraph.initBoard('jxgbox2', {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});
</source>
</source>


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

Latest revision as of 21:01, 23 March 2021

Consider the function (blue curve)

[math]\displaystyle{ f: \mathbb{R} \to \mathbb{R}, x \mapsto \begin{cases} x^2\sin(1/x),& x\neq 0,\\ 0,& x=0\,. \end{cases} }[/math]

[math]\displaystyle{ f }[/math] is a continous and differentiable function. The derivative of [math]\displaystyle{ f }[/math] is the function (red curve)

[math]\displaystyle{ f': \mathbb{R} \to \mathbb{R}, x \mapsto \begin{cases} 2x\sin(1/x) - \cos(1/x), &x \neq 0,\\ 0,& x=0\,. \end{cases} }[/math]

We observe that [math]\displaystyle{ f'(0) = 0 }[/math], but [math]\displaystyle{ \lim_{x\to0}f'(x) }[/math] does not exist.

Therefore, [math]\displaystyle{ f' }[/math] is an example of a derivative which is not continuous.

Here is another example:

[math]\displaystyle{ g: \mathbb{R} \to \mathbb{R}, x \mapsto \begin{cases} x^2(1-x)^2\sin(1/(\pi x(1-x)),& 0 \lt x \lt 1\\ 0,& \mbox{otherwise} \end{cases}\,. }[/math]


The underlying JavaScript code

First example:

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

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

Second example:

var board = JXG.JSXGraph.initBoard('jxgbox2', {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});