Professional Documents
Culture Documents
_________________________________________________________
College of Engineering
_________________________________________________________
Numerical Methods ES 84
EE
_________________________________________________________
First Semester
_________________________________________________________
Laboratory Report
Euler Method
_________________________________________________________
ES 84
2012-1410
Introduction
(ODEs) with a given initial value. It is the most basic explicit method for
70).
it to solve the given example of Newton's cooling law with it for three
TR
20 C, and the cooling constant k 0.07. The time interval to calculate
Mathematical Modeling
to
) = T 0 cools down in an environment of temperature T R :
dT (t )
=kT
dt
or
dT (t )
=k (T ( t )T R )
dt
dT (t )
It says that the cooling rate dt of the object is proportional to the
environment.
Analytical Solution
dT (t )
Giving the ordinary differential equation: =k (T ( t )T R )
dt
T ( t )=20+(10020)e0.07t
Substituting the initial condition form 0 to 100 to the t variable, results
a graph of temperature with respect to time (s). Showing the graph below is
Numerical Solution
y i+1= yi + f ( xi , y i ) h
Equation can be used to implement Eulers method
Therefore,
Source Code
package es84finals;
public class EULER {private static void euler (Callable f, double y0, int a, int
b, int h) {
int t = a;
double y = y0;
while (t < b) {
System.out.println ("" + t + " " + y);
t += h;
y += h * f.compute (t, y);
}
System.out.println ("DONE");
}
The Euler method is a first-order method, which means that the local
error (error per step) is proportional to the square of the step size, and the
global error (error at a given time) is proportional to the step size. The Euler
The Euler method is a first-order method, which means that the local
error (error per step) is proportional to the square of the step size, and the
global error (error at a given time) is proportional to the step size. The
bigger the size of the initial condition is the larger the error becomes. It is