How can the Improved Euler Method be used in programming assignments?

Click For Summary

Homework Help Overview

The discussion revolves around the application of the Improved Euler Method, also known as Heun's method, in the context of a programming assignment. Participants are examining the nuances of the method as described in course notes, which some find confusing, particularly regarding the treatment of derivatives in initial value problems.

Discussion Character

  • Conceptual clarification, Assumption checking, Problem interpretation

Approaches and Questions Raised

  • Participants are attempting to clarify the correct application of the Improved Euler Method, questioning the definitions and assumptions presented in the course notes. There is a focus on the distinction between numerical quadrature and solving initial value problems, as well as the implications of treating derivatives as functions of both independent and dependent variables.

Discussion Status

The discussion is ongoing, with participants providing insights and corrections regarding the application of the method. Some express understanding of the differences between various numerical methods, while others raise concerns about the clarity of the course materials. There is no explicit consensus, but multiple interpretations and clarifications are being explored.

Contextual Notes

Participants note that the course notes may lack clarity regarding the dependency of the derivative function on time and the implications for applying the Improved Euler Method. There is also mention of specific examples from physical systems where the derivative functions are independent of time.

Jamin2112
Messages
973
Reaction score
12
The "improved" Euler method

Homework Statement



Using it on a programming assignment. The description in our course notes is a little confusing, so I need to know whether I'm doing it correctly.

Homework Equations



Go to p. 22 of this, if you're so inclined: http://faculty.washington.edu/joelzy/402_notes_bernard.pdf

The Attempt at a Solution



Basically, if I have the slopes y'(x0), y'(x1), ..., y'(xn), and of course an initial point y0, I'm getting the next point y(xk) by y(xk) = y(xk-1) + Δx (y'(xk-1)+y'(xk))/2. Right?
 
Last edited by a moderator:
Physics news on Phys.org


Right!

Actually, your notes are a bit misleading.
See for instance http://en.wikipedia.org/wiki/Euler_method

Your notes refer to f(yn) while they should actually refer to f(t,yn).
Since you use x instead of t, and y' instead of f, this becomes y'(x,yn).
Or y'(xk,yk) as you have it.
 


Jamin2112 said:
Basically, if I have the slopes y'(x0), y'(x1), ..., y'(xn), and of course an initial point y0, I'm getting the next point y(xk) by y(xk) = y(xk-1) + Δx (y'(xk-1)+y'(xk))/2. Right?
Wrong.

There's a huge difference between numerical quadrature and and numerically solving an initial value. The former addresses solving \int_a^b f(x) dx. The latter addresses solving dy/dx = f(x,y), y(x_0) = y_0. You can't say "y'(xn)" in an initial value problem because the derivative is a function of both x and y.

Note that numerical quadrature can be viewed as a special case of an initial value problem. However, that the derivative of y is a function of x only in numerical quadrature (rather than a function of x and y in an initial value problem) means that numerical quadrature is intrinsically much simpler than an initial value problem.

Euler's method is a simple approach to numerically solving an initial value problem. When the derivative is a function of x only, Euler's method is equivalent to the rectangle rule for numerical quadrature. Another name for your "improved Euler's method" is Heun's method. This simplifies to the trapezoid rule (which what you wrote) for numerical quadrature when the derivative is a function of x only.

Life would be easy if all initial value problems had the derivative as a function of the independent variable only. That simply isn't the case. Oftentimes it's the other way arouund, with the derivative being a function of the dependent variables only.
 


D H said:
Wrong.

There's a huge difference between numerical quadrature and and numerically solving an initial value. The former addresses solving \int_a^b f(x) dx. The latter addresses solving dy/dx = f(x,y), y(x_0) = y_0. You can't say "y'(xn)" in an initial value problem because the derivative is a function of both x and y.

Note that numerical quadrature can be viewed as a special case of an initial value problem. However, that the derivative of y is a function of x only in numerical quadrature (rather than a function of x and y in an initial value problem) means that numerical quadrature is intrinsically much simpler than an initial value problem.

Euler's method is a simple approach to numerically solving an initial value problem. When the derivative is a function of x only, Euler's method is equivalent to the rectangle rule for numerical quadrature. Another name for your "improved Euler's method" is Heun's method. This simplifies to the trapezoid rule (which what you wrote) for numerical quadrature when the derivative is a function of x only.

Life would be easy if all initial value problems had the derivative as a function of the independent variable only. That simply isn't the case. Oftentimes it's the other way arouund, with the derivative being a function of the dependent variables only.

Ok, I think I understand.
 


D H said:
Wrong.

You do like to contradict me don't you?

Well, suppose we have the initial value problem:
y' = 2x
y0 = 1

It seems perfectly normal to me to apply Euler's method on it, or the improved Euler's method.

In particular y'(x) can also be written as a function of x and y, that is, as y'(x,y).
It's not wrong, it's just a special case.
 


I like Serena said:
You do like to contradict me don't you?
No. :-p

Well, suppose we have the initial value problem:
y' = 2x
y0 = 1

It seems perfectly normal to me to apply Euler's method on it, or the improved Euler's method.

In particular y'(x) can also be written as a function of x and y, that is, as y'(x,y).
It's not wrong, it's just a special case.
Yes, it's a special case, but look at what's happening. Suppose you want to integrate from x0 to x1 in N steps. With the trapezoidal rule, you need N+1 derivatives. Compare with Heun's method ("improved Euler"), where the derivative function is called two times every step. You are calling the derivative function N-1 times more often than you need to. There's no need to compute the derivative for both (x,y1) and (x,y2) if the derivative is a function of x only.Back to your previous post,
I like Serena said:
Actually, your notes are a bit misleading.
Your notes refer to f(yn) while they should actually refer to f(t,yn).
The start of chapter 3 (the topic at hand) made it pretty clear that the notes were specific to systems where the derivative function is independent of time:
In this chapter we study dynamical systems consisting of one differential equation with a continuous time variable that are autonomous:
\frac{dy}{dt} = y′ = f(y)
where y is a function of the independent variable t. The equation is called autonomous because the right-hand side does not depend on t explicitly: the only t dependence is through y = y(t).​
This happens in physical systems quite often. Just a couple of examples: an N-body gravitational system where the bodies are point masses, and a spring/mass/damper system. In the gravitational system, accelerations are functions of position only (or position and velocity if you want a general relativistic solution). In the spring mass damper system, acceleration is a function of position and velocity. There is no direct dependence on time in either problem.
 


D H said:
The start of chapter 3 (the topic at hand) made it pretty clear that the notes were specific to systems where the derivative function is independent of time:
In this chapter we study dynamical systems consisting of one differential equation with a continuous time variable that are autonomous:
\frac{dy}{dt} = y′ = f(y)
where y is a function of the independent variable t. The equation is called autonomous because the right-hand side does not depend on t explicitly: the only t dependence is through y = y(t).​

Ah well, I guess you are right about the context. :wink:
I skipped over that.

For the record, I do object about the book quoting Euler's method, without actually giving Euler's method (or Heun's method or Runge-Kutta's method) or making note that they leave out the t-dependency.
It's a bad quote.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
4
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 10 ·
Replies
10
Views
7K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
1
Views
4K
Replies
3
Views
2K