1. ## 2 point BVP

questions is:

>> -d/dx(e^x y') + 2ye^x = (2-x)e^x

i need to simplify the equation to show that the finite difference method is given by:

>> -(2-h)yi-1 +4(1+h^2)yi -(2+h)yi+1 = 2h^2(2-xi)

I no how to apple the finite difference method so i get the difference equation to get the above but what is:

>> -d/dx(e^x y') + 2ye^x = (2-x)e^x

simplified so it is in the form containing y'' and y'?

2. ## Re: 2 point BVP

Originally Posted by NFS1
questions is:

>> -d/dx(e^x y') + 2ye^x = (2-x)e^x

i need to simplify the equation to show that the finite difference method is given by:

>> -(2-h)yi-1 +4(1+h^2)yi -(2+h)yi+1 = 2h^2(2-xi)

I no how to apple the finite difference method so i get the difference equation to get the above but what is:

>> -d/dx(e^x y') + 2ye^x = (2-x)e^x

simplified so it is in the form containing y'' and y'?
Using the product rule:

$\frac{d}{dx}(e^xy')=e^xy'+e^xy''$

.

3. ## Re: 2 point BVP

How do you apply the finite difference method, once you've simplified the equation?

4. ## Re: 2 point BVP

Originally Posted by KayAB
How do you apply the finite difference method, once you've simplified the equation?
put:

$y(x_i)=y_i$,

$y''(x_i)\approx \frac{y_{i+1}-2y_i+y_{i-1}}{h^2}$ ,

$y'(x_i)\approx \frac{ y_{i+1}- y_{i-1} }{2h}$

into the ODE and simplify.

.

5. ## Re: 2 point BVP

After using the finite difference method I have solved the system using back substitution in matrix form to get:

-(2-h)yi-1 + 4(1+h^2)yi -(2+h)yi+1=2h^2(2-xi) as the difference equation. And using h=0.2 and working to 4dp i got the solutions as:

y1=0.4564
y2=0.1503
y3=0.3862

How do i use this information to show that the analytical solution is: y=-0.6925e^-2x -0.0575e^x +0.75

6. ## Re: 2 point BVP

Originally Posted by NFS1
After using the finite difference method I have solved the system using back substitution in matrix form to get:

-(2-h)yi-1 + 4(1+h^2)yi -(2+h)yi+1=2h^2(2-xi) as the difference equation. And using h=0.2 and working to 4dp i got the solutions as:

y1=0.4564
y2=0.1503
y3=0.3862

How do i use this information to show that the analytical solution is: y=-0.6925e^-2x -0.0575e^x +0.75
Please post the question exactly how it was originally worded.

CB

7. ## Re: 2 point BVP

Originally Posted by zzephod
Please post the question exactly how it was originally worded.

CB
You are given the following two point boundary value problem:

>> -d/dx(e^x y') + 2ye^x = (2-x)e^x where y(0)=y(1)=0

Simplify the equation and show that the resulting difference equation is (below) when the finite difference method is applied:

>> -(2-h)yi-1 + 4(1+h^2)yi -(2+h)yi+1=2h^2(2-xi)

Take h=0.2 and determine the approximate solution?

I got the approximate solution as:

y1=0.4564
y2=0.1503
y3=0.3862

Show that the analytical solution is:

>> y=-0.6925e^-2x -0.0575e^x +0.75

And hence show the errors in your numerical approximation.

8. ## Re: 2 point BVP

Originally Posted by NFS1
You are given the following two point boundary value problem:

>> -d/dx(e^x y') + 2ye^x = (2-x)e^x where y(0)=y(1)=0

Simplify the equation and show that the resulting difference equation is (below) when the finite difference method is applied:

>> -(2-h)yi-1 + 4(1+h^2)yi -(2+h)yi+1=2h^2(2-xi)

Take h=0.2 and determine the approximate solution?

I got the approximate solution as:

y1=0.4564
y2=0.1503
y3=0.3862
I assume y1 is the approximation to $y(0.2)$, y2 to $y(0.4)$, y3 to $y(0.6)$, you should also give the next value $y(0.8)$ and for that matter include the boundary points as well.

Show that the analytical solution is:

>> y=-0.6925e^-2x -0.0575e^x +0.75

And hence show the errors in your numerical approximation.
You just have to show that this solution satisfies the original equation, or its simplified form:

$y''+y'-2y=x-2$

by differentiating twice and substituting into the equation. Then comparing the exact solution at $x=0, 0.2, 0.4, 0.6, 0.6, 1.0$ with your numerical solution.

.