Presentation Euler Method

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 13

“Euler’s Method”

Presented By: Puspa Joshi


Department of Electrical and Electronics, KU

Submitted To: Dr. Saraswoti Aacharya


Department of Mathematics
Table of Contents

 Introduction
 Algorithm
 Matlab code for Eular’s method
 Results
 Conclusion
Introduction

 Euler’s Method: A numerical technique to approximate solutions for


ordinary differential equations (ODEs).
 It is based on the idea of dividing the interval into smaller steps and
approximating the derivative using a finite difference.
 It is a first-order approximation method that breaks down the
continuous problem into a series of discrete steps.
 This method is named after the renowned Swiss mathematician,
Leonhard Euler.
Algorithm

1. Define the initial conditions: initial value, time step, and number of
iterations.
2. Initialize the solution array with the initial value.
3. Loop through the desired number of iterations
4. Calculate the derivative at the current time.
5. Update the solution by multiplying the derivative with the time step
and adding it to the previous solution.
 Update the current time
6. Plot the results.
Matlab code for Eular’s method

% Euler's method
% Approximate the solution to the initial-value problem
% dy/dt=y-t^2+1 ; 0<=t<=2 ; y(0)=0.5;

f = @(t,y) (y-t^2+1);
a = input('Enter left end ponit, a: ');
b = input('Enter right end point, b: ');
n = input('Enter no. of subintervals, n: ');
alpha = input('Enter the initial condition, alpha: ');
h = (b-a)/n;
t = a;
w = alpha;
fprintf(' t w\n');
fprintf('%5.4f %11.8f\n', t, w);

for i = 1:n

w = w+h*f(t, w);
t = a+i*h;
fprintf('%5.4f %11.8f\n', t, w);
plot(t,w,'r*'); grid on;
xlabel('t values'); ylabel('w values');
hold on;
end
>;
OutPut:
euler_final
Enter left end ponit, a: 0
Enter right end point, b: 2
Enter no. of subintervals, n: 10
Enter the initial condition, alpha: 0.5
t w
0.0000 0.50000000
0.2000 0.80000000
0.4000 1.15200000
0.6000 1.55040000
0.8000 1.98848000
1.0000 2.45817600
1.2000 2.94981120
1.4000 3.45177344
1.6000 3.95012813
1.8000 4.42815375
2.0000 4.86578450
>>

;
Results
Results

 The plot shows the numerical approximation of the solution using


Euler’s Method for the given ODE.
 As the number of iterations increases, the approximation becomes
closer to the true solution
Advantages and Limitations

Advantages:
Simple and easy to implement.
 Efficient for simple ODEs

Limitation:

Euler’s Method has a first-order accuracy, which means it may introduce


significant errors for complex ODEs.
 It can be sensitive to the choice of the time step, requiring smaller steps for
better accuracy.
Conclusion

Euler’s Method provides a basic numerical approximation technique


for solving ordinary differential equations.
 It is a useful tool for gaining insights into the behavior of ODEs and
exploring initial value problems.
THANK YOU!!!

ANY QUERIES????

You might also like