Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

My Problem is this given Initial Value Problem: $$y^{\prime}=\frac{3x-2y}{x}\quad y(1)=0$$ I am looking for a way to solve this problem using Heun's method. I have a given Interval of $[1,2]$ and a given step size of $h=0.1$

The example is already solved with a numerical solution. But i want to know more. See here. After discussing the solution by Eulers Method with a friend, he told me about Heun's method. But we failed to apply it to our example. How would Heun's method be applied to this problem?

share|improve this question
1  
I know you are not looking for this. But have you tried the integration factor method? To me it looks fine, although the solution is not explicit: it involves an integral. –  awllower Jul 9 '13 at 6:22
1  
When i am finished, i will try this method as well. Thanks! –  Toralf Westström Jul 9 '13 at 8:35
add comment

1 Answer 1

up vote 4 down vote accepted

We are given:

$$y'=\dfrac{3x-2y}{x}\quad y(1)=0$$

Interval is $x \in[1,2]$, and a given step size $h=0.1$

For Heun's (Improved Euler's), we have:

  • $h = \dfrac{b-a}{N} = .1 = \dfrac{2-1}{N} \rightarrow N = 10$
  • $x = a = 1, y(a) = y(1) = \alpha = 0 \rightarrow a = 1, \alpha = 0$
  • Set: $x_0 = 1, x_i = 1 + 0.1 i, y_0 = 0$
  • Using Heun's (Improved Euler's), we have:

$y_{i+1} = y_{i} + \dfrac{h}{4}\left[f(x_i, y_i)+3f(x_i + \dfrac{2}{3}h, y_i+\dfrac{2}{3}hf(x_i,y_i))\right]$, so

$y_{i+1} = y_{i} + \dfrac{1}{40}\left[\dfrac{3 x_{i-1} - 2 y_{i-1}}{x_{i-1}} + 3\left(\dfrac{3 (x_i + \dfrac{2}{3}(.1)) - 2 (y_i+\dfrac{2}{3}(.1)\dfrac{3 x_{i-1} - 2 y_{i-1}}{x_{i-1}}}{x_i + \dfrac{2}{3}(.1)}\right) \right]$

  • For $i= 1$, we have:

$x_0 = 1, y_0 = 0, y_1 = 0 + \dfrac{1}{40}\left[3 + 3\dfrac{3(1+(2/3)(.1)) - 2(2(.1))}{1 + (2/3)(.1)} \right] = 0.271875$

Continuing this way, we generate the table:

$~~~~~\text{Step} ~~|~~ x ~~~|~~ y $

  • $~~00 ~~| 1.0 ~~| ~~ 0.00000 $
  • $~~01 ~~| 1.1 ~~| ~~ 0.271875 $
  • $~~02 ~~| 1.2 ~~| ~~ 0.503084 $
  • $~~03 ~~| 1.3 ~~| ~~ 0.705482 $
  • $~~04 ~~| 1.4 ~~| ~~ 0.886908 $
  • $~~05 ~~| 1.5 ~~| ~~ 1.05271 $
  • $~~06 ~~| 1.6 ~~| ~~ 1.20664 $
  • $~~07 ~~| 1.7 ~~| ~~ 1.35138 $
  • $~~08 ~~| 1.8 ~~| ~~ 1.48891 $
  • $~~09 ~~| 1.9 ~~| ~~ 1.6207 $
  • $~~10 ~~| 2.0 ~~| ~~ 1.74786$

The exact solution is given by:

$$y(x) = \dfrac{x^3-1}{x^2}$$

At $x=2$, we have: $y(2) = \dfrac{7}{4} = 1.75$

Compare that to Heun's (Improved Euler's) method, which has $1.74786$.

Look at how much better this estimate is over regular Euler's from earlier.

share|improve this answer
    
+1 very nice Amzoti. I don't know this method, but I think I need knowing it. :-) –  B. S. Jul 9 '13 at 8:08
    
@BabakS.: Thank you my friend, those take me too long to type up! :-) Have a great day! Regards –  Amzoti Jul 9 '13 at 12:59
    
Nice work, and + too for all the typing! (+) –  amWhy Jul 10 '13 at 0:04
    
@amWhy: Thanks, it is good to do some of those once in a while to stay in practice! :-) –  Amzoti Jul 10 '13 at 0:07
    
Whoa, that's a long hike! Were you "off" of work today? Or on an extended vacation (a couple days off tacked on the the long weekend?) –  amWhy Jul 10 '13 at 0:18
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.