hmwk_6_2010_solutions

# 3 y n 4 y n 1 y n 2 2δ x 2 for each other nodes we

• Notes
• 18

This preview shows page 3 - 6 out of 18 pages.

3 y N - 4 y N - 1 + y N - 2 x = 2 For each other nodes, we we write out a discrete approximation of the problem we are trying to solve at each node. More specifically, we use the following second order central difference approximations for 3

Subscribe to view the full document.

the first and second derivatives at node i : d 2 y dx 2 ( x i ) = y i +1 - 2 y i + y i - 1 Δ x 2 , i = 1 . . . N - 1 dy dx ( x i ) = y i +1 - y i - 1 x Plugging these into our problem we get the following approximation at node i : y i +1 - 2 y i + y i - 1 Δ x 2 + x i y i +1 - y i - 1 x + y i 1 6 = 3 With this, our system of equations for any of the Δ x values is as follows: y 0 = 12 y 2 - 2 y 1 + y 0 Δ x 2 + x 1 y 2 - y 0 x + y 1 1 6 = 3 · · · y N - 2 y N - 1 + y N - 2 Δ x 2 + x N - 1 y N - y N - 2 x + y N - 1 1 6 = 3 3 y N - 4 y N - 1 + y N - 2 x = 2 (c) To write the equations in matrix form (AY = B), we first note that the B vector is simply populated with the right hand sides of all our equations: B = 12 3 3 . . . 3 2 The Y vector is the vector of our unknown y i values. Y = y 0 y 1 y 2 . . . y N - 1 y N Now, to set up the A matrix, we must find the coefficients associated with each y i value in each equation. For the first equation we know that the coefficient associated with y 0 equals 1, and all others are zero. Rearranging the last equation yields: 1 x y N - 2 + - 4 x y N - 1 + 3 x y N = 2 4
0 2 4 6 8 10 -140 -120 -100 -80 -60 -40 -20 0 20 x y(x) Problem 3 Solutions for varying Δ x dx=2.5 dx=0.5 dx=0.1 dx=0.001 Figure 3: Solutions for Δ x = 2.5, Δ x = 0.5, Δ x = 0.1, and Δ x = 0.001. For the last equation, the coefficients associated with y N , y N - 1 , and y N - 2 are 3 x , - 4 x , and 1 x respectively. All others are zero. For each other node i , we rearrange terms: 1 Δ x 2 - x i x y i - 1 + - 2 Δ x 2 + 1 6 y i + 1 Δ x 2 + x i x y i +1 = 3 For any equation at node i 6 = 0, N, the coefficients associated with y i - 1 , y i , and y i +1 are 1 Δ x 2 - x i x , - 2 Δ x 2 + 1 6 , and 1 Δ x 2 + x i x , respectively. Finally, putting these coefficients into our A matrix and setting up the AY = B equation we obtain: 1 0 0 ... ... 0 0 1 Δ x 2 - x 1 x - 2 Δ x 2 + 1 6 1 Δ x 2 + x 1 x ... ... 0 0 0 1 Δ x 2 - x 2 x - 2 Δ x 2 + 1 6 1 Δ x 2 + x 2 x ... ... 0 0 ... ... ... ... ... ... ... ... ... ... ... ... ... ... 0 0 0 ... 1 Δ x 2 - x N - 1 x - 2 Δ x 2 + 1 6 1 Δ x 2 + x N - 1 x 0 0 0 ... 1 x - 4 x 3 x y 0 y 1 y 2 . . y N - 1 y N = 12 3 3 . . 3 2 (d) The plots for all 4 solutions are shown in Figure 3. The differences between each of the 3 coarse grid solutions and the Δ x = 0.001 solution are shown in Figure 7. Note that I use a logarithmic scale for the y-axis so that the increase in accuracy from Δ x = 0.5 to Δ x = 0.1 is noticeable. As can be seen, Δ x = 2.5 gives a much less accurate solution.

Subscribe to view the full document.

You've reached the end of this preview.
• Fall '08
• Westerink,J
• Trigraph, yn, Yi, dx, ∆x

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern