- #1
- 1,798
- 33
- TL;DR Summary
- How do I compute boundary values from a Neumann condition?
Suppose I have a boundary condition [itex]f'(0)=a[/itex]. I know the value of [itex]f(x)[/itex] at [itex]x=h/2,3h/2[/itex]. Does it make sense to write:
[tex]
f'(x)=af(x)+bf(x+h/2)+cf(x+3h/2)
[/tex]
Using Taylor series to expand, we obtain the following:
[tex]
f'(x)=(a+b+c)f(x)+\frac{h}{2}(b+3c)f'(x)+\frac{h^{2}}{8}(b+9c)f''(x)
[/tex]
By equating coefficients, we obtain the following set of linear equations for [itex]a,b[/itex] and [itex]c[/itex]:
[tex]
a+b+c=0,\quad b+3c=\frac{2}{h},\quad b+9c=0
[/tex]
The solution of which is:
[tex]
a=-\frac{8}{3h},\quad b=\frac{3}{h},\quad c=-\frac{1}{3h}
[/tex]
making:
[tex]
f'(x)=-\frac{8}{3h}f(x)+\frac{3}{h}f(x+h/2)-\frac{1}{3h}f(x+3h/2)
[/tex]
Using the above equation, it is possible to obtain:
[tex]
f(0)=\frac{3h}{8}\left(-a+\frac{3}{h}f(h/2)-\frac{1}{3h}f(3h/2)\right)
[/tex]
Is this a reasonable approach? I've tested it with a few functions and it appears to be accurate to [itex]10^{-4}\%[/itex]
[tex]
f'(x)=af(x)+bf(x+h/2)+cf(x+3h/2)
[/tex]
Using Taylor series to expand, we obtain the following:
[tex]
f'(x)=(a+b+c)f(x)+\frac{h}{2}(b+3c)f'(x)+\frac{h^{2}}{8}(b+9c)f''(x)
[/tex]
By equating coefficients, we obtain the following set of linear equations for [itex]a,b[/itex] and [itex]c[/itex]:
[tex]
a+b+c=0,\quad b+3c=\frac{2}{h},\quad b+9c=0
[/tex]
The solution of which is:
[tex]
a=-\frac{8}{3h},\quad b=\frac{3}{h},\quad c=-\frac{1}{3h}
[/tex]
making:
[tex]
f'(x)=-\frac{8}{3h}f(x)+\frac{3}{h}f(x+h/2)-\frac{1}{3h}f(x+3h/2)
[/tex]
Using the above equation, it is possible to obtain:
[tex]
f(0)=\frac{3h}{8}\left(-a+\frac{3}{h}f(h/2)-\frac{1}{3h}f(3h/2)\right)
[/tex]
Is this a reasonable approach? I've tested it with a few functions and it appears to be accurate to [itex]10^{-4}\%[/itex]