Welcome to our community

Be a part of something great, join today!

Differential Approximation Task II

Thorra

Member
Dec 7, 2013
40
Here is another problem I should understand of differential approximation. Maybe I shouldn't have posted it before solving the first one but I'm really anxious to learn them so I can pass the class.

Problem II

Using the Taylor series and the undetermined coefficient method, approximate the derivative $$\frac{d^2 u}{dx^2}$$ with the second order of local approximation in the right-end side of the model, on a homogeneous grid with the step $p $.

My take

Right...
So.

$$v(x-p)=v(x)-p^{'}(x)+\frac{p^2}{2}v^{''}(x)-\frac{p^3}{6}p^3v^{'''}(x)+O(p^4) / \cdot 1$$
$$v(x-2p)=v(x)-2pv^{'}+\frac{4p^2}{2}v^{''}-\frac{8p^3}{6}p^3 v^{'''}(x)+O(16p^4) / \cdot A$$
$$v(x-3p)=v(x)-3pv^{'}+\frac{9p^2}{2}v^{''}-\frac{27p^3}{6}p^3 v^{'''}(x)+O(81p^4) / \cdot B$$
Those be my 3 points, not counting the original one without the time step.

So I add them all up with the new coefficients:
$$v(x-p) + Av(x-2p) + Bv(x-3p) = (1+A+B)v(x) - (1+2A+3B)pv^{'}(x) + p^2 \left(\frac{1}{2}+\frac{4A}{2}+\frac{9B}{2}\right)v^{''}(x) - p^3 \left(\frac{1}{6}+\frac{8A}{6}+\frac{27B}{6}\right)v^{'''}(x)$$

And for some reason (dunno why, I had a lot of help with this one already though) the $v^{'}(x)$ and $v^{'''}(x)$ equal $0$ and so I can figure out the coefficients from the small system:

$$\begin{cases}1+2A+3B= &\mbox{0},\\ \frac{1}{6}+\frac{8A}{6}+\frac{27B}{6}= &\mbox{0} \end{cases}]$$

And I get that $A=-\frac{4}{5}$ and $B=\frac{1}{5}$.

So I put it all in the summed equation and I get:

$$v(x-p)-\frac{4}{5}v(x-2p)+\frac{1}{5}v(x-3p)=\frac{2}{5}v(x) - \frac{3}{5}p^2 v^{''}(x)$$
And get...
$$v^{''}(x)=\frac{5}{-3p^2}\left(v(x-p)-\frac{4}{5}v(x-2p)+\frac{1}{5}v(x-3p)-\frac{2}{5}v(x)\right)+O(p^2)$$

So... Is this it? Could this be correct? Also I'm not sure why cross out the first and third derivatives and how this makes for 2nd approximation. And so.. this is the right point's $v(x)$ approximation? How would a "central" approximation look like? And ehm... what if I didn't go backwards but rather forward my step x+h? A coursemate told me that it's a longabout way to it.


Well anyways... thanks for any replies as always.

Edit: lol, made some dumb errors in my expression yesterday again. And here I thought I was *really* getting it right this time. Anyway, how's it lookin'?
 
Last edited:

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,779
Here is another problem I should understand of differential approximation. Maybe I shouldn't have posted it before solving the first one but I'm really anxious to learn them so I can pass the class.

Problem II

Using the Taylor series and the undetermined coefficient method, approximate the derivative $$\frac{d^2 u}{dx^2}$$ with the second order of local approximation in the right-end side of the model, on a homogeneous grid with the step $p $.
The problem is not clear to me yet.
What does "the second order of local approximation in the right-end side of the model" mean?
The rest of your post seems to imply that u(x), u(x-p), u(x-2p), ... are given?
And that you're supposed to find u''(x)?


My take

Right...
So.

$$v(x-p)=v(x)-p^{'}(x)+\frac{p^2}{2}v^{''}(x)-\frac{p^3}{6}p^3v^{'''}(x)+O(p^4) / \cdot 1$$
$$v(x-2p)=v(x)-2pv^{'}+\frac{4p^2}{2}v^{''}-\frac{8p^3}{6}p^3 v^{'''}(x)+O(16p^4) / \cdot A$$
$$v(x-3p)=v(x)-3pv^{'}+\frac{9p^2}{2}v^{''}-\frac{27p^3}{6}p^3 v^{'''}(x)+O(81p^4) / \cdot B$$
Those be my 3 points, not counting the original one without the time step.

So I add them all up with the new coefficients:
$$v(x-p) + Av(x-2p) + Bv(x-3p) = (1+A+B)v(x) - (1+2A+3B)pv^{'}(x) + p^2 \left(\frac{1}{2}+\frac{4A}{2}+\frac{9B}{2}\right)v^{''}(x) - p^3 \left(\frac{1}{6}+\frac{8A}{6}+\frac{27B}{6}\right)v^{'''}(x)$$
I presume $v$ is supposed to be the same as $u$?

If I understand correctly, $x$ is the "right-hand-side of the model".
And these are the equations from which you are supposed to deduce $v''(x)$ in terms of $v(x), v(x-p), v(x-2p),$ and $v(x-3p)$.
There is actually a 4th equation would is the trivial $v(x) = v(x)$.

Apparently you are making a linear combination of the 3 equations in an attempt to solve them for v''(x).
To find v''(x) in terms of $v(x), v(x-p), v(x-2p), v(x-3p)$, we will want to eliminate v'(x) and v'''(x).
So we'll pick our linear combination in such a way that the coefficients of v'(x) and v'''(x) are zero, while the coefficient of v''(x) is NOT zero.

And for some reason (dunno why, I had a lot of help with this one already though) the $v^{'}(x)$ and $v^{'''}(x)$ equal $0$ and so I can figure out the coefficients from the small system:

$$\begin{cases}1+2A+3B= &\mbox{0},\\ \frac{1}{6}+\frac{8A}{6}+\frac{27B}{6}= &\mbox{0} \end{cases}]$$
Edited: This make sense to me now.


And I get that $A=-\frac{4}{5}$ and $B=\frac{1}{5}$.

So I put it all in the summed equation and I get:

$$v(x-p)-\frac{4}{5}v(x-2p)+\frac{1}{5}v(x-3p)=\frac{2}{5}v(x) - \frac{3}{5}p^2 v^{''}(x)$$
And get...
$$v^{''}(x)=\frac{5}{-3p^2}\left(v(x-p)-\frac{4}{5}v(x-2p)+\frac{1}{5}v(x-3p)-\frac{2}{5}v(x)\right)+O(p^2)$$

So... Is this it? Could this be correct? Also I'm not sure why cross out the first and third derivatives and how this makes for 2nd approximation. And so.. this is the right point's $v(x)$ approximation? How would a "central" approximation look like? And ehm... what if I didn't go backwards but rather forward my step x+h? A coursemate told me that it's a longabout way to it.
The reason they went backward would probably be because you're supposed to make the approximation at the "right-end side of the model".

But yeah, that seems to be it! :cool:
 

Thorra

Member
Dec 7, 2013
40
The problem is not clear to me yet.
What does "the second order of local approximation in the right-end side of the model" mean?
The rest of your post seems to imply that u(x), u(x-p), u(x-2p), ... are given?
And that you're supposed to find u''(x)?
Aw man trying to translate something literally doesn't really always work out. "2nd order of local approximation" I meant as $\mathcal O(p^2)$, I guess. The right-end side -yeah, as you remark later:
If I understand correctly, $x$ is the "right-hand-side of the model".
indeed.

I presume $v$ is supposed to be the same as $u$?
Yep, sorry, I mix them up sometimes cause, well, in one place it's $v$, in another it's $u$, in another it's the good old $y$.. (though I guess not lately)

And these are the equations from which you are supposed to deduce $v''(x)$ in terms of $v(x), v(x-p), v(x-2p),$ and $v(x-3p)$.
There is actually a 4th equation would is the trivial $v(x) = v(x)$.
Yeah and it crosses out cause it's so trivial!
Apparently you are making a linear combination of the 3 equations in an attempt to solve them for v''(x).
To find v''(x) in terms of $v(x), v(x-p), v(x-2p), v(x-3p)$, we will want to eliminate v'(x) and v'''(x).
So we'll pick our linear combination in such a way that the coefficients of v'(x) and v'''(x) are zero, while the coefficient of v''(x) is NOT zero.
I guess so :eek:. And that's why it's with the approximation $\mathcal O(p^2)$, right? But then, if it's 4 equations and 4 points including the v(x) itself, then how does it correspond to the derivative $\frac{d^2u}{dx^2}$? I guess We don't count the base point v(x) cause 2nd order derivative has only 3 points. Yeah.
But yeah, that seems to be it! :cool:
GOOD!
The reason they went backward would probably be because you're supposed to make the approximation at the "right-end side of the model".
Hmm yeah, so how would one go about it if I for example required to find third derivative $\frac{d^3u}{dx^3}$ approximation at the central point?
Would I be using points $v(x-4g)$, $v(x-3g)$, $v(x-2g)$, $v(x-g)$ and I guess $v(x)$ even though that's +1 point than that level of approx has. And... only use $v(x)$, $v(x-1)$, $v(x-2)$ or $v(x-4)$, $v(x-3)$, $v(x-2)$ ??
Or something actually clever? :D Cause I don't even know what coefficients to which of these guys would I apply.


P.S. was there any point to me writing $O(p^4)$, $O(16p^4)$ and $O(81p^4)$ at the end there? (I mean the 81 and the 16 part mostly). It's not like I used them anyway in the final expression. And it's not like 16 and 81 aren't hopeless constants anyway. And $\mathcal O$ loooves to merge all constants into one big ol' magic $\mathcal O$.

P.P.S. why \mathcal O? I am well aware it looks awesomer and more classy with the open ended, cute roundness, but the \mathcal thing sounds like something highly mathematically heavy implying.


$\mathcal {Thorra}$
 
Last edited:

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,779
Aw man trying to translate something literally doesn't really always work out. "2nd order of local approximation" I meant as $\mathcal O(p^2)$, I guess. The right-end side -yeah, as you remark later: indeed.

Yep, sorry, I mix them up sometimes cause, well, in one place it's $v$, in another it's $u$, in another it's the good old $y$.. (though I guess not lately)

Yeah and it crosses out cause it's so trivial!

I guess so :eek:. And that's why it's with the approximation $\mathcal O(p^2)$, right? But then, if it's 4 equations and 4 points including the v(x) itself, then how does it correspond to the derivative $\frac{d^2u}{dx^2}$? I guess We don't count the base point v(x) cause 2nd order derivative has only 3 points. Yeah.
I think you're missing the point. :eek:

Suppose we define X=v'(x), Y=v''(x), and Z=v'''(x).
And suppose we assign arbitrary numerical values to each of the known constants, just to emphasize that they are known.
Then we have a set of equations that looks more or less like:
\begin{aligned}
3 &= 2 + 3X + 4Y + 5Z \\
4 &= 2 + 2X + 1Y + 1Z \\
6 &= 2 + 3X + 2Y + 2Z
\end{aligned}

How would you solve that?

Now suppose we are only interested in the value of $Y$ (representing the 2nd derivative).
Could you solve it smarter?



To get back to the problem, we're interested in a 2nd order derivative.
Such a derivative is always divided by the squared step size.
Since we want it to be accurate up to the 2nd order, we need 4th order Taylor expansions, since we'll lose 2 orders when we divide by the squared step size.

To solve a set of equations for the 2nd order derivative, we need as many equations as we have unknowns.
Since we will have v'(x), v''(x), and v'''(x) as unknowns, we need 3 equations that contain them.


GOOD!
Hmm yeah, so how would one go about it if I for example required to find third derivative $\frac{d^3u}{dx^3}$ approximation at the central point?
Would I be using points $v(x-4g)$, $v(x-3g)$, $v(x-2g)$, $v(x-g)$ and I guess $v(x)$ even though that's +1 point than that level of approx has. And... only use $v(x)$, $v(x-1)$, $v(x-2)$ or $v(x-4)$, $v(x-3)$, $v(x-2)$ ??
Or something actually clever? :D Cause I don't even know what coefficients to which of these guys would I apply.
To which order would you like it to be accurate?
How many equations do you think you would need (to reach that order)?

Central means that you would use something like $v(x-2g), v(x-g), v(x), v(x+g), v(x+2g)$.


P.S. was there any point to me writing $O(p^4)$, $O(16p^4)$ and $O(81p^4)$ at the end there? (I mean the 81 and the 16 part mostly). It's not like I used them anyway in the final expression. And it's not like 16 and 81 aren't hopeless constants anyway. And $\mathcal O$ loooves to merge all constants into one big ol' magic $\mathcal O$.
Often enough those constants are indeed kept, since they still indicate a relative error size. But that is only for intuitive, fuzzy understanding.
Mathematically they merge indeed into the big $\mathcal O$.


P.P.S. why \mathcal O? I am well aware it looks awesomer and more classy with the open ended, cute roundness, but the \mathcal thing sounds like something highly mathematically heavy implying.
Well, because it looks awesomer and more classy with the open ended, cute roundness.
And because the \mathcal thing sounds like something highly mathematically heavy implying.
And also because I don't like how the regular O looks like a zero, which it is not. ;)

$\mathcal {Thorra}$
$\mathfrak{I \,like \ Serena}$
 

Thorra

Member
Dec 7, 2013
40
I think you're missing the point. :eek:

Suppose we define X=v'(x), Y=v''(x), and Z=v'''(x).
And suppose we assign arbitrary numerical values to each of the known constants, just to emphasize that they are known.
Then we have a set of equations that looks more or less like:
\begin{aligned}
3 &= 2 + 3X + 4Y + 5Z \\
4 &= 2 + 2X + 1Y + 1Z \\
6 &= 2 + 3X + 2Y + 2Z
\end{aligned}

How would you solve that?
Uh.. just substitute X (or any other variable) for the rest of the equation, plug that into the 2nd one, substitute Y or Z for the rest of the equation and finally plug that into the 3rd equation and I get the 1st variable. Than just work backwards and find all numerical values.
Now suppose we are only interested in the value of $Y$ (representing the 2nd derivative).
Could you solve it smarter?
I dunno... Yeah, I don't know. I can only think of the even messier way of subtracting one equation from the other till you only have Y.

To get back to the problem, we're interested in a 2nd order derivative.
Such a derivative is always divided by the squared step size.
Since we want it to be accurate up to the 2nd order, we need 4th order Taylor expansions, since we'll lose 2 orders when we divide by the squared step size.
Yeah, I got that. Though, on that, I'm not sure how I'll get a 3rd order thingy. I guess it's possible with that method you went by in the Task I thread, so I posted a question there.

To solve a set of equations for the 2nd order derivative, we need as many equations as we have unknowns.
Since we will have v'(x), v''(x), and v'''(x) as unknowns, we need 3 equations that contain them.
oh. Yeah that makes sense! Haha, lol. A $\frac{d^3}{dx^3}$ equation would have... I dunno, up to $v^{(4)}(x)$ derivatives? That would then require 4 equations. Though I guess it all depends on the order of approximation.

To which order would you like it to be accurate?
How many equations do you think you would need (to reach that order)?
Say, the 3rd. Or maybe 4th. Ok 4th.
Central means that you would use something like $v(x-2g), v(x-g), v(x), v(x+g), v(x+2g)$.
Buut. What coefficients would I add where, then? $A\cdot v(x-2g), B\cdot (v-g), C\cdot (v+g), D\cdot (v+2g)$?


Often enough those constants are indeed kept, since they still indicate a relative error size. But that is only for intuitive, fuzzy understanding.
Mathematically they merge indeed into the big $\mathcal O$.
Ah, good. That's a calming answer.


Well, because it looks awesomer and more classy with the open ended, cute roundness.
And because the \mathcal thing sounds like something highly mathematically heavy implying.
And also because I don't like how the regular O looks like a zero, which it is not. ;)


$\mathfrak{I \,like \ Serena}$
:D
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,779
\begin{aligned}
3 &= 2 + 3X + 4Y + 5Z \\
4 &= 2 + 2X + 1Y + 1Z \\
6 &= 2 + 3X + 2Y + 2Z
\end{aligned}
Uh.. just substitute X (or any other variable) for the rest of the equation, plug that into the 2nd one, substitute Y or Z for the rest of the equation and finally plug that into the 3rd equation and I get the 1st variable. Than just work backwards and find all numerical values.

I dunno... Yeah, I don't know. I can only think of the even messier way of subtracting one equation from the other till you only have Y.
Since we're not interested in $X$, we'll eliminate $X$ and forget about it.
The trick to do so, is to subtract the 2nd equation times 3/2 from the 1st equation.
And also to subtract the 3rd equation times 1 from the 1st equation.
That will leave us with 2 equations that do not contain $X$ anymore.
After that, we can repeat the same procedure to eliminate $Z$.

To speed things up, we can try to do it all at the same time.
We construct a single new equation from the first one, we add some, as yet unknown, $A$ times the second one, and also add $B$ times the third equation.
After that, we'll try to figure out which $A$ and $B$ we should choose, such that both $X$ and $Z$ get eliminated, leaving only $Y$.

In other words, in this final equation, the coefficients of $X$ and $Z$ have to be zero!


Yeah, I got that. Though, on that, I'm not sure how I'll get a 3rd order thingy. I guess it's possible with that method you went by in the Task I thread, so I posted a question there.


oh. Yeah that makes sense! Haha, lol. A $\frac{d^3}{dx^3}$ equation would have... I dunno, up to $v^{(4)}(x)$ derivatives? That would then require 4 equations. Though I guess it all depends on the order of approximation.


Say, the 3rd. Or maybe 4th. Ok 4th.

Buut. What coefficients would I add where, then? $A\cdot v(x-2g), B\cdot (v-g), C\cdot (v+g), D\cdot (v+2g)$?
Sounds good.

Let's pick (fixing your typos where you mix up x and v):
$$v'''(x) = A\cdot v(x-2g) + B\cdot v(x-g) + C\cdot v(x) + D\cdot v(x+g) + E\cdot v(x+2g)$$
Now we (err... you) only have to expand each v(x+ig) to the 4th order and figure out which $A,B,C,D,E$ to pick so that it all works out. :D
 

Thorra

Member
Dec 7, 2013
40
Since we're not interested in $X$, we'll eliminate $X$ and forget about it.
The trick to do so, is to subtract the 2nd equation times 3/2 from the 1st equation.
And also to subtract the 3rd equation times 1 from the 1st equation.
That will leave us with 2 equations that do not contain $X$ anymore.
After that, we can repeat the same procedure to eliminate $Z$.

To speed things up, we can try to do it all at the same time.
We construct a single new equation from the first one, we add some, as yet unknown, $A$ times the second one, and also add $B$ times the third equation.
After that, we'll try to figure out which $A$ and $B$ we should choose, such that both $X$ and $Z$ get eliminated, leaving only $Y$.

In other words, in this final equation, the coefficients of $X$ and $Z$ have to be zero!
Yeah, that's what I said. Except the part where you add the coefficients. That's quite a neat idea.


Let's pick (fixing your typos where you mix up x and v):
$$v'''(x) = A\cdot v(x-2g) + B\cdot v(x-g) + C\cdot v(x) + D\cdot v(x+g) + E\cdot v(x+2g)$$
Now we (err... you) only have to expand each v(x+ig) to the 4th order and figure out which $A,B,C,D,E$ to pick so that it all works out. :D
Haha yes, fix my laughable typos. :D How did I mistype everyting that badly.

I have a question, though. Only to the 4th order? I'd get $v'''(x)h^3= ... + \mathcal O(h^4)$ and in the end get that $v'''(x)$ is only first order approximation... Or am I still not getting it?


Edit: Just tried making like... 6 equations (would've been 5, but added 6th for the sake of symmetry) not counting $v(x)$ central equation (though with $\frac{d^2v}{dx^2}$ and with 4th order approximation). And... up to $\mathcal O(h^6)$... for 4 fancy equations that I tried to solve and ended up not managing to do so (with Gauss Method). It was fun. But obviously doesn't work.
 
Last edited:

Thorra

Member
Dec 7, 2013
40
Disclaimer: By the end of writing the post I realised what an idiot I've been, haha.

Hey!

I wrote the test now, did Task I and II.

So the task was harder this time:

In a nutshell it wanted me to do $\frac{d^2u}{dx^2}$, but with the central approximation and up to fourth approximation order $\mathcal O(h^4)$. All using the undetermined coefficient method.

So I wrote:
\begin{array}{}
u(x-2g)&=&u(x)-2u'(x)g+\frac{4g^2}{2}u''(x)-\frac{8g^3}{6}u'''(x)+\frac{16g^4}{24}u^{(4)}(x)-\frac{32g^4}{120}u^{(5)}(x)+\mathcal O(h^6) | \cdot 1 \\
u(x-g)&=&u(x)-u'(x)g+\frac{g^2}{2}u''(x)-\frac{g^3}{6}u'''(x)+\frac{g^4}{24}u^{(4)}(x)-\frac{g^5}{120}u^{(5)}(x)+\mathcal O(h^6) | \cdot A \\
u(x)&=&u(x) \\
u(x+g)&=&u(x)+u'(x)g+\frac{g^2}{2}u''(x)+\frac{g^3}{6}u'''(x)+\frac{g^4}{24}u^{(4)}(x)+\frac{g^5}{120}u^{(5)}(x)+\mathcal O(h^6) | \cdot B \\
u(x+2g)&=&u(x)+2u'(x)g+\frac{4g^2}{2}u''(x)+\frac{8g^3}{6}u'''(x)+\frac{16g^4}{24}u^{(4)}(x)+\frac{32g^4}{120}u^{(5)}(x)+\mathcal O(h^6) | \cdot C \\
\end{array}
So I know it's craziness, and probably wrong, but it's the only thing I can/could think of. So that brought me to:
$$u(x-2g)+u(x-g)+u(x+g)+u(x+2g)=(-1-A+B+C)\cdot u(x) + (-2-A+B+2C)\cdot u'(x)g + (-2-\frac{A}{2}+\frac{B}{2}+2C)\cdot u''(x)g^2 + (\frac{-8-A+B+8C}{6})u'''(x)g^3 + (\frac{16+A+B+16C}{24})u^{(4)}h^4 + (\frac{-32-A+B+32C}{120})u^{(5)}h^5 + \mathcal O(h^6)$$

So... the parts by all of the derivatives except $v''(x)$ equal zero... And I get this.

\begin{cases}
-2-A+B+2C &=&\mbox{0}, \\
\frac{-8-A+B+8C}{6} &= &\mbox{0} \\
\frac{16+A+B+16C}{24} &= &\mbox{0} \\
\frac{-32-A+B+32C}{120} &= &\mbox{0} \\
\end{cases}
so I took the 1st line minus the 2nd line and cot that $C=1$. Then 2nd line + 3rd line $=> B=16$. Then just took the last line and deduced that $A=16$.
Unfotunately I just realised that when calculating out $(-1-A+B+C)\cdot u(x)$ I "forgot" that A=B and instead took it as $A=-B$ so I came up with $-30 u(x)$... but that's weird... It sohuld be 30 then as well. What is wroong with my brain. It's 0, evidently. God ****it.

Anyway...
$$0\cdot u''(x)=\frac{1}{0\cdot h^2}[u(x-2g)+u(x-g)+u(x+g)+u(x+2g)]+ \mathcal O(h^4)$$
Yep, now I finally realised, that the whole derivative I was searching for also equals zero.

I know, I should've known that less variables than equations should imply horrible things. But I tried the other way yesterday and that failed as well. So eh. I'll probably have to redo this one, lol.

Thank you for your attention.


P.S. Would you believe me if I said I wrote this entire post without previewing it and got all of the syntax right on first try? CAUSE I JUST DID.


EDIT: FAIL, I just (5 hours later) noticed a minor forgetting of a crossed dollar (how do I even write it without initiating $LaTeX$) at the first use of $LaTeX$ in the post... xD
 
Last edited:

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,779
Yeah, that's what I said. Except the part where you add the coefficients. That's quite a neat idea.



Haha yes, fix my laughable typos. :D How did I mistype everyting that badly.

I have a question, though. Only to the 4th order? I'd get $v'''(x)h^3= ... + \mathcal O(h^4)$ and in the end get that $v'''(x)$ is only first order approximation... Or am I still not getting it?


Edit: Just tried making like... 6 equations (would've been 5, but added 6th for the sake of symmetry) not counting $v(x)$ central equation (though with $\frac{d^2v}{dx^2}$ and with 4th order approximation). And... up to $\mathcal O(h^6)$... for 4 fancy equations that I tried to solve and ended up not managing to do so (with Gauss Method). It was fun. But obviously doesn't work.
Yes. Only to the 4th order.
That is because in the left hand side you have $v'''(x)$ and not $v'''(x)h^3$.


Disclaimer: By the end of writing the post I realised what an idiot I've been, haha.

Hey!

I wrote the test now, did Task I and II.

So the task was harder this time:

In a nutshell it wanted me to do $\frac{d^2u}{dx^2}$, but with the central approximation and up to fourth approximation order $\mathcal O(h^4)$. All using the undetermined coefficient method.

So I wrote:
\begin{array}{}
u(x-2g)&=&u(x)-2u'(x)g+\frac{4g^2}{2}u''(x)-\frac{8g^3}{6}u'''(x)+\frac{16g^4}{24}u^{(4)}(x)-\frac{32g^4}{120}u^{(5)}(x)+\mathcal O(h^6) | \cdot 1 \\
u(x-g)&=&u(x)-u'(x)g+\frac{g^2}{2}u''(x)-\frac{g^3}{6}u'''(x)+\frac{g^4}{24}u^{(4)}(x)-\frac{g^5}{120}u^{(5)}(x)+\mathcal O(h^6) | \cdot A \\
u(x)&=&u(x) \\
u(x+g)&=&u(x)+u'(x)g+\frac{g^2}{2}u''(x)+\frac{g^3}{6}u'''(x)+\frac{g^4}{24}u^{(4)}(x)+\frac{g^5}{120}u^{(5)}(x)+\mathcal O(h^6) | \cdot B \\
u(x+2g)&=&u(x)+2u'(x)g+\frac{4g^2}{2}u''(x)+\frac{8g^3}{6}u'''(x)+\frac{16g^4}{24}u^{(4)}(x)+\frac{32g^4}{120}u^{(5)}(x)+\mathcal O(h^6) | \cdot C \\
\end{array}
So I know it's craziness, and probably wrong, but it's the only thing I can/could think of. So that brought me to:
$$u(x-2g)+u(x-g)+u(x+g)+u(x+2g)=(-1-A+B+C)\cdot u(x) + (-2-A+B+2C)\cdot u'(x)g + (-2-\frac{A}{2}+\frac{B}{2}+2C)\cdot u''(x)g^2 + (\frac{-8-A+B+8C}{6})u'''(x)g^3 + (\frac{16+A+B+16C}{24})u^{(4)}h^4 + (\frac{-32-A+B+32C}{120})u^{(5)}h^5 + \mathcal O(h^6)$$

So... the parts by all of the derivatives except $v''(x)$ equal zero... And I get this.

\begin{cases}
-2-A+B+2C &=&\mbox{0}, \\
\frac{-8-A+B+8C}{6} &= &\mbox{0} \\
\frac{16+A+B+16C}{24} &= &\mbox{0} \\
\frac{-32-A+B+32C}{120} &= &\mbox{0} \\
\end{cases}
so I took the 1st line minus the 2nd line and cot that $C=1$. Then 2nd line + 3rd line $=> B=16$. Then just took the last line and deduced that $A=16$.
Unfotunately I just realised that when calculating out $(-1-A+B+C)\cdot u(x)$ I "forgot" that A=B and instead took it as $A=-B$ so I came up with $-30 u(x)$... but that's weird... It sohuld be 30 then as well. What is wroong with my brain. It's 0, evidently. God ****it.

Anyway...
$$0\cdot u''(x)=\frac{1}{0\cdot h^2}[u(x-2g)+u(x-g)+u(x+g)+u(x+2g)]+ \mathcal O(h^4)$$
Yep, now I finally realised, that the whole derivative I was searching for also equals zero.

I know, I should've known that less variables than equations should imply horrible things. But I tried the other way yesterday and that failed as well. So eh. I'll probably have to redo this one, lol.
Try it like this:

\begin{array}{}
v''(x)
&=& Av(x-g) + Bv(x) + Cv(x+g) \\
&=& \phantom{+}\ A \Big(v(x) - gv'(x) + \frac 1 2 g^2 v''(x) - \frac 1 6 g^3 v'''(x)\Big) \\
&& +\ Bv(x) \\
&& +\ C \Big(v(x) + gv'(x) + \frac 1 2 g^2 v''(x) + \frac 1 6 g^3 v'''(x)\Big) \\
&& +\ \mathcal O(g^4) \\
&=& (A+B+C)v(x) + (-A + C)gv'(x) + \frac 1 2 (A+C) g^2 v''(x) + \frac 1 6 (-A + C)g^3 v'''(x) + \mathcal O(g^4)
\end{array}

We pick A, B, and C, such that the equation holds, regardless of the unknown values.
That means that each coefficient must be 0, except for the coefficient of v''(x), which must be 1.
\begin{cases}
A+B+C&=&0 \\
-A+C&=&0 \\
\frac 1 2 (A + C)g^2 &=& 1 \\
-A+C&=&0
\end{cases}
\begin{cases}
B&=&-A-C \\
C&=&A \\
\frac 1 2 (A + A)g^2 &=& 1
\end{cases}
\begin{cases}
A&=&1/g^2 \\
B&=&-2/g^2 \\
C&=&1/g^2 \\
\end{cases}

So:
$$v''(x)=\frac 1 {g^2}v(x-g) - \frac 2 {g^2}v(x) + \frac 1 {g^2}v(x+g) + \mathcal O(g^4)$$

Hmm, that looks familiar - by now.


Thank you for your attention.


P.S. Would you believe me if I said I wrote this entire post without previewing it and got all of the syntax right on first try? CAUSE I JUST DID.


EDIT: FAIL, I just (5 hours later) noticed a minor forgetting of a crossed dollar (how do I even write it without initiating $LaTeX$) at the first use of $LaTeX$ in the post... xD
:D