Numerical Calculations Part 5 Solving differential equations Dr
- Slides: 9
Numerical Calculations Part 5: Solving differential equations Dr. Entesar Ganash
First order differential equation The general first order differential equation is Initial condition Is given Example:
Rung-Kutta fourth-order formulae There a variety of alogorithms, under the general name of Runge-Kutta. This can be used to integrate systems of ordinary differential equations First, Let us see this http: //www. youtube. com/watch? v=k. Ucc 8 v. Ago. Q 0 In the first order differential equation: The fourth- order Runge-Kutta estimate where at is given by
Second order differential equation The general second order differential equation is Initial conditions are given Example:
Rung-Kutta fourth-order formulae In the second order, we have where
Example Write a program to solve the following differential equation. when use n=30 Solving program RKM implicit none integer: : n, i ! No of parts, counter real : : y, dy, x, xn, h, exact real : : k 1, k 2, k 3, k 4 n=30 x=0. 0 y=0. 0 dy=1. 0 xn=1. 0 h=(xn-x)/n Exact=sin(x) print*, '---------------------------------' print*, ' x', ' y', ' dy', ' Exact' print*, '---------------------------------' print*, x, y, dy, Exact in
DO I=1, n k 1=h*f (x, y, dy) k 2=h*f(x+h/2, y+h*dy/2+h*k 1/8, dy+k 1/2) k 3=h*f(x+h/2, y+h*dy/2+h*k 1/8, dy+k 2/2) k 4=h*f(x+h, y+h*dy+h*k 3/2, dy+k 3) x=x+h Exact=sin(x) y=y+h*(dy+(k 1+k 2+k 3)/6) dy=dy+(k 1+2. 0*k 2+2. 0*k 3+k 4)/6 print*, x, y, dy, exact End do print*, '---------------------------------' CONTAINS REAL Function f(p, q, u) Real : : f, p, q, u f=-q End function f End program RKM continue Solving
The result:
References • Hahn, B. D. , 1994, Fortran 90 For Scientists and Engineers, Elsevier http: //www. stewartcalculus. com/data/CALCULUS%20 Concepts%20 and%20 Co ntexts/upfiles/3 c 3 -Apps. Of 2 nd. Orders_Stu. pdf
- Numerical methods for partial differential equations eth
- Cauchy equation
- Solving 1st order differential equations
- First order ode
- Pde first order
- Numerical calculations
- Structural steel connection calculations calculations
- Eigen value problem
- Chemical formula kwl chart
- Calculations using balanced equations are called