### Welcome to our community

#### Thorra

##### Member
So in this thread I plan to present 3 problems and my takes on them. I think I'll post each next one after I get some help and solution with the current one.

Note that this is a translated problem from my native language.

Write the difference analogue (I mean in discrete form) to a parabolic type operator $$Lv(x,y,t)=\frac{\partial v}{\partial t} - \left(\frac{\partial^2 v}{\partial x^2} + \frac{\partial^2 v}{\partial y^2}\right)$$, if the time step is $\tau$, and the steps by space coordiates are respectively $g$ and $h$.
Using the Taylor series, find out the difference operator's local order of approximation.
Graphically show the respective difference operator pattern with respective coefficients.
Graphically show the equation's $Lv(x,t)=0$ (with one space coordinate) the respective linear algebraic equation system's structure matrix and in vector form in the new time moment (layer) $t^{j+1}$, if the issued differential equation gets additional conditions: $v(a,t)=c_1 (t)_0 ; v(b,t)=c_2 (t)_1 v(x,0)=c_3 (x)$

My take

So I took t as the z coordinate. Wrote this:
$$L^{(0)}_{g,h,\tau} v - L_\tau v -L_g v - L_h v = \frac{v_{i,j}^{k+1} - 2v_{i,j}^k}{\tau} - \frac{v^k_{i+1,j} - v_{i,j}^k + v_{i-1,j}^k}{g^2} - \frac{v^k_{i,j+1} - 2v_{i,j}^k + v_{i,j}-1^k}{h^2}$$

I didn't figure out how to find out the local order of approximation and much less the last requirement, but I figured the pattern image must look something like this (sorry for the poor quality, will draw better next time): Though I don't know about the coefficients, it's just something a coursemate suggested to another coursemate on a similar problem.

Any thoughts on how to legitimately find out the local approximation and that later more advanced thing? And if even what I got is correct in any way? I got 0 points for this.

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Hi again, Thorra! So in this thread I plan to present 3 problems and my takes on them. I think I'll post each next one after I get some help and solution with the current one.

Write the difference analogue (I mean in discrete form) to a parabolic type operator $$Lv(x,y,t)=\frac{\partial v}{\partial t} - \left(\frac{\partial^2 v}{\partial x^2} + \frac{\partial^2 v}{\partial y^2}\right)$$, if the time step is $\tau$, and the steps by space coordiates are respectively $g$ and $h$.
Using the Taylor series, find out the difference operator's local order of approximation.

My take

So I took t as the z coordinate. Wrote this:
$$L^{(0)}_{g,h,\tau} v - L_\tau v -L_g v - L_h v = \frac{v_{i,j}^{k+1} - 2v_{i,j}^k}{\tau} - \frac{v^k_{i+1,j} - v_{i,j}^k + v_{i-1,j}^k}{g^2} - \frac{v^k_{i,j+1} - 2v_{i,j}^k + v_{i,j}-1^k}{h^2}$$

I didn't figure out how to find out the local order of approximation.
Let's start with $$\displaystyle \frac{\partial v}{\partial t}$$ and the Taylor approximation for $v(t+\tau)$.

According to Taylor, we have:
$$v(t+\tau) = v(t) + v'(t)\tau + \frac 1 2 v''(\xi)\tau^2$$
where $\xi$ is a number between $t$ and $t+\tau$ (see wiki: Lagrange form of the remainder).
We can rewrite this to:
$$v'(t) = \frac{v(t+\tau) - v(t)}{\tau} - \frac 1 2 v''(\xi)\tau$$

Does that suggest a way to write the difference operator?
(There seems to be a slight mismatch with what you wrote.)

And perhaps an indication of its local order of approximation?

#### Thorra

##### Member
I hate the internet. I just wrote a loong post with some pretty carefully written wrong formulas and now at when I should already be sleeping anyway I have to do it ALL OVER AGAIN. WHAT? Sorry. I'll write these in notepad in the future. UGH.

Anyway..

I will indeed publish a thread for each of my problems. Is there a way I can edit the title of the thread? (to indicate that this is the 1st problem of 3 so I can have a nice series).

Oh, darn, then I missed the 2nd derivative part of that expression you wrote. And it's the 2nd order local approximation? How can you really tell? I just look at the partial derivative's order. Btw, was global approximation by an order lower than the local approximation (i.e., first order in this case if local is indeed 2nd order) ?
So I write out the formula:
$$v(x+g)=v(g) + v^{'}(x)g + \frac{1}{2}v^{''}(x)g + \frac{1}{6}v^{'''}g^3$$
Then I use your written out formula for $v^{'}$ and proceed to mistakingly type out:
$$v{''}(x)=2 \frac{v(x+g)-v(x)}{h^2} - \frac{1}{3}gv^{'''}(x) - v^{'}(x)\frac{1}{g}$$
$$v{''}(x)=2 \frac{v(x+g)-v(x)}{h^2} - \frac{1}{3}gv^{'''}(x) - \frac{v(x+h)-v(x)}{h^2}+\frac{1}{2}v^{''}(x)$$
$$\frac{1}{2}v{''}(x)=\frac{v(x+g)-v(x)}{h^2} - \frac{1}{3}gv^{'''}(x)$$
$$v{''}(x)=2 \frac{v(x+g)-v(x)}{h^2} - \frac{2}{3}gv^{'''}(x)$$
Okay... so could you explain to me what is wrong with my understanding? And I usually see 3 points rather than 2 in 2nd order derivatives: $x-h$, $x$ and $x+h$.

I think that you call \epsilon we call O, though. Or well not really. Our professor just writes the error part like $O(h^2)$ (for 2nd order error) at the end of an equation.

Anyway... hope I didn't forget anything. NOT writing this again (obviously, since now I used notepad++ like I should have to begin with).

#### Klaas van Aarsen

##### MHB Seeker
Staff member
I hate the internet. I just wrote a loong post with some pretty carefully written wrong formulas and now at when I should already be sleeping anyway I have to do it ALL OVER AGAIN. WHAT? Sorry. I'll write these in notepad in the future. UGH.
Good idea. You'll love the internet after getting a couple of these lessons down the hard way.
I've learned the same way. I will indeed publish a thread for each of my problems. Is there a way I can edit the title of the thread? (to indicate that this is the 1st problem of 3 so I can have a nice series).
You can't, but I can and just did.

Oh, darn, then I missed the 2nd derivative part of that expression you wrote. And it's the 2nd order local approximation? How can you really tell? I just look at the partial derivative's order. Btw, was global approximation by an order lower than the local approximation (i.e., first order in this case if local is indeed 2nd order) ?
I think that you call \epsilon we call O, though. Or well not really. Our professor just writes the error part like $O(h^2)$ (for 2nd order error) at the end of an equation.
It's not an \epsilon ($\varepsilon$). It's a \xi ($\xi$), which is just an arbitrary variable.

The approximation is a first order approximation, which is written as $\mathcal O(\tau)$.
This notation means that the error is less than some constant times $\tau$.
The expression $\frac{1}{2}v''(\xi)$ with $\xi$ between $t$ and $t+\tau$ takes on a maximum absolute value somewhere on that interval. That means that there is an upper bound to it that we can treat as a "constant".
So:
$$\frac{1}{2}v''(\xi) \tau = \mathcal O(\tau)$$

So I write out the formula:
$$v(x+g)=v(g) + v^{'}(x)g + \frac{1}{2}v^{''}(x)g + \frac{1}{6}v^{'''}g^3$$
Then I use your written out formula for $v^{'}$ and proceed to mistakingly type out:
$$v{''}(x)=2 \frac{v(x+g)-v(x)}{h^2} - \frac{1}{3}gv^{'''}(x) - v^{'}(x)\frac{1}{g}$$
$$v{''}(x)=2 \frac{v(x+g)-v(x)}{h^2} - \frac{1}{3}gv^{'''}(x) - \frac{v(x+h)-v(x)}{h^2}+\frac{1}{2}v^{''}(x)$$
$$\frac{1}{2}v{''}(x)=\frac{v(x+g)-v(x)}{h^2} - \frac{1}{3}gv^{'''}(x)$$
$$v{''}(x)=2 \frac{v(x+g)-v(x)}{h^2} - \frac{2}{3}gv^{'''}(x)$$
Okay... so could you explain to me what is wrong with my understanding? And I usually see 3 points rather than 2 in 2nd order derivatives: $x-h$, $x$ and $x+h$.
Well... you seem to have mixed up a couple of $x$, $g$, and $h$.
You do seem to get the hang of $\LaTeX$. Anyway, let's go back to the first derivative for a sec.
We can write:
\begin{array}{}
v(x+g)&=&v(x) + v'(x)g + \frac{1}{2}v''(x)g^2 + \frac{1}{6}v'''(\xi)g^3 & \qquad & (1) \\
v(x-g)&=&v(x) - v'(x)g + \frac{1}{2}v''(x)g^2 - \frac{1}{6}v'''(\theta)g^3& & (2)
\end{array}
where $x \le \xi \le x + g$ and $x - g \le \theta \le x$.

Subtract them to get:
$$v(x+g)-v(x-g)=2v'(x)g + \frac{1}{6}v'''(\xi)g^3 + \frac{1}{6}v'''(\theta)g^3$$
Rewrite as:
\begin{aligned}
v'(x) &= \frac{v(x+g)-v(x-g)}{2g} - \frac{1}{12}(v'''(\xi) + v'''(\theta))g^2 \\
&= \frac{v(x+g)-v(x-g)}{2g} + \mathcal O(g^2) & \qquad (3)
\end{aligned}
Blimey! We've got a 2nd order approximation now - just by taking the values symmetrically around the point we're interested in. For the second order derivative we can substitute $v'$ for $v$ in (3):
$$v''(x) = \frac{v'(x+g)-v'(x-g)}{2g} + \mathcal O(g^2)$$
Now substitute (3) into it - twice...

#### Thorra

##### Member
Sorry in advance.... this is going to be a long one.

You can't, but I can and just did.
Thank you!
It's not an \epsilon ($\varepsilon$). It's a \xi ($\xi$), which is just an arbitrary variable.
Hah yeah didn't even notice that.

The approximation is a first order approximation, which is written as $\mathcal O(\tau)$.
This notation means that the error is less than some constant times $\tau$.
The expression $\frac{1}{2}v''(\xi)$ with $\xi$ between $t$ and $t+\tau$ takes on a maximum absolute value somewhere on that interval. That means that there is an upper bound to it that we can treat as a "constant".
So:
$$\frac{1}{2}v''(\xi) \tau = \mathcal O(\tau)$$
Oh riight we take $x+$ potentially $g$ because that would assume the worst case scenario right? (Like later in stability) Not sure why you wouldn't assume that a bit earlier though and stuff.. aaaah math is not my thing! I bet there's a whole science behind just determining that function of $\xi$ and $\theta$ derivatives. I see some analogy there with the integration constant, but in intergation we just make up the lower&upper bounds.

Well... you seem to have mixed up a couple of $x$, $g$, and $h$.
You do seem to get the hang of $\LaTeX$.  Oh wow I had no idea I could make so much typos in such a short period. But I suppose it makes sense given how late I (re)wrote it. I'll get better at it though. I spent all my energy just getting the syntax right there.

Anyway, let's go back to the first derivative for a sec.
We can write:
\begin{array}{}
v(x+g)&=&v(x) + v'(x)g + \frac{1}{2}v''(x)g^2 + \frac{1}{6}v'''(\xi)g^3 & \qquad & (1) \\
v(x-g)&=&v(x) - v'(x)g + \frac{1}{2}v''(x)g^2 - \frac{1}{6}v'''(\theta)g^3& & (2)
\end{array}
where $x \le \xi \le x + g$ and $x - g \le \theta \le x$.
Well that's a cool way to get rid of some of the derivatives.

Subtract them to get:
$$v(x+g)-v(x-g)=2v'(x)g + \frac{1}{6}v'''(\xi)g^3 + \frac{1}{6}v'''(\theta)g^3$$
Rewrite as:
\begin{aligned}
v'(x) &= \frac{v(x+g)-v(x-g)}{2g} - \frac{1}{12}(v'''(\xi) + v'''(\theta))g^2 \\
&= \frac{v(x+g)-v(x-g)}{2g} + \mathcal O(g^2) & \qquad (3)
\end{aligned}
Blimey! We've got a 2nd order approximation now - just by taking the values symmetrically around the point we're interested in. Awesome!

For the second order derivative we can substitute $v'$ for $v$ in (3):
$$v''(x) = \frac{v'(x+g)-v'(x-g)}{2g} + \mathcal O(g^2)$$
Now substitute (3) into it - twice...
Ok, this one I did not get by doing it your way cause I don't know how to exactly get a good form of a derived v(x+g), but I rewrote those taylor series points again but with a 4th derivative:
$$v(x+g)=v(x) + v^{'}(x)g + \frac{1}{2}v^{''}(x)g^2 + \frac{1}{6}v^{'''}(x)g^3 + \frac{1}{24}v^{IV}(\xi)g^4$$
$$v(x-g)=v(x) - v^{'}(x)g + \frac{1}{2}v^{''}(x)g^2 - \frac{1}{6}v^{'''}(x)g^3 + \frac{1}{24}v^{IV}(\theta)g^4$$
and SUMMED them this time. And got:
$$v^{''}(x)=\frac{v(x+g) - 2v(x) + v(x-g)}{g^2} - \frac{1}{12}(v^{IV}(\xi)+v^{IV}(\theta))g^2$$
$$v^{''}(x)=\frac{v(x+g) - 2v(x) + v(x-g)}{g^2} - \frac{1}{12}O(g^2)$$

But I don't get how you wanted me to do it.

And am I correct that the step g is the one who puts the final word in what kind of approximation it is? Also is this the local approximation? If so where is the global approximation used? (or the other way around if I'm mistaken)

And... where were we even? If I... put them all together then:
the difference analogue to that parabolic equation in OP is:
$$Lv(x,y,t)=\frac{\partial v}{\partial t} - \left(\frac{\partial^2 v}{\partial x^2} + \frac{\partial^2 v}{\partial y^2}\right) = \frac{v(t+\tau)-v(t-\tau)}{2 \tau} + \frac{v(x+g)-2v(x)+v(x-g)}{g^2} + \frac{v(y+h)-2v(y)+v(y-h)}{h^2} + \mathcal O(\tau, g^2, h^2)$$
? I think I had it written like this though (maybe with indexes instead and not such an idication of the error) and I got zero points.

Well anyway... next up:
Using the Taylor series, find out the difference operator's local order of approximation:
I just rewrite the formulas like
$$v(x+g)=v(x) + v^{'}(x)g + \frac{1}{2}v^{''}(x)g^2 + \frac{1}{6}v^{'''}(x)g^3 + \frac{1}{24}v^{IV}(\xi)g^4$$
$$v(x-g)=v(x) - v^{'}(x)g + \frac{1}{2}v^{''}(x)g^2 - \frac{1}{6}v^{'''}(x)g^3 + \frac{1}{24}v^{IV}(\theta)g^4$$
$$v^{''}(x)=\frac{v(x+g) - 2v(x) + v(x-g)}{g^2} - \frac{1}{12}(v^{IV}(\xi)+v^{IV}(\theta))g^2$$
and I did and just finish with something like $\psi=\mathcal O(\tau, g^2, h^2)$?

Graphically show the respective difference operator pattern with respective coefficients:
So I already made that crappy, crappy drawing in the OP. But I've little idea how to tell what coefficients are right to use.

And will you show me sometime (maybe not in the next post if I'm still far too dumb for the first 3 challenges) how to push the final one? It looks ridiculously hard but who cares, right?

Alright... I think I'm finally done proofreading my post and correcting the endless row of mistakes and answering my own questions and stuff. I think this is one of the longest forum posts I have ever made.

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Sorry in advance.... this is going to be a long one.

Thank you!

Hah yeah didn't even notice that.

Oh riight we take $x+$ potentially $g$ because that would assume the worst case scenario right? (Like later in stability) Not sure why you wouldn't assume that a bit earlier though and stuff.. aaaah math is not my thing! I bet there's a whole science behind just determining that function of $\xi$ and $\theta$ derivatives. I see some analogy there with the integration constant, but in intergation we just make up the lower&upper bounds. Oh wow I had no idea I could make so much typos in such a short period. But I suppose it makes sense given how late I (re)wrote it. I'll get better at it though. I spent all my energy just getting the syntax right there.

Well that's a cool way to get rid of some of the derivatives.

Awesome!

Ok, this one I did not get by doing it your way cause I don't know how to exactly get a good form of a derived v(x+g), but I rewrote those taylor series points again but with a 4th derivative:
$$v(x+g)=v(x) + v^{'}(x)g + \frac{1}{2}v^{''}(x)g^2 + \frac{1}{6}v^{'''}(x)g^3 + \frac{1}{24}v^{IV}(\xi)g^4$$
$$v(x-g)=v(x) - v^{'}(x)g + \frac{1}{2}v^{''}(x)g^2 - \frac{1}{6}v^{'''}(x)g^3 + \frac{1}{24}v^{IV}(\theta)g^4$$
and SUMMED them this time. And got:
$$v^{''}(x)=\frac{v(x+g) - 2v(x) + v(x-g)}{g^2} - \frac{1}{12}(v^{IV}(\xi)+v^{IV}(\theta))g^2$$
$$v^{''}(x)=\frac{v(x+g) - 2v(x) + v(x-g)}{g^2} - \frac{1}{12}O(g^2)$$
Good!

But I don't get how you wanted me to do it.
Ah, sorry, I intended it a little different.

Since we have:
$$v'(x)=\frac{v(x+g) - v(x-g)}{2g} + \mathcal O(g^2)$$
Or wait. Let me rewrite that as:
$$v'(y)=\frac{v(y+g) - v(y-g)}{2g} + \mathcal O(g^2)$$
Now we can substitute y=x+g to get:
\begin{aligned}v'(x+g)&=\frac{v((x+g)+g) - v((x+g)-g)}{2g} + \mathcal O(g^2) \\
&= \frac{v(x+2g) - v(x)}{2g} + \mathcal O(g^2)
\end{aligned}

That is what I wanted to suggest to substitute in the equation I labeled as (3).

But your way works too! And am I correct that the step g is the one who puts the final word in what kind of approximation it is? Also is this the local approximation? If so where is the global approximation used? (or the other way around if I'm mistaken)

And... where were we even? If I... put them all together then:
the difference analogue to that parabolic equation in OP is:
$$Lv(x,y,t)=\frac{\partial v}{\partial t} - \left(\frac{\partial^2 v}{\partial x^2} + \frac{\partial^2 v}{\partial y^2}\right) = \frac{v(t+\tau)-v(t-\tau)}{2 \tau} + \frac{v(x+g)-2v(x)+v(x-g)}{g^2} + \frac{v(y+h)-2v(y)+v(y-h)}{h^2} + \mathcal O(\tau, g^2, h^2)$$
? I think I had it written like this though (maybe with indexes instead and not such an idication of the error) and I got zero points.
It looks almost right... up to a couple of + and - signs.
It should be something like:
\begin{aligned}Lv(x,y,t)&=\frac{\partial v}{\partial t} - \left(\frac{\partial^2 v}{\partial x^2} + \frac{\partial^2 v}{\partial y^2}\right) \\
&= \frac{v(t+\tau)-v(t-\tau)}{2 \tau} - \frac{v(x+g)-2v(x)+v(x-g)}{g^2} - \frac{v(y+h)-2v(y)+v(y-h)}{h^2} + \mathcal O(\tau) + \mathcal O(g^2) + \mathcal O(h^2)
\end{aligned}

Well anyway... next up:
Using the Taylor series, find out the difference operator's local order of approximation:
I just rewrite the formulas like

and I did and just finish with something like $\psi=\mathcal O(\tau, g^2, h^2)$?
Ah well, I don't know such a way of writing it.
I would write it saying the order of approximation is:
$$\mathcal O(\tau) + \mathcal O(g^2) + \mathcal O(h^2)$$

Graphically show the respective difference operator pattern with respective coefficients:
So I already made that crappy, crappy drawing in the OP. But I've little idea how to tell what coefficients are right to use.
The drawing is okayish, but your coefficients should be different.
Alongside the time axis it should be symmetric, allowing negative time delta's.
And along the time axis the coefficient should be $\frac{1}{2\tau}$ respectively $-\frac{1}{2\tau}$.
You need similar coefficients in the other directions.

And will you show me sometime (maybe not in the next post if I'm still far too dumb for the first 3 challenges) how to push the final one? It looks ridiculously hard but who cares, right?
To be honest, I'm not really sure what they want to see.
But I guess I can write an after note or something.

Alright... I think I'm finally done proofreading my post and correcting the endless row of mistakes and answering my own questions and stuff. I think this is one of the longest forum posts I have ever made.

#### Thorra

##### Member
Good!

Ah, sorry, I intended it a little different.

Since we have:
$$v'(x)=\frac{v(x+g) - v(x-g)}{2g} + \mathcal O(g^2)$$
Or wait. Let me rewrite that as:
$$v'(y)=\frac{v(y+g) - v(y-g)}{2g} + \mathcal O(g^2)$$
Now we can substitute y=x+g to get:
\begin{aligned}v'(x+g)&=\frac{v((x+g)+g) - v((x+g)-g)}{2g} + \mathcal O(g^2) \\
&= \frac{v(x+2g) - v(x)}{2g} + \mathcal O(g^2)
\end{aligned}

That is what I wanted to suggest to substitute in the equation I labeled as (3).

But your way works too! Hah, yeah why did my brain not think of that. Sometimes the substitution concept seems so subtle I miss it.

It looks almost right... up to a couple of + and - signs.
!!! I knew it should've looked that way, I simply forgot it's minus those last 2 operators. But hey glad I got it right. Hope I make it next time around. Just gonna practice on some other examples.

Ah well, I don't know such a way of writing it.
I would write it saying the order of approximation is:
$$\mathcal O(\tau) + \mathcal O(g^2) + \mathcal O(h^2)$$
Ah I'm an idiot, the expression I meant was $\psi=(\tau+g^2+h^2)$. No wonder I'm failing this class. I'm not even familiar with the basic terminology. Maybe now I'll start to get the hang of it.

Nevermind.. I did now see a $\mathcal O(h^2, \tau^2)$ type of writing. Huh.

The drawing is okayish, but your coefficients should be different.
Alongside the time axis it should be symmetric, allowing negative time delta's.
And along the time axis the coefficient should be $\frac{1}{2\tau}$ respectively $-\frac{1}{2\tau}$.
You need similar coefficients in the other directions.
Ok... I'm affraid I did not quite get all that you said, but this is the only interpretation I could think of: Which goes against your first statement that my drawing is "okayish", and also I don't understand why $\frac{1}{2\tau}$ rather that just $\frac{1}{2}$. Also With alongside you mean that I should sketch in some paralel time points in as well or what? I mean that would go beyond the basic pattern, wouldn't it?

To be honest, I'm not really sure what they want to see.
But I guess I can write an after note or something.
Ah well that was a stretch anyway. I'll have a deeper look at it first and then post my complaint, hopefully in more detail. I'll post the 3rd task too sometime soon.

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Hah, yeah why did my brain not think of that. Sometimes the substitution concept seems so subtle I miss it.

!!! I knew it should've looked that way, I simply forgot it's minus those last 2 operators. But hey glad I got it right. Hope I make it next time around. Just gonna practice on some other examples.

Ah I'm an idiot, the expression I meant was $\psi=(\tau+g^2+h^2)$. No wonder I'm failing this class. I'm not even familiar with the basic terminology. Maybe now I'll start to get the hang of it.
Btw, it should be $\mathcal O(\tau^2)$ instead of $\mathcal O(\tau)$.

Nevermind.. I did now see a $\mathcal O(h^2, \tau^2)$ type of writing. Huh.
I looked it up, and the big O notation is indeed also defined for vectors.
That is what writing it like that would mean I guess.
That is, the absolute difference is bounded by the dot product of some constant vector and the given vector, which makes sense.

Ok... I'm affraid I did not quite get all that you said, but this is the only interpretation I could think of: Which goes against your first statement that my drawing is "okayish", and also I don't understand why $\frac{1}{2\tau}$ rather that just $\frac{1}{2}$. Also With alongside you mean that I should sketch in some paralel time points in as well or what? I mean that would go beyond the basic pattern, wouldn't it?

Ah well that was a stretch anyway. I'll have a deeper look at it first and then post my complaint, hopefully in more detail. I'll post the 3rd task too sometime soon.
Looks much better!

Your formula can be reordered to:
\begin{array}{}
Lv(x,y,t)
&=& \frac{v(t+\tau)-v(t-\tau)}{2 \tau} - \frac{v(x+g)-2v(x)+v(x-g)}{g^2} - \frac{v(y+h)-2v(y)+v(y-h)}{h^2} \\
&& + \ \mathcal O(\tau^2, g^2, h^2) \\
&=& \left(\frac 2 {g^2} + \frac 2 {h^2}\right)v(x) + \frac 1{2 \tau}v(t+\tau)- \frac 1{2 \tau}v(t-\tau) \\
&& - \frac 1{g^2}v(x+g)-\frac 1{g^2}v(x-g) - \frac 1 {h^2}v(y+h)-\frac 1 {h^2}v(y-h) \\
&&+ \ \mathcal O(\tau^2, g^2,h^2)
\end{array}

So:
1. The step in the t-direction is $\tau$ instead of $\tau / 2$.
2. The weight at the origin is $\frac 2 {g^2} + \frac 2 {h^2}$.
3. The weight at both sides of the x-axis should be $-\frac 1{g^2}$.
4. The weight at both sides of the y-axis should be $-\frac 1{h^2}$.

#### Thorra

##### Member
Btw, it should be $\mathcal O(\tau^2)$ instead of $\mathcal O(\tau)$.
Oh yeah! Silly me.

I looked it up, and the big O notation is indeed also defined for vectors.
That is what writing it like that would mean I guess.
That is, the absolute difference is bounded by the dot product of some constant vector and the given vector, which makes sense.
Cool I guess. Where is the constant vector? Nah, I won't pretend I understand this. Looks much better!

Your formula can be reordered to:
\begin{array}{}
Lv(x,y,t)
&=& \frac{v(t+\tau)-v(t-\tau)}{2 \tau} - \frac{v(x+g)-2v(x)+v(x-g)}{g^2} - \frac{v(y+h)-2v(y)+v(y-h)}{h^2} \\
&& + \ \mathcal O(\tau^2, g^2, h^2) \\
&=& \left(\frac 2 {g^2} + \frac 2 {h^2}\right)v(x) + \frac 1{2 \tau}v(t+\tau)- \frac 1{2 \tau}v(t-\tau) \\
&& - \frac 1{g^2}v(x+g)-\frac 1{g^2}v(x-g) - \frac 1 {h^2}v(y+h)-\frac 1 {h^2}v(y-h) \\
&&+ \ \mathcal O(\tau^2, g^2,h^2)
\end{array}
Oh that is making sense now. But,this part $$\left(\frac 2 {g^2} + \frac 2 {h^2}\right)v(x)$$
You meant to have $v(x,y)$ instead, right? That's the only way things make sense now.

So:
1. The step in the t-direction is $\tau$ instead of $\tau / 2$.
2. The weight at the origin is $\frac 2 {g^2} + \frac 2 {h^2}$.
3. The weight at both sides of the x-axis should be $-\frac 1{g^2}$.
4. The weight at both sides of the y-axis should be $-\frac 1{h^2}$.
That is pretty amazing. It's like I understand it now. Thank you!

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Cool I guess. Where is the constant vector? Nah, I won't pretend I understand this. I'll leave it for another time then. Oh that is making sense now. But,this part $$\left(\frac 2 {g^2} + \frac 2 {h^2}\right)v(x)$$
You meant to have $v(x,y)$ instead, right? That's the only way things make sense now.
Yeah. Right!
Actually, it would be $v(t,x,y)$.
And where we write $v(t + \tau)$ it is actually $v(t + \tau, x, y)$.

That is pretty amazing. It's like I understand it now. Thank you!
Good! #### Thorra

##### Member
For the second order derivative we can substitute $v'$ for $v$ in (3):
$$v''(x) = \frac{v'(x+g)-v'(x-g)}{2g} + \mathcal O(g^2)$$
Now substitute (3) into it - twice...
Ah, sorry, I intended it a little different.

Since we have:
$$v'(x)=\frac{v(x+g) - v(x-g)}{2g} + \mathcal O(g^2)$$
Or wait. Let me rewrite that as:
$$v'(y)=\frac{v(y+g) - v(y-g)}{2g} + \mathcal O(g^2)$$
Now we can substitute y=x+g to get:
\begin{aligned}v'(x+g)&=\frac{v((x+g)+g) - v((x+g)-g)}{2g} + \mathcal O(g^2) \\
&= \frac{v(x+2g) - v(x)}{2g} + \mathcal O(g^2)
\end{aligned}

That is what I wanted to suggest to substitute in the equation I labeled as (3).
Edit: I somewhat solved it myself I think but don't fully understand it.

Sorry, but I'm looking over this now cause I want to get a 3rd order approximation and this looks like the only way now, but I don't get it.

I got this far:
$1)$ $y=x+g$
$$v^{''}(x+g)=\frac{v^{'}(x+2g)-v^{'}(x)}{2g}+ \mathcal O(g^2)$$
$2)$ $y=x-g$
$$v^{''}(x-g)=\frac{v^{'}(x)-v^{'}(x-2g)}{2g}+ \mathcal O(g^2)$$
That is to say, not much farther than you wrote.

Cause If I just take the v(x+2g) or v(x-2g) and advance it in the Taylor series, then derive the entire series, I just get more derivatives that I can't use for all that much. And why do I have to go a step forward anyway? That does not make any sense to me either. Edit: Or rather the fact that the 2nd derivative's step is going forward... Did I miswrote..

Edit: Oh I'm just being a big old idiot aren't I. We get this: $$\frac{v(x+2g) - 2v(x) + v(x-2g)}{4g^2} + \mathcal O(g^2)$$ right? And can $v(x+2g)$ to get $v(x+g)$ by just making $4g^2$ to $g^2$? I don't quite understand how that works, though.

Edit: And is the 3rd order approximation looking like this?
$$v^{'''}(x)=\frac{v^{'}(x+g)-2v^{'}(x)+v^{'}(x-g)}{g^2}=\frac{v(x+2g)-2v(x+g)-2v(x-g)-v(x-2g)}{2g^2}+\mathcal O(g^2)$$

Last edited:

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Edit: I somewhat solved it myself I think but don't fully understand it.

Sorry, but I'm looking over this now cause I want to get a 3rd order approximation and this looks like the only way now, but I don't get it.

I got this far:
$1)$ $y=x+g$
$$v^{''}(x+g)=\frac{v^{'}(x+2g)-v^{'}(x)}{2g}+ \mathcal O(g^2)$$
$2)$ $y=x-g$
$$v^{''}(x-g)=\frac{v^{'}(x)-v^{'}(x-2g)}{2g}+ \mathcal O(g^2)$$
That is to say, not much farther than you wrote.

Cause If I just take the v(x+2g) or v(x-2g) and advance it in the Taylor series, then derive the entire series, I just get more derivatives that I can't use for all that much. And why do I have to go a step forward anyway? That does not make any sense to me either. Edit: Or rather the fact that the 2nd derivative's step is going forward... Did I miswrote..

Edit: Oh I'm just being a big old idiot aren't I. We get this: $$\frac{v(x+2g) - 2v(x) + v(x-2g)}{4g^2} + \mathcal O(g^2)$$ right? And can $v(x+2g)$ to get $v(x+g)$ by just making $4g^2$ to $g^2$? I don't quite understand how that works, though.
Hmm, there's one problem.
If you divide your expression with $\mathcal O(g^2)$ by $g$, you're left with $\mathcal O(g)$.
That is, because $\mathcal O(g^2)$ merely means some constant $C$ times $g^2$.
If you divide $C g^2$ by $g$, you're left with $C g$. Or in other words $\mathcal O(g)$.

Edit: And is the 3rd order approximation looking like this?
$$v^{'''}(x)=\frac{v^{'}(x+g)-2v^{'}(x)+v^{'}(x-g)}{g^2}=\frac{v(x+2g)-2v(x+g)-2v(x-g)-v(x-2g)}{2g^2}+\mathcal O(g^2)$$
I dunno. I haven't tried to figure it out yet. #### Thorra

##### Member
Hmm, there's one problem.
If you divide your expression with $\mathcal O(g^2)$ by $g$, you're left with $\mathcal O(g)$.
That is, because $\mathcal O(g^2)$ merely means some constant $C$ times $g^2$.
If you divide $C g^2$ by $g$, you're left with $C g$. Or in other words $\mathcal O(g)$.
Yeah, that's true, I realised it myself afterwards.

Anyways... this expression is useless anyway with such a low approx order. But I don't understand how I can properly enhance it.
And now I came accross something really confusing and disturbing. A material, that tells me that Taylor's general formula is actually:
$$v(x+h)=v(x)+hf(t(x),v(x))+\frac{h^2}{2}\frac{df}{dt}(t(x),v(x))$$
but I see there's also 2 functions within another function instead ofa single whole function now... so eh. Complicated.

Looking again at a material about differential approximation I've looked at for more than half a semester by now... and I still don't get it. It does some magic to gain $\mathcal O(h^4)$ level of approximation, but it uses such obscure terminology that I just can't really follow. Let alone in a limited time frame.

#### Thorra

##### Member

Write the difference analogue (I mean in discrete form) to a parabolic type operator $$Lv(x,y,t)=\frac{\partial v}{\partial t} - \left(\frac{\partial^2 v}{\partial x^2} + \frac{\partial^2 v}{\partial y^2}\right)$$, if the time step is $\tau$, and the steps by space coordiates are respectively $g$ and $h$.
Using the Taylor series, find out the difference operator's local order of approximation.
Graphically show the respective difference operator pattern with respective coefficients.
Graphically show the equation's $Lv(x,t)=0$ (with one space coordinate) the respective linear algebraic equation system's structure matrix and in vector form in the new time moment (layer) $t^{j+1}$, if the issued differential equation gets additional conditions: $v(a,t)=c_1 (t)_0 ; v(b,t)=c_2 (t)_1 v(x,0)=c_3 (x)$
Finally adressing this last issue. From looking over my notes I deduced that:
These are the boundary conditions:
$$v(a,t)=c_1 (t)_0$$
$$v(b,t)=c_2 (t)_1$$
And this is the initial condition:
$$v(x,0)=c_3(x)$$
and that $a<x<b$ $->$ $h$ and $0<t<t_3$ $->$ $\tau$

And from looking over my notes I noticed that all those matrixes and stuff lookedl iek they had those exact coefficients in them that I had in my "pattern model" at least in the centre. Diagonally. The beginning and end of the diagonals were I think $1$s and it goes in an equation where $A\cdot y=F$, where A is the forementioned matrix, y is the vector with boundary values at the start and end and... so is F, by the looks of it.

So I don't know why I'm telling you this, maybe you can add something, but this is also becoming a place where I write down my thoughts with some nice formulas.

All that I could maybe try and go through, but I am stopped at the very start of the named problem: $Lv(x,t)=0$. Just what the hell is that useful for? $0$? All the examples in my notes have some arbitrary functions, so I don't even know how I would formulate a differential approximation. Unless it's somehow conntected to my original equation minus the y coordinate.
$$Lv(x,t)=\frac{\partial v}{\partial t} -\frac{\partial^2 v}{\partial x^2}=0$$ ? That is weird and messed up, lol.

EDIT:

I looked it up, and the big O notation is indeed also defined for vectors.
That is what writing it like that would mean I guess.
That is, the absolute difference is bounded by the dot product of some constant vector and the given vector, which makes sense.
Now that I read it again.. isn't this somewhat similar to what I wrote about the $Ay=F$? Cause at least the y and F are vectors. And A is just a diagonal otherwise empty matrix.

Last edited:

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Yeah, that's true, I realised it myself afterwards.

Anyways... this expression is useless anyway with such a low approx order. But I don't understand how I can properly enhance it.
And now I came accross something really confusing and disturbing. A material, that tells me that Taylor's general formula is actually:
$$v(x+h)=v(x)+hf(t(x),v(x))+\frac{h^2}{2}\frac{df}{dt}(t(x),v(x))$$
but I see there's also 2 functions within another function instead ofa single whole function now... so eh. Complicated.

Looking again at a material about differential approximation I've looked at for more than half a semester by now... and I still don't get it. It does some magic to gain $\mathcal O(h^4)$ level of approximation, but it uses such obscure terminology that I just can't really follow. Let alone in a limited time frame.
That does not look like a general formula for Taylor.
I guess that in numerical approximation problems, f(t(x), v(x)) might be introduced to represent the derivative of v(x) based on the inputs t(x) and v(x).
In that case, your formula is a more specialized version of Taylor's formula.

Finally adressing this last issue. From looking over my notes I deduced that:
These are the boundary conditions:
$$v(a,t)=c_1 (t)_0$$
$$v(b,t)=c_2 (t)_1$$
And this is the initial condition:
$$v(x,0)=c_3(x)$$
and that $a<x<b$ $->$ $h$ and $0<t<t_3$ $->$ $\tau$

And from looking over my notes I noticed that all those matrixes and stuff lookedl iek they had those exact coefficients in them that I had in my "pattern model" at least in the centre. Diagonally. The beginning and end of the diagonals were I think $1$s and it goes in an equation where $A\cdot y=F$, where A is the forementioned matrix, y is the vector with boundary values at the start and end and... so is F, by the looks of it.

So I don't know why I'm telling you this, maybe you can add something, but this is also becoming a place where I write down my thoughts with some nice formulas.
I do not know what a structure matrix is.
Nor do I understand what this index 0 is supposed to represent in $c_1(t)_0$.
Also, I cannot find a matrix A earlier in this thread... All that I could maybe try and go through, but I am stopped at the very start of the named problem: $Lv(x,t)=0$. Just what the hell is that useful for? $0$? All the examples in my notes have some arbitrary functions, so I don't even know how I would formulate a differential approximation. Unless it's somehow conntected to my original equation minus the y coordinate.
$$Lv(x,t)=\frac{\partial v}{\partial t} -\frac{\partial^2 v}{\partial x^2}=0$$ ? That is weird and messed up, lol.

EDIT:
Now that I read it again.. isn't this somewhat similar to what I wrote about the $Ay=F$? Cause at least the y and F are vectors. And A is just a diagonal otherwise empty matrix.
The equation $Lv(x,t)=0$ is a differential equation, like you have in your problem III.
It will have multiple solutions depending on which boundary values are chosen, such as v(x,0), and v(0,t).

#### Thorra

##### Member
Quick question: Could you tell how to approximate to $\mathcal O(h^4)$? The same $v''(x)$ or whatever works.

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Quick question: Could you tell how to approximate to $\mathcal O(h^4)$? The same $v''(x)$ or whatever works.
There you go: II #9.
Expand 1 more term and add 1 more equation.