Calculus/Matrix Q: finite diff. matrix for d^2(x)/dx^2 + u =

Goistein

Junior Member
Joined
Oct 8, 2006
Messages
109
What is the 3x3 finite difference matrix for:

d^2(u)/dx^2 + u=x, u(0)=u(1)=0

I thought the answer was
[2 -1 0
-1 2 -1
0 -1 2]

The book said it was
[33 -16 0
-16 33 -16
0 -16 33]

I'm pretty sure my answer is wrong but I don't know why...
 
Re: Calculus/Matrix Question

Goistein said:
What is the 3x3 finite difference matrix for:

d^2(u)/dx^2 + u=x, u(0)=u(1)=0

I thought the answer was
[2 -1 0
-1 2 -1
0 -1 2]

The book said it was
[33 -16 0
-16 33 -16
0 -16 33]

I'm pretty sure my answer is wrong but I don't know why...

What type of difference equation you are supposed to write - forward, backward or central?

Please show us your work - if you want us to correct your mistake?
 
Re: Calculus/Matrix Question

I looked at an example and it looked like the solution for d^2(u)/dx^2= f(x) 0<x<1 was
[2 -1 0 0 0
-1 2 -1 0 0
0 -1 2 -1 0
0 0 -1 2 -1
0 0 0 -1 2]

So since it asked for a 3x3 matrix, I figured it was
[2 -1 0
-1 2 -1
0 -1 2]


p.s. They also gave me h=1/4 if that helps, but if it doesn't I think in the solution they use forward elimination.
 
Re: Calculus/Matrix Question

First write the difference equation of the given ODE - the matrix would simply fall-out of there after you apply the boundary conditions.

Show us the difference equation that you would write for the given ODE.

16 in the ODE comes from h^2 terms.
 
Re: Calculus/Matrix Question

How do you get the difference equation from the differential equation? Does it mean to solve the equation?
 
Re: Calculus/Matrix Question

Goistein said:
How do you get the difference equation from the differential equation? Does it mean to solve the equation? No

\(\displaystyle \frac{d^2u}{dx^2} \, = \, \frac{u_{n-1} \, - \, 2\cdot u_n\, + \, u_{n+1}}{h^2}\)

and continue from there....
 
Re: Calculus/Matrix Question

So that means that the 33 in the answer comes from 2u(n)/h^2+u(n)=33u(n) right? Thanks! :D
 
Top