Find $y'(0.1)$ from the values $y(x)$ at $x=0.1$, $0.2$, $0.3$ and $0.4$, using numerical methods

148 Views Asked by At

Find $\dfrac{dy}{dx}$ at x = 0.1 from the following data. $$ \begin{array}{|c|r|} \hline x & 0.1 & 0.2 & 0.3 & 0.4 \\ \hline y & 0.9975 & 0.9900 & 0.9776 & 0.9604 \\ \hline \end{array} $$

I know that Euler's method and Runge-Kutta method give the value of y when $\frac{dy}{dx}$ is given. But this problem is the opposite of it i.e. finding $\frac{dy}{dx}$ when y values are given. I am not getting any idea how to proceed. Can some one please help me?

3

There are 3 best solutions below

0
On

Very rough but simple method: $$y'(0.1)\approx\frac{y(0.2) - y(0.1)}{0.2 - 0.1}.$$ See

http://www2.math.umd.edu/~dlevy/classes/amsc466/lecture-notes/differentiation-chap.pdf,

https://en.wikipedia.org/wiki/Numerical_differentiation

...

0
On

You get from the Taylor expansion \begin{align} \frac{y(x+h)-y(x)}{h}&=y'(x)+\frac12y''(x)h+\frac16y'''(x)h^2+O(h^3)\\ \frac{y(x+2h)-y(x)}{2h}&=y'(x)+y''(x)h+\frac23y'''(x)h^2+O(h^3)\\ \frac{y(x+3h)-y(x)}{3h}&=y'(x)+\frac32y''(x)h+\frac32y'''(x)h^2+O(h^3)\\ \end{align} which you now can combine to eliminate the terms with $y''(x)$ and $y'''(x)$ to obtain a formula with error order $O(h^3)$. I get $y'(0.1)\approx -0.05016$

0
On

Generally speaking, numerical differentiation tends to amplify noise so what we want to do is to find some model for the data, fit the data to the model, hopefully smoothing out the noise, then differentiate the model. In this case, the two second differences are very close to one another so we will attempt a quadratic least-squares fit, $y(x)\approx a_0+a_1x+a_2x^2$. Applying this model to the data we get the system $$\begin{bmatrix}1&0.1&0.01\\ 1&0.2&0.04\\ 1&0.3&0.09\\ 1&0.4&0.16\end{bmatrix}\begin{bmatrix}a_0\\a_1\\a_2\end{bmatrix}=\begin{bmatrix}0.5&-0.15\sqrt{20}&0.5\\ 0.5&-0.05\sqrt{20}&-0.5\\ 0.5&0.05\sqrt{20}&-0.5\\ 0.5&0.15\sqrt{20}&0.5\end{bmatrix}\begin{bmatrix}2&0.5&0.15\\ 0&0.05\sqrt{20}&0.025\sqrt{20}\\ 0&0&0.02\end{bmatrix}\begin{bmatrix}a_0\\a_1\\a_2\end{bmatrix}\approx\begin{bmatrix}0.9975\\0.9900\\0.9776\\0.9604\end{bmatrix}$$ Where we have applied $QR$ factorization to the matrix of coefficients. Multiplying both sides on the left by $Q^T$ we arrive at $$\begin{bmatrix}2&0.5&0.15\\ 0&0.05\sqrt{20}&0.025\sqrt{20}\\ 0&0&0.02\end{bmatrix}\begin{bmatrix}a_0\\a_1\\a_2\end{bmatrix}=\begin{bmatrix}0.5&0.5&0.5&0.5\\ -0.15\sqrt{20}&-0.05\sqrt{20}&0.05\sqrt{20}&0.15\sqrt{20}\\ 0.5&-0.5&-0.5&0.5\end{bmatrix}\begin{bmatrix}0.9975\\0.9900\\0.9776\\0.9604\end{bmatrix}=\begin{bmatrix}1.96275\\-0.006185\sqrt{20}\\-0.00485\end{bmatrix}$$ We can solve this by back-substitution to get $$\begin{bmatrix}a_0\\a_1\\a_2\end{bmatrix}=\begin{bmatrix}1.000175\\-0.00245\\-0.2425\end{bmatrix}$$ Comparing with our original data, $$\begin{array}{r|llll}x&0.1&0.2&0.3&0.4\\ \hline y_{\text{data}}&0.9975&0.9900&0.9776&0.9604\\ y_{\text{model}}&0.997505&0.989985&0.977615&0.960395 \end{array}$$ Which is beyond being within roundoff error which leads us to suspect that this was a composed problem and that we have more or less decoded the original composition. Given our ridiculous goodness of fit, we offer the answer $$y^{\prime}(0.1)\approx 2a_2(0.1)+a_1=2(-0.2425)(0.1)-0.00245=-0.05095$$