430 likes | 555 Views
This work focuses on employing Euler's method for solving initial value problems (IVPs) in ordinary differential equations (ODEs). We analyze approximation techniques utilizing a step size of h=0.1 for various points, comparing numerical results with exact solutions. MATLAB code snippets are provided for implementation, demonstrating the iterative approach for different step sizes. Additionally, the analysis includes examining errors from approximations, offering insights for enhancing solution accuracy through methods like Taylor Series, Improved Euler, and Runge-Kutta.
E N D
MathematicalModeling Team B 김도현 서수빈 이혜경
Context Preliminary Problem Summary Further • Exact solution • MATLAB Code • Result
Preliminary. ODE solving method -seperable -integrate factor
Preliminary. Eulers Method ‘’
Euler s Method • ‘’
Problem 1. Use Euler s method with step size h = 0.1 to approximate the solution to the IVP ‘’ at the points x = 1.1, 1.2, 1.3, 1.4 and 1.5. Compare your numerical result with the exact solution.
Problem 1. Coding i=1; x(1,1)=1; y(1,1)=4; slope(1,1)=x(1,1).*(y(1,1).^(1/2)); whilei<=5 i=i+1; x(1,i)=x(1,i-1)+0.1; y(1,i)=slope(1,i-1).*0.1+y(1,i-1); slope(1,i)=x(1,i).*(y(1,i).^(1/2)); end z=((x.^2+7).^2)/16; plot(x,y,'r'); hold on plot(x,z,'b'); error=abs(y-z)
Problem 1. Result Exact solution Estimated solution
Problem 2. Use Euler s method to find approximates to the solution of the IVP ‘’ at x = 1, taking 1, 2, 4, 8, and 16 steps. Compare your numerical result with the exact solution.
Problem 2. Coding i=1; y(1,1)=1; n=input('How many steps ?'); x=0:1/n:1; whilei<=n y(1,i+1)=y(1,i)/n+y(1,i); i=i+1; end s=0:1/1000:1; z=exp(s); plot(x,y,'r'); hold on plot(s,z,'b'); hold off
Problem 2. Result n=1 Exact solution Estimated solution Error = 0.7183
Problem 2. Result n=2 Exact solution Estimated solution Error = 0.4684
Problem 2. Result n=4 Exact solution Estimated solution Error = 0.2769
Problem 2. Result n=8 Exact solution Estimated solution Error = 0.1525
Problem 2. Result n=16 Exact solution Estimated solution Error = 0.0804
Problem 2. Result n=1024 Exact solution Estimated solution Error = 0.0013
Problem 2. Result n=1 n=2 n=4 n=8 n=16
Problem 3. ‘’ Use Euler s method with step size h = 0.1 to approximate to the solution of the IVP with x0 = 0, and compute the first 10 iterations of this scheme, and compare the result with the exact solution.
Problem 3. Coding i=1; y(1,1)=1; x=0:0.1:1; whilei<=10 y(1,i+1)=(y(1,i)+sin(x(1,i))).*0.1+y(1,i); i=i+1; end s=0:1/1000:1; z=3*exp(s)/2-sin(s)/2-cos(s)/2; plot(x,y,'r'); hold on plot(s,z,'b'); error=abs(3*exp(x)/2-sin(x)/2-cos(x)/2-y)
Problem 3. Result Exact solution Estimated solution Error = 0.2371
Summary - error 1) Same mesh size, different x value 2) Same x value, different mesh size 3) error=0.2371 with mesh h=0.1 at x=1
Summary - compare whenΔx=1 1) mesh=0.1 (10 iteration) error=0.1983 2) mesh=0.125 (8 steps) error=0.1525 3) mesh h=0.1 error=0.2371
Further... Taylor Series Method Improved Euler s Method Runge-Kutta Method ‘’ Chebyshev Node Choosing