Crank-Nicolson vs Heun's method

  • Thread starter Smed
  • Start date
  • Tags
    Method
In summary, while the two methods may give the same result for certain cases, the Crank-Nicolson method is more general in that it allows for x-dependence in the u equation.
  • #1
Smed
36
1
Hi, can someone tell me the difference between the Crank-Nicolson and Heun numerical methods? For Heun's method I'm looking here http://en.wikipedia.org/wiki/Heun's_method and for the Crank-Nicolson method I'm looking here http://en.wikipedia.org/wiki/Crank–Nicolson_method . When I actually carry out a calculation with equal timesteps for both methods and f(t,u)=-.5*u, I get the exact same solution.

The equation I have for both is:

u[tex]^{n+1}[/tex] = u[tex]^{n}[/tex] - [tex]\frac{1}{2}[/tex]u[tex]^{n}[/tex]dt - [tex]\frac{1}{8}[/tex]u[tex]^{n}[/tex]dt[tex]^{2}[/tex]
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
I'm no expert, but from what I can gather Heun's method is for ODE's while Crank-Nicolson is for PDE's?
 
  • #3
Heun's method is an improvement of the forward Euler's method which is an explicit method.
While Crank-Nicolson method is an implicit method. Probably the improvement for the backward Euler method. This is the Crank-Nicolson method for ODE.

But of course the Crank-Nicolson method is verypopular in PDE.
 
  • #4
Ah, in all cases I've come across Crank-Nicolson, it has been to solve PDEs.

So, if I read my notes correctly, while both methods take an average of the current state and the state at the next timestep, the main difference between Heun's method and Crank-Nicolson is that for Heun's method you use a predictor for the next timestep, keeping it explicit, while for Crank-Nicolson it is used implicitly instead. At least that's my understanding.

Using this I get some different results from yours, both with Crank-Nicolson and Heun's method, are you sure you do Heun's method correctly?
 
  • #5
Smed said:
The equation I have for both is:

u[tex]^{n+1}[/tex] = u[tex]^{n}[/tex] - [tex]\frac{1}{2}[/tex]u[tex]^{n}[/tex]dt - [tex]\frac{1}{8}[/tex]u[tex]^{n}[/tex]dt[tex]^{2}[/tex]
If we make that a +⅛ instead, I agree that Heun's method gives that equation. But I get something different for Crank-Nicolson.

For Crank-Nicolson, ignore the x-dependence of u and we have
(un+1 - un) / Δt = ½ ( -½ un+1 - ½ un)​
Solve that for un+1 and we get something different than the Heun's method equation. (Though they do agree up to order Δt2.)
 

1. What is the difference between Crank-Nicolson and Heun's method?

Crank-Nicolson and Heun's method are both numerical methods used to solve ordinary differential equations. The main difference between these two methods lies in their approach to approximating the solution. Crank-Nicolson is a implicit method, meaning it uses the average of the two time steps to calculate the solution at the next time step. On the other hand, Heun's method is an explicit method that uses the slope at the beginning of the time step to approximate the solution at the end of the time step.

2. Which method is more accurate - Crank-Nicolson or Heun's method?

Both methods have their own advantages and disadvantages when it comes to accuracy. Crank-Nicolson is known to be more accurate for stiff equations (where the solution changes rapidly) as it takes into account the average of two time steps. However, for non-stiff equations, Heun's method may be more accurate as it uses the slope at the beginning of the time step. Ultimately, the accuracy of either method will depend on the specific problem being solved.

3. Are there any limitations to using Crank-Nicolson or Heun's method?

Both methods have their own limitations. Crank-Nicolson may be computationally expensive as it requires solving a system of equations at each time step. Heun's method, on the other hand, may not be suitable for stiff equations as it can lead to instability and inaccurate results. Additionally, both methods may have issues with numerical precision and may require smaller time steps to ensure accuracy.

4. Which method should I use for my specific problem?

The choice between Crank-Nicolson and Heun's method will depend on the specific problem you are trying to solve. If your problem is stiff, Crank-Nicolson may be a better choice. However, for non-stiff equations, Heun's method may be more suitable. It is always recommended to try both methods and compare the results to determine which one is more accurate and efficient for your specific problem.

5. Can Crank-Nicolson or Heun's method be used for any type of differential equation?

Crank-Nicolson and Heun's method can be used for a wide range of ordinary differential equations. However, their effectiveness may vary depending on the specific characteristics of the equation, such as stiffness. It is important to carefully consider the properties of the equation before deciding which method to use. Additionally, for some equations, neither method may be suitable and alternative numerical methods may need to be used.

Similar threads

  • Differential Equations
Replies
8
Views
3K
  • Differential Equations
Replies
2
Views
1K
  • Differential Equations
Replies
1
Views
1K
  • Differential Equations
Replies
7
Views
3K
Replies
2
Views
1K
  • Differential Equations
Replies
12
Views
8K
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Replies
1
Views
1K
  • Differential Equations
Replies
1
Views
7K
Back
Top