1

I would like to understand (in the book by Ralston: A first course in numerical analysis) on the page 173 the denominator $24$ in $(5.3-10)$ in the snippet below. We have $r=3$ and the original formulas $(5.3-4)$ and $(5.3-6)$ say $\frac{1}{r!}$. So how can I get $\frac{1}{(r+1)!}$ in $(5.3-10)$ or $24$ anyway ?

enter image description here

user122424
  • 4,060

2 Answers2

1

Decomposing the left and right side of the equation into odd and even components around $(k,y_k)$ or $(x,y(x))$ gives coefficients $(1-a)$ and $(1+a)$ in the results. Then one can hope that there is also a correspondence in the truncation error, that computing it for the terms with equal coefficients simplifies the whole calculation.

Practically, after separation insert the Taylor series for $y(x\pm h)$ and $y'(x\pm h)$, this gives for the parts of the equation

left side

$\newcommand{\iv}{{\mathrm{\iota v}}}$ \begin{align} y_{k+1}+(a-1)y_k-ay_{k-1}&=\frac{a+1}2(y_{k+1}-y_{k-1})+\frac{1-a}2(y_{k+1}-2y_k+y_{k-1}) \\[.5em]\hline y(x+h)-y(x-h)&=2hy'(x)+\tfrac13h^3y'''(x)+\tfrac1{60}h^5y^{\rm v}(x)+O(h^7)\\ y(x+h)-2y(x)+y(x-h)&=h^2y''(x)+\tfrac1{12}h^4y^\iv(x)+O(h^6) \end{align}

right side

\begin{align} (5-a)y'_{k+1}+8(1+a)y'_k+(5a-1)y'_{k-1} &=\begin{aligned}[t] &2(1+a)(y'_{k+1}+4y_k+y'_{k-1})\\ &+3(1-a)(y'_{k+1}-y'_{k-1}) \end{aligned} \\[.5em]\hline y'(x+h)+4y'(x)+y'(x-h)&=6y'(x)+h^2y'''(x)+\tfrac1{12}h^4y^{\rm v}(x)+O(h^6)\\ y'(x+h)-y'(x-h)&=2hy''(x)+\tfrac13h^3y^\iv(x)+O(h^5) \end{align}

Comparing the parts in $(a+1)$ and $1-a$ separately gives \begin{align} \frac{y(x+h)-y(x-h)}2&-\frac{2h}{12}(y'(x+h)+4y'(x)+y'(x-h))\\ &=-\frac{1}{180}h^5y^{\rm v}(x)+O(h^7)\\ \frac{y(x+h)-2y(x)+y(x-h)}2&-\frac{3h}{12}(y'(x+h)-y'(x-h))\\ &=-\frac1{24}h^4y^\iv(x)+O(h^6) \end{align}

Combined the error is $$ \frac{a-1}{24}h^4y^\iv(x) - \frac{a+1}{180}h^5y^{\rm v}(x) + O(h^6) = \frac{a-1}{24}h^4y^\iv\left(x-\frac{2(a+1)}{15(a-1)}h\right)+ O(h^6), $$ the second expression is only valid for $a$ not too close to $1$, so that the offset remains smaller than $h$ (or some small multiple) in absolute value.

Lutz Lehmann
  • 131,652
  • I seem to have a few severe problems with understanding your answer. First, Why has your first line the shape as it does: $\frac{a+1}2(y_{k+1}-y_{k-1})+\frac{1-a}2(y_{k+1}-2y_k+y_{k-1})$ ? I can see that the equation holds though. Next in your second line how did occur the fraction $\frac{1}{360}$ ? Next, how have you derived the r.h.s. in you 4th line: $2(1+a)(y'{k+1}+4y_k+y'{k-1})+3(1-a)(y'{k+1}-y'{k-1})$ ? Finally what do you mean by comparing $(a+1)$ and $(1-a)$ ? I'm a real beginner to numerical integration. Thank you in advance. – user122424 Dec 03 '22 at 15:18
  • I put more reasoning in the answer. For the fraction, $\frac1{350}=\frac2{5!}$. – Lutz Lehmann Dec 03 '22 at 15:28
  • That would be great. – user122424 Dec 03 '22 at 15:39
  • My understanding of your computation is much better now. But still: should there be $x$ instead of $k$ in your $\frac{3h}{12}(y'(k+h)-y'(k-h))$ $-6$th line in your answer ? Why is holds that $$\begin{align}\frac{y(x+h)-y(x-h)}2&-\frac{2h}{12}(y'(x+h)+4y'(x)+y'(x-h))\ &=-\frac{1}{80}h^5y^{\rm v}(x)+O(h^7)\end{align} $$ ? I'm unable to carry out the computations involving the Taylor expansions like $y'(x+h)$. – user122424 Dec 03 '22 at 16:09
  • Yes, I thought I got all the instances. – Lutz Lehmann Dec 03 '22 at 19:41
  • I think that you have two more typos in your computation: how could you factor out the 5th derivative (to get the r.h.s. of this) if the other is 4th derivative only: $$ \frac{a-1}{24}h^4y^{iv}(x) - \frac{a+1}{80}h^5y^{\rm v}(x) + O(h^6) = \frac{a-1}{24}h^4y^{iv}\left(x-\frac{3(a+1)}{10(a-1)}h\right)+ O(h^6), $$? Next typo is that $-\frac{1}{80}$ should read $-\frac{1}{180}$ , please see here. – user122424 Dec 04 '22 at 11:36
  • My final question is whether $(5.3-10)$ $$\frac{-(1-a)h^4}{24}Y^{(4)}(\eta)$$ can be obtained directly via $(5.3-6)$ and $(5.3-9)$ and integrating $G(s)$ instead of using the Taylor expansion and $O$ ? – user122424 Dec 04 '22 at 11:38
  • The last is correct as it is, $\frac1{2·360}-\frac{6·12}=\frac{1-10}{720}=\frac1{80}$. For the other I used the Taylor expansion in reverse, $af(x)+bhf'(x)=af(x+\frac ba h)+O(h^2)$. – Lutz Lehmann Dec 04 '22 at 11:41
  • So here the result $-\frac{1}{80}$ is wrong ? – user122424 Dec 04 '22 at 11:42
  • No, I had a block using 720=6! for 5!=120 – Lutz Lehmann Dec 04 '22 at 11:53
  • You were of great help to me with the entire example. It will be really nice If you ever wish to tell me whether we can use the influence function $G(s)$ to obtain $(5.3-10)$. Of course, I could and I wish to integrate $(5.3-9)$ but I do not know the bounds $x_n$ and $x_{n+1}.$ – user122424 Dec 04 '22 at 12:01
  • Computing a weight function for a residual integral and applying the mean value theorem on it is a quite different approach. I tried this for the Simpson residual in https://math.stackexchange.com/questions/3487297, see also similar without referring to distributions https://math.stackexchange.com/questions/2170782. It is about the same effort, what is nicer to look at depends on the taste of the reader. – Lutz Lehmann Dec 04 '22 at 12:13
  • OK, thank you for the references,I'll check them. Finally, why have you chosen to use $(a+1)$ and $(1-a)$ at all ? – user122424 Dec 04 '22 at 12:24
  • From the symmetric and anti-symmetric parts of the sequences $[1,a-1,-a]$ and $[5-a,8a+8,5a-1]$. – Lutz Lehmann Dec 04 '22 at 12:37
  • That's a new point for me. You have just chosen the middle terms of these two sequences factored out by $8$, why ? Is it a coincidence that they occur at $y_n$ and $y_n '$ resp. ? What do you mean by symmetric and anti-symmetric parts ? – user122424 Dec 04 '22 at 12:42
  • Of course, if there are common factors, especially in the even part, they have to be factors of the middle term. There is no guarantee that the odd parts have the same factors, but one can suspect that here the low-order conditions enforce this. – Lutz Lehmann Dec 04 '22 at 12:49
  • I still struggle with what you call even part and why do you claim that they have to be factors of the middle term, can you please help me to understand this ? – user122424 Dec 18 '22 at 11:46
  • Because under symmetrization the middle term remains unchanged. It is not really necessary to do this decomposition, I tried and used it because the left side can be decomposed into a central difference quotient and either a backward difference quotient or, as done, into a second order central difference quotients. These have nice Taylor expansions around the middle point $x_k$. That the right side has a corresponding nice decomposition is forced by the designed order of the method. As a bonus, the chosen decomposition also separates the Taylor terms be even and odd degrees in $h$. – Lutz Lehmann Dec 18 '22 at 12:18
  • Could you kindly write for me the entire formula for the anti-symmetrization and central difference quotient of $[1,a-1,-a]$ and $[5-a,8a+8,5a-1]$: do they appear in it both or just one of them ? I would just like to make a precise sense of your words. – user122424 Feb 24 '23 at 21:17
1

Distributions, step -1

For the construction of the weight kernel, one can start with the distribution that generates the truncation error as it is when applied to $y$,

$$ G_0=\delta_{x+h}+(a-1)\delta_x-a\delta_{x-h}+\frac{h}{12}\Bigl((5-a)\delta_{x+h}'+8(a+1)\delta_x'+(5a-1)\delta_{x-h}'\Bigr). $$

This gets then treated to partial integration, where one needs the anti-derivatives of the kernel. One can see the Dirac-delta at $x$, $\delta(s-x)=\delta_x(s)$ as second derivative of $(s-x)_ {+} = \max(0,s-x)$ or $(x-s) _ +=\max(0,x-s)$ depending on if one wants the primitives zero to the left or to the right. Your source chose zero to the right. The primitive in increasing order are $\frac{(-1)^{m-1}}{m!}(x-s)_+^m$, for $m=0$ one gets the jump from $-1$ to $0$ at $x$.

Directly to step 2

Without distributions one would recognize that

$$ y(x+h)-y(x-h)=\int_{x-h}^{x+h}y'(s)\,ds =2hy'(x-h)+\int_{x-h}^{x+h}(x+h-s)y''(s)\,ds \\~\\ y(x)-y(x-h)=\int_{x-h}^{x}y'(s)\,ds =hy'(x-h)+\int_{x-h}^{x}(x-s)y''(s)\,ds $$

likewise

$$ y'(x+h)-y'(x-h)=\int_{x-h}^{x+h}y''(s)\,ds \\ y'(x)-y'(x-h)=\int_{x-h}^{x}y''(s)\,ds $$ so that the truncation error can be written as

$$ \tau=\int_{x-h}^{x+h}G_2(s)y''(s)\,ds $$ with $$ G_2(s)=(x+h-s)_ + + (a-1)(x-s)_ + -\frac{h}{12}\bigl[(5-a)(x+h-s)_ +^0 + 8(1+a)(x-s)_ +^0\bigr] $$

The terms outside the integral, which are all multiples of $y'(x-h)$, cancel.

step 3

By partial integration it follows that

$$ \tau=-G_3(x+h)y''(x+h)+G_3(x-h)y''(x-h)+\int_{x-h}^{x+h}G_3(s)y'''(s)\,ds $$ with $$ G_3(s)=-\int_s^{x+h} G_2(t)\,dt=\frac12(x+h-s)_ +^2 + \frac12(a-1)(x-s)_ +^2 -\frac{h}{12}\bigl[(5-a)(x+h-s)_ + + 8(1+a)(x-s)_ +\bigr] $$

And again $G_3(x-h)=G_(x+h)=0$, so only the integral remains.

step 4

Apply again partial integration

$$ \tau=-G_4(x+h)y'''(x+h)+G_4(x-h)y'''(x-h)+\int_{x-h}^{x+h}G_4(s)y^{(4)}(s)\,ds $$ with $$ G_4(s)=-\int_s^{x+h} G_3(t)\,dt=\frac16(x+h-s)_ +^3 + \frac16(a-1)(x-s)_ +^3 -\frac{h}{24}\bigl[(5-a)(x+h-s)_ +^2 + 8(1+a)(x-s)_ +^2\bigr] $$

Trivially $G_4(x+h)=0$, while $G_4(x-h)=\frac{h^3}{6}(7+a)-\frac{h^3}{24}(28+4a)=0$. The error is just the integral.

Step 5

With the next partial integration one gets

$$ \tau=-G_5(x+h)y^{(4)}(x+h)+G_5(x-h)y^{(4)}(x-h)+\int_{x-h}^{x+h}G_5(s)y^{(5)}(s)\,ds $$ with $$ G_5(s)=-\int_s^{x+h} G_4(t)\,dt=\frac1{24}(x+h-s)_ +^4 + \frac1{24}(a-1)(x-s)_ +^4 -\frac{h}{72}\bigl[(5-a)(x+h-s)_ +^3 + 8(1+a)(x-s)_ +^3\bigr] $$

Now $G_5(x-h)=\frac{h^4}{24}(15+a)-\frac{h^4}{72}(48)=\frac{h^4}{24}(a-1)$, so that this step is only useful for $a=1$, as the aim is to retain only one instance of $y$ in the error formula

Conclusion

Apply the mean value theorem of integration to step 4, assuming the check that $G_4(s)\ge 0$ on $[x-h,x+h]$ was carried out. $$ \tau=\int_{x-h}^{x+h}G_4(s)y^{(4)}(s)\,ds = y^{(4)}(\eta)\int_{x-h}^{x+h}G_4(s)\,ds=-[G_5(x+h)-G_5(x-h)]y^{(4)}(\eta)=-\frac{h^4}{24}(a-1)y^{(4)}(\eta) $$

Lutz Lehmann
  • 131,652
  • Dear Lutz, it is great that you have written a new answer to my question from a different viewpoint. I'll read it carefully. In the meantime could you please explain to me here in the second paragraph what is the purpose, what it is good/how it is used the number $2$ in the denominator $$-\frac{1}{90}\frac{f'''(x_3)-f''''(-x_3)}{2\cdot x_3}$$ and how do we derive the r.h.s. of the formula with $f^{(4)}$ there ? In other words why it wouldn't work without $2$ there ? – user122424 Dec 09 '22 at 15:47
  • The $2$ is for the central difference quotient, as $x_3-(-x_3)=2x_3$. As such the value of the difference quotient is $f^{(4)}(\eta)$ with $\eta$ closer to $0$ than $x_3$, following $\frac{h(b)-h(a)}{b-a}=h'(c)$ with $c$ close to the midpoint $\frac{a+b}2$. – Lutz Lehmann Dec 09 '22 at 15:54
  • I'm unable to confirm that $G_2(x-h)=0$ where $$ G_2(s)=(x+h-s)_ + + (a-1)(x-s)_ + -\frac{h}{12}\bigl[(5-a)(x+h-s)_ +^0 + 8(1+a)(x-s)_ +^0\bigr] .$$ Could you kindly help me to understand this ? I got $G_2(x-h)=0.41666ha-2.083333h.$ – user122424 Dec 10 '22 at 16:38
  • Yes, you are right, that was wrong. But it also was not used, so other than removing it and replacing it with a more relevant statement, nothing else changes. – Lutz Lehmann Dec 10 '22 at 16:52
  • Please, step 2, the last line: outside which integral and what/why are multiples of $y'(x-h)$ ? Also, to help me grasp the entire incredibly complex thing, what are the indices $1,2,3,4$ and $5$ under $G$ intended to mean ? – user122424 Dec 10 '22 at 19:22
  • $G_k$ is the weight function for expressing the error via the integral over $y^{(k)}$. The $y'(x-k)$ appear when you assemble the difference formulas directly above into the correct linear combination. – Lutz Lehmann Dec 10 '22 at 19:31