This document discusses using MATLAB to solve ordinary differential equations (ODEs) numerically. It introduces the Euler method as the oldest and simplest numerical method for approximating solutions to differential equations. The details of implementing the forward, modified, and backward Euler methods in MATLAB are provided, including creating function files and a script to solve an example initial value problem. The numerical solutions generated by the different Euler methods are compared to the exact solution to evaluate the accuracy.
Accuracy Study On Numerical Solutions Of Initial Value Problems (IVP) In Ordi...Sheila Sinclair
This document summarizes a study on the accuracy of numerical solutions to initial value problems in ordinary differential equations using the Euler method. The authors apply the Euler method without discretization or assumptions to solve initial value problems. They consider examples of different types of ordinary differential equations and compare the approximate solutions to exact solutions. The results show that the approximate solutions converge monotonically to the exact solutions as the step size decreases, improving accuracy. The authors analyze errors for different step sizes and find that the Euler method is efficient but requires a small step size to achieve accuracy.
This document summarizes numerical methods for solving ordinary differential equations (ODEs), including Runge-Kutta methods like Euler's method, Heun's method, and the midpoint method. It also discusses solving systems of ODEs using Euler's method by applying it separately to each equation at each time step. The document provides examples applying these methods to solve sample ODEs and systems of ODEs.
This document describes a term project involving model reduction through implicit solvers and singular value decomposition. Specifically, it aims to reduce a large system of differential equations to a smaller system that provides similar information. The document covers implicit solvers like the trapezoidal rule applied to example systems of ODEs. It shows that implicit methods like the trapezoidal rule converge for larger step sizes compared to explicit methods like Euler's method.
This summary provides an overview of numerical methods for solving initial value problems (IVPs) for ordinary differential equations:
1. Several common numerical methods for solving IVPs are presented, including explicit and implicit Euler methods, the trapezoidal (midpoint) rule, improved Euler (Runge-Kutta 2), and Runge-Kutta 4.
2. The concepts of consistency and convergence are introduced. A method is consistent if the local error decays to zero as the step size decreases, and convergent if the global error decreases with decreasing step size. Order refers to the rate of decay of local error.
3. Stability is also important, especially for moderate step sizes. Linear stability is introduced
This paper describes the evaluation on numerical confusion over ternary regular
finite equations about methods. Are rarely used, while the simple Euler’s technique is
popular amongst researchers. We compare four explicit methods: Euler’s, Heun's
methods, and polygon, including the honor analytical, is the accurate answer and
value about external records regarding the simulation. The carelessness within
analytical then numerical are moderate by way of the comparison along half
previously worked. Euler technique has never been good including accordant models,
polygon it turns outdoors in conformity with be the good scheme for much practical
situations. The Heun's constantly prevails polygon method though both are over
advance rule and has the identical scale of h= 0.25.
This document discusses numerical methods for solving partial differential equations (PDEs). It begins by classifying PDEs as parabolic, elliptic, or hyperbolic based on their coefficients. It then introduces finite difference methods, which approximate PDE solutions on a grid by replacing derivatives with finite differences. In particular, it describes the forward time centered space (FTCS) scheme for solving the 1D heat equation numerically and analyzing its stability using von Neumann analysis.
This document provides an overview of numerical methods for solving ordinary differential equations. It outlines several numerical methods including Taylor's series method, Picard's method of successive approximation, Euler's method, modified Euler's method, Runge-Kutta methods, and predictor-corrector methods like Milne's method and Adams-Moulton method. Examples of the formulas used in each method are given. The document also lists references and provides context about the course and unit.
A Fast Numerical Method For Solving Calculus Of Variation ProblemsSara Alvarez
This document presents a numerical method called differential transform method (DTM) for solving calculus of variation problems. DTM finds the solution of variational problems in the form of a polynomial series without discretization. The method is applied to obtain the solution of the Euler-Lagrange equation arising from variational problems by considering it as an initial value problem. Some examples are presented to demonstrate the efficiency and accuracy of DTM for solving calculus of variation problems.
Accuracy Study On Numerical Solutions Of Initial Value Problems (IVP) In Ordi...Sheila Sinclair
This document summarizes a study on the accuracy of numerical solutions to initial value problems in ordinary differential equations using the Euler method. The authors apply the Euler method without discretization or assumptions to solve initial value problems. They consider examples of different types of ordinary differential equations and compare the approximate solutions to exact solutions. The results show that the approximate solutions converge monotonically to the exact solutions as the step size decreases, improving accuracy. The authors analyze errors for different step sizes and find that the Euler method is efficient but requires a small step size to achieve accuracy.
This document summarizes numerical methods for solving ordinary differential equations (ODEs), including Runge-Kutta methods like Euler's method, Heun's method, and the midpoint method. It also discusses solving systems of ODEs using Euler's method by applying it separately to each equation at each time step. The document provides examples applying these methods to solve sample ODEs and systems of ODEs.
This document describes a term project involving model reduction through implicit solvers and singular value decomposition. Specifically, it aims to reduce a large system of differential equations to a smaller system that provides similar information. The document covers implicit solvers like the trapezoidal rule applied to example systems of ODEs. It shows that implicit methods like the trapezoidal rule converge for larger step sizes compared to explicit methods like Euler's method.
This summary provides an overview of numerical methods for solving initial value problems (IVPs) for ordinary differential equations:
1. Several common numerical methods for solving IVPs are presented, including explicit and implicit Euler methods, the trapezoidal (midpoint) rule, improved Euler (Runge-Kutta 2), and Runge-Kutta 4.
2. The concepts of consistency and convergence are introduced. A method is consistent if the local error decays to zero as the step size decreases, and convergent if the global error decreases with decreasing step size. Order refers to the rate of decay of local error.
3. Stability is also important, especially for moderate step sizes. Linear stability is introduced
This paper describes the evaluation on numerical confusion over ternary regular
finite equations about methods. Are rarely used, while the simple Euler’s technique is
popular amongst researchers. We compare four explicit methods: Euler’s, Heun's
methods, and polygon, including the honor analytical, is the accurate answer and
value about external records regarding the simulation. The carelessness within
analytical then numerical are moderate by way of the comparison along half
previously worked. Euler technique has never been good including accordant models,
polygon it turns outdoors in conformity with be the good scheme for much practical
situations. The Heun's constantly prevails polygon method though both are over
advance rule and has the identical scale of h= 0.25.
This document discusses numerical methods for solving partial differential equations (PDEs). It begins by classifying PDEs as parabolic, elliptic, or hyperbolic based on their coefficients. It then introduces finite difference methods, which approximate PDE solutions on a grid by replacing derivatives with finite differences. In particular, it describes the forward time centered space (FTCS) scheme for solving the 1D heat equation numerically and analyzing its stability using von Neumann analysis.
This document provides an overview of numerical methods for solving ordinary differential equations. It outlines several numerical methods including Taylor's series method, Picard's method of successive approximation, Euler's method, modified Euler's method, Runge-Kutta methods, and predictor-corrector methods like Milne's method and Adams-Moulton method. Examples of the formulas used in each method are given. The document also lists references and provides context about the course and unit.
A Fast Numerical Method For Solving Calculus Of Variation ProblemsSara Alvarez
This document presents a numerical method called differential transform method (DTM) for solving calculus of variation problems. DTM finds the solution of variational problems in the form of a polynomial series without discretization. The method is applied to obtain the solution of the Euler-Lagrange equation arising from variational problems by considering it as an initial value problem. Some examples are presented to demonstrate the efficiency and accuracy of DTM for solving calculus of variation problems.
The document discusses several numerical methods for solving initial value problems for ordinary differential equations (ODEs), including:
- Euler's method, which approximates the solution by dividing the interval into small steps based on a Taylor series expansion.
- The fourth-order Runge-Kutta method, which iteratively computes intermediate values to approximate the solution at discrete points.
- The Runge-Kutta-Fehlberg method, which is an adaptive method that allows for error control by adjusting the step size based on error estimates.
- The Adams Fourth-Order Predictor-Corrector method, which combines Adams-Bashforth and Adams-Moulton methods for higher accuracy and stability.
This document discusses numerical methods for solving ordinary differential equations (ODEs), including:
1) Initial-value problems where conditions are specified at a single value of the independent variable, unlike boundary-value problems.
2) Euler's method and higher-order Runge-Kutta methods for approximating solutions to ODEs using finite differences. Examples are provided to illustrate the methods.
3) Extensions of these methods to systems of ODEs, along with examples of applying the methods to coupled differential equations.
This document provides an introduction and overview of ordinary differential equations (ODEs) for engineers. It defines key concepts such as ODEs, solutions, order of an ODE, linear and homogeneous equations. It also discusses systems of ODEs and approaches for finding solutions, including analytical and numerical methods. The document serves as notes for an engineering course on ODEs, covering topics like first order, nth order, and systems of linear and nonlinear differential equations.
Comparative Analysis of Different Numerical Methods of Solving First Order Di...ijtsrd
A mathematical equation which relates various function with its derivatives is known as a differential equation.. It is a well known and popular field of mathematics because of its vast application area to the real world problems such as mechanical vibrations, theory of heat transfer, electric circuits etc. In this paper, we compare some methods of solving differential equations in numerical analysis with classical method and see the accuracy level of the same. Which will helpful to the readers to understand the importance and usefulness of these methods. Chandrajeet Singh Yadav"Comparative Analysis of Different Numerical Methods of Solving First Order Differential Equation" Published in International Journal of Trend in Scientific Research and Development (ijtsrd), ISSN: 2456-6470, Volume-2 | Issue-4 , June 2018, URL: http://www.ijtsrd.com/papers/ijtsrd13045.pdf http://www.ijtsrd.com/mathemetics/applied-mathematics/13045/comparative-analysis-of-different-numerical-methods-of-solving-first-order-differential-equation/chandrajeet-singh-yadav
This document discusses analytical solutions of linear ordinary differential equation initial value problems (ODE-IVPs). It begins by introducing scalar and vector cases of linear ODE-IVPs. For the scalar case, it shows that the solution has the form of et. For the vector case, it shows that the solution has the form of eλtv, where λ are the eigenvalues of the coefficient matrix A and v are the corresponding eigenvectors. It then discusses how to determine the eigenvalues and eigenvectors by solving the characteristic equation of A. Finally, it expresses the general solution as a linear combination of the fundamental solutions eλtv, which must also satisfy the initial conditions.
This document discusses Runge-Kutta methods for solving differential equations numerically. It begins with an overview of Euler's method and its errors, then introduces higher-order Runge-Kutta methods. The document derives a second-order Runge-Kutta method called the improved Euler's method and provides exercises to find other second-order methods and use the improved Euler's method to approximate a solution.
This document summarizes and compares several numerical methods for solving ordinary differential equations (ODEs):
- Euler's method approximates the tangent line at each step to find successive y-values. While simple, it has local truncation errors that accumulate.
- Improved Euler's method takes the average slope between the current and next steps to give a more accurate approximation.
- Runge-Kutta methods such as the fourth-order method provide much greater accuracy than Euler or improved Euler by using multiple slope estimates within each step.
An example applies each method to the ODE dy/dx = x + y to compare their results in solving for successive y-values out to x = 0.3.
1. The document describes implementing Euler's method for solving ordinary differential equations in MATLAB.
2. It provides the theory behind Euler's method, which uses the first two terms of the Taylor series expansion to approximate solutions with an error term of O(h).
3. The MATLAB script file implements Euler's method to solve the initial value problem y' = y - x, y(0) = 1/2, comparing the numerical solution to the exact solution.
This document discusses using the homotopy perturbation method to solve integral equations. It begins by introducing the homotopy perturbation method and how it can be used to find approximate solutions to problems by considering the solution as a sum of an infinite series. It then shows how to apply the method to solve Fredholm and Volterra integral equations of the second kind by constructing a homotopy and obtaining iteration formulas. The document concludes that the homotopy perturbation method provides sufficient conditions for the convergence of solutions to integral equations and integro-differential equations.
This document discusses using the homotopy perturbation method to solve integral equations. It begins by introducing the homotopy perturbation method and how it can be used to find approximate solutions to problems by considering the solution as a sum of an infinite series. It then shows how to apply the method to solve Fredholm and Volterra integral equations of the second kind by constructing a homotopy and obtaining iteration formulas. The document concludes that the homotopy perturbation method provides sufficient conditions for the convergence of solutions to integral equations and integro-differential equations.
The document introduces Euler's method for numerically solving ordinary differential equations. It provides the formulation of Euler's method as a recurrence relation and gives examples of applying the method to solve various initial value problems by discretizing the interval and time steps. Euler's method approximates the slope of the tangent line at each step to iteratively calculate subsequent y-values.
The document introduces Euler's method for numerically solving ordinary differential equations. It provides the formulation of Euler's method as a recurrence relation and gives examples of applying the method to solve various initial value problems by discretizing the interval and time steps. Euler's method approximates the slope of the tangent line at each step to iteratively calculate subsequent y-values.
Euler's method is a numerical method to solve first order first degree differential equation with a given initial value. It is the most basic explicit method for numerical integration of ordinary differential equations and is the simplest Runge–Kutta method.
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 method often serves as the basis to construct more complex methods, e.g., predictor–corrector method
This document provides an overview of solving partial differential equations using the homotopy perturbation method and separation of variables. Key points:
- The document introduces the Laplace, wave, and heat equations and outlines methods to solve them, including homotopy perturbation and separation of variables.
- Homotopy perturbation method involves constructing a homotopy equation with an embedding parameter and expanding the solution as a power series in this parameter.
- Separation of variables involves assuming the solution can be written as a product of functions involving only one variable, leading to ordinary differential equations that can be solved.
- Examples are provided of applying these methods to solve the Laplace equation and estimating the error compared to other methods.
This document discusses Euler's method for numerically approximating solutions to first-order initial value problems. It begins by introducing Euler's method and its use of tangent lines to approximate the solution curve. Examples are provided to illustrate the application of the method and analyze errors compared to exact solutions. The discussion notes that Euler's method relies on a sequence of tangent lines to different solution curves, so accuracy depends on whether the family of solutions is converging or diverging. It emphasizes the importance of error bounds when exact solutions are unknown.
Numerical Solutions of Burgers' Equation Project ReportShikhar Agarwal
This report summarizes the use of finite element methods to numerically solve Burgers' equation. It introduces finite element methods and the Galerkin method for approximating solutions. MATLAB codes are presented to solve example boundary value problems and differential equations. The method of quasi-linearization is also described for solving Burgers' equation numerically. The report concludes that finite element methods can accurately predict numerical solutions that are close to exact solutions for problems where no closed-form solution exists.
IJRET : International Journal of Research in Engineering and Technology is an international peer reviewed, online journal published by eSAT Publishing House for the enhancement of research in various disciplines of Engineering and Technology. The aim and scope of the journal is to provide an academic medium and an important reference for the advancement and dissemination of research results that support high-level learning, teaching and research in the fields of Engineering and Technology. We bring together Scientists, Academician, Field Engineers, Scholars and Students of related fields of Engineering and Technology
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docxRAHUL126667
CALIFORNIA STATE UNIVERSITY, NORTHRIDGE
MECHANICAL ENGINEERING DEPARTMENT
MARCH 30 2015
ME 309
HOMEWORK #3
Ahmed Mohammed
Problem statement
1. Write a general computer code to solve system of up to five couples first order initial value problems using Heun and Newton iteration trapezoidal methods. These are combined in the same algor4thim in such way that Heun’s method is automatically employed to provide the initial guess at each time step for the Newton iteration required by fully implicit Heun’s method, and no iterations are needed. The complete pseudo-language algorithm is attached.
Test this code by solving the following problem.
Use step size h= 0.1, 0.05 and 0.025. Solve the problem first with explicit Hun’s method, and then with implicit Newton iteration integration for each value of h. employ a convergence tolerance E= 0.000001 for the Newton iteration of the trapezoidal method. The exact solution to this problem is,
Make a table of results of convergence tests (based on the exact solution) at t=1, 2, 3, 4 & 6. This table should include the exact value, the computed solution, the error and the error ratios from successive step size for each of the required values of t. discuss how these results compare with theory. Also discuss what factors should influence the choice of convergence tolerance E for the Newton iterations, and whether the specified value given above is appropriate.
2. Solve the following problem using only the newton iteration trapezoidal method.
Employ step size h=0.1, 0.05, 0.01 and iteration convergence tolerance E= 0.000001. Consider the h=0.01 solution to be the “exact” in order to carry out convergence testes between the h= 0.1 and h=0.05 solutions at t=0.5, 1, 1.5, 2. Make a table, similar to the table in problem number 1.
Mathematical Description
HEUN’S METHOD
Heun’s Method, explained in a short manner, uses the line tangent to the function at the beginning of an interval. Now if a small step is applied to it, the error with the function result will be small. Heun’s method can be explained in more detailed in the following way:
2.-
To obtain solution point (t1,y1) we can use the fundamental theorem of calculus and integrate y’(t) over [t0,t1] to get
3.- Solving for y(t1) we find,
4.- We can use a numerical integration to approximate definite integral. If we use trapezoidal rule with step size h = t1 – t0, then we get
5.- We still need to find, y(t1) but an estimation for this value will work. After this we get the following, which is the Heun’s method.
6.- When this process is repeated it generates a sequence of points that approximate the solution curve y =y(t). At each step, Euler’s method is used as a prediction then the trapezoidal rule helps to make the correction to obtain the final value. [1]
Newton’s Method
It is way to approximate the roots of an equation by taking out the curve in the equation and then replace with a tangent line. Then, it find ...
The document applies the variational iteration method (VIM) to solve linear and nonlinear ordinary differential equations (ODEs) with variable coefficients. It emphasizes the power of the method by using it to solve a variety of ODE models of different orders and coefficients. The document also uses VIM to solve four scientific models - the hybrid selection model, Thomas-Fermi equation, Kidder equation for unsteady gas flow through porous media, and the Riccati equation. The VIM provides efficient iterative approximations for both analytic solutions and numeric simulations of real-world applications in science and engineering.
On the Numerical Fixed Point Iterative Methods of Solution for the Boundary V...BRNSS Publication Hub
In this research work, we have studied the finite difference method and used it to solve elliptic partial differential equation (PDE). The effect of the mesh size on typical elliptic PDE has been investigated. The effect of tolerance on the numerical methods used, speed of convergence, and number of iterations was also examined. Three different elliptic PDE’s; the Laplace’s equation, Poisons equation with the linear inhomogeneous term, and Poisons equations with non-linear inhomogeneous term were used in the study. Computer program was written and implemented in MATLAB to carry out lengthy calculations. It was found that the application of the finite difference methods to an elliptic PDE transforms the PDE to a system of algebraic equations whose coefficient matrix has a block tri-diagonal form. The analysis carried out shows that the accuracy of solutions increases as the mesh is decreased and that the solutions are affected by round off errors. The accuracy of solutions increases as the number of the iterations increases, also the more efficient iterative method to use is the SOR method due to its high degree of accuracy and speed of convergence
My Summer Narrative Writing For The Beginning OJustin Knight
This document provides instructions for requesting and completing an assignment writing request on the HelpWriting.net website. It outlines a 5-step process: 1) Create an account with an email and password. 2) Complete a 10-minute order form with instructions, sources, and deadline. 3) Review bids from writers and choose one based on qualifications. 4) Review the completed paper and authorize payment. 5) Request revisions until satisfied with the work. The document emphasizes that original, high-quality content will be provided and work can be revised until the customer is fully satisfied.
Writing Paper With Drawing Space. Online assignment writing service.Justin Knight
The document provides instructions for creating an account and submitting a request on the website HelpWriting.net in order to have a paper written. It outlines a 5 step process which includes registering, completing an order form with instructions and deadline, reviewing bids from writers and selecting one, reviewing the completed paper, and having the option to request revisions if needed. The website promises original, high-quality content and refunds if plagiarism is found.
Mais conteúdo relacionado
Semelhante a Applications Of MATLAB Ordinary Differential Equations (ODE
The document discusses several numerical methods for solving initial value problems for ordinary differential equations (ODEs), including:
- Euler's method, which approximates the solution by dividing the interval into small steps based on a Taylor series expansion.
- The fourth-order Runge-Kutta method, which iteratively computes intermediate values to approximate the solution at discrete points.
- The Runge-Kutta-Fehlberg method, which is an adaptive method that allows for error control by adjusting the step size based on error estimates.
- The Adams Fourth-Order Predictor-Corrector method, which combines Adams-Bashforth and Adams-Moulton methods for higher accuracy and stability.
This document discusses numerical methods for solving ordinary differential equations (ODEs), including:
1) Initial-value problems where conditions are specified at a single value of the independent variable, unlike boundary-value problems.
2) Euler's method and higher-order Runge-Kutta methods for approximating solutions to ODEs using finite differences. Examples are provided to illustrate the methods.
3) Extensions of these methods to systems of ODEs, along with examples of applying the methods to coupled differential equations.
This document provides an introduction and overview of ordinary differential equations (ODEs) for engineers. It defines key concepts such as ODEs, solutions, order of an ODE, linear and homogeneous equations. It also discusses systems of ODEs and approaches for finding solutions, including analytical and numerical methods. The document serves as notes for an engineering course on ODEs, covering topics like first order, nth order, and systems of linear and nonlinear differential equations.
Comparative Analysis of Different Numerical Methods of Solving First Order Di...ijtsrd
A mathematical equation which relates various function with its derivatives is known as a differential equation.. It is a well known and popular field of mathematics because of its vast application area to the real world problems such as mechanical vibrations, theory of heat transfer, electric circuits etc. In this paper, we compare some methods of solving differential equations in numerical analysis with classical method and see the accuracy level of the same. Which will helpful to the readers to understand the importance and usefulness of these methods. Chandrajeet Singh Yadav"Comparative Analysis of Different Numerical Methods of Solving First Order Differential Equation" Published in International Journal of Trend in Scientific Research and Development (ijtsrd), ISSN: 2456-6470, Volume-2 | Issue-4 , June 2018, URL: http://www.ijtsrd.com/papers/ijtsrd13045.pdf http://www.ijtsrd.com/mathemetics/applied-mathematics/13045/comparative-analysis-of-different-numerical-methods-of-solving-first-order-differential-equation/chandrajeet-singh-yadav
This document discusses analytical solutions of linear ordinary differential equation initial value problems (ODE-IVPs). It begins by introducing scalar and vector cases of linear ODE-IVPs. For the scalar case, it shows that the solution has the form of et. For the vector case, it shows that the solution has the form of eλtv, where λ are the eigenvalues of the coefficient matrix A and v are the corresponding eigenvectors. It then discusses how to determine the eigenvalues and eigenvectors by solving the characteristic equation of A. Finally, it expresses the general solution as a linear combination of the fundamental solutions eλtv, which must also satisfy the initial conditions.
This document discusses Runge-Kutta methods for solving differential equations numerically. It begins with an overview of Euler's method and its errors, then introduces higher-order Runge-Kutta methods. The document derives a second-order Runge-Kutta method called the improved Euler's method and provides exercises to find other second-order methods and use the improved Euler's method to approximate a solution.
This document summarizes and compares several numerical methods for solving ordinary differential equations (ODEs):
- Euler's method approximates the tangent line at each step to find successive y-values. While simple, it has local truncation errors that accumulate.
- Improved Euler's method takes the average slope between the current and next steps to give a more accurate approximation.
- Runge-Kutta methods such as the fourth-order method provide much greater accuracy than Euler or improved Euler by using multiple slope estimates within each step.
An example applies each method to the ODE dy/dx = x + y to compare their results in solving for successive y-values out to x = 0.3.
1. The document describes implementing Euler's method for solving ordinary differential equations in MATLAB.
2. It provides the theory behind Euler's method, which uses the first two terms of the Taylor series expansion to approximate solutions with an error term of O(h).
3. The MATLAB script file implements Euler's method to solve the initial value problem y' = y - x, y(0) = 1/2, comparing the numerical solution to the exact solution.
This document discusses using the homotopy perturbation method to solve integral equations. It begins by introducing the homotopy perturbation method and how it can be used to find approximate solutions to problems by considering the solution as a sum of an infinite series. It then shows how to apply the method to solve Fredholm and Volterra integral equations of the second kind by constructing a homotopy and obtaining iteration formulas. The document concludes that the homotopy perturbation method provides sufficient conditions for the convergence of solutions to integral equations and integro-differential equations.
This document discusses using the homotopy perturbation method to solve integral equations. It begins by introducing the homotopy perturbation method and how it can be used to find approximate solutions to problems by considering the solution as a sum of an infinite series. It then shows how to apply the method to solve Fredholm and Volterra integral equations of the second kind by constructing a homotopy and obtaining iteration formulas. The document concludes that the homotopy perturbation method provides sufficient conditions for the convergence of solutions to integral equations and integro-differential equations.
The document introduces Euler's method for numerically solving ordinary differential equations. It provides the formulation of Euler's method as a recurrence relation and gives examples of applying the method to solve various initial value problems by discretizing the interval and time steps. Euler's method approximates the slope of the tangent line at each step to iteratively calculate subsequent y-values.
The document introduces Euler's method for numerically solving ordinary differential equations. It provides the formulation of Euler's method as a recurrence relation and gives examples of applying the method to solve various initial value problems by discretizing the interval and time steps. Euler's method approximates the slope of the tangent line at each step to iteratively calculate subsequent y-values.
Euler's method is a numerical method to solve first order first degree differential equation with a given initial value. It is the most basic explicit method for numerical integration of ordinary differential equations and is the simplest Runge–Kutta method.
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 method often serves as the basis to construct more complex methods, e.g., predictor–corrector method
This document provides an overview of solving partial differential equations using the homotopy perturbation method and separation of variables. Key points:
- The document introduces the Laplace, wave, and heat equations and outlines methods to solve them, including homotopy perturbation and separation of variables.
- Homotopy perturbation method involves constructing a homotopy equation with an embedding parameter and expanding the solution as a power series in this parameter.
- Separation of variables involves assuming the solution can be written as a product of functions involving only one variable, leading to ordinary differential equations that can be solved.
- Examples are provided of applying these methods to solve the Laplace equation and estimating the error compared to other methods.
This document discusses Euler's method for numerically approximating solutions to first-order initial value problems. It begins by introducing Euler's method and its use of tangent lines to approximate the solution curve. Examples are provided to illustrate the application of the method and analyze errors compared to exact solutions. The discussion notes that Euler's method relies on a sequence of tangent lines to different solution curves, so accuracy depends on whether the family of solutions is converging or diverging. It emphasizes the importance of error bounds when exact solutions are unknown.
Numerical Solutions of Burgers' Equation Project ReportShikhar Agarwal
This report summarizes the use of finite element methods to numerically solve Burgers' equation. It introduces finite element methods and the Galerkin method for approximating solutions. MATLAB codes are presented to solve example boundary value problems and differential equations. The method of quasi-linearization is also described for solving Burgers' equation numerically. The report concludes that finite element methods can accurately predict numerical solutions that are close to exact solutions for problems where no closed-form solution exists.
IJRET : International Journal of Research in Engineering and Technology is an international peer reviewed, online journal published by eSAT Publishing House for the enhancement of research in various disciplines of Engineering and Technology. The aim and scope of the journal is to provide an academic medium and an important reference for the advancement and dissemination of research results that support high-level learning, teaching and research in the fields of Engineering and Technology. We bring together Scientists, Academician, Field Engineers, Scholars and Students of related fields of Engineering and Technology
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docxRAHUL126667
CALIFORNIA STATE UNIVERSITY, NORTHRIDGE
MECHANICAL ENGINEERING DEPARTMENT
MARCH 30 2015
ME 309
HOMEWORK #3
Ahmed Mohammed
Problem statement
1. Write a general computer code to solve system of up to five couples first order initial value problems using Heun and Newton iteration trapezoidal methods. These are combined in the same algor4thim in such way that Heun’s method is automatically employed to provide the initial guess at each time step for the Newton iteration required by fully implicit Heun’s method, and no iterations are needed. The complete pseudo-language algorithm is attached.
Test this code by solving the following problem.
Use step size h= 0.1, 0.05 and 0.025. Solve the problem first with explicit Hun’s method, and then with implicit Newton iteration integration for each value of h. employ a convergence tolerance E= 0.000001 for the Newton iteration of the trapezoidal method. The exact solution to this problem is,
Make a table of results of convergence tests (based on the exact solution) at t=1, 2, 3, 4 & 6. This table should include the exact value, the computed solution, the error and the error ratios from successive step size for each of the required values of t. discuss how these results compare with theory. Also discuss what factors should influence the choice of convergence tolerance E for the Newton iterations, and whether the specified value given above is appropriate.
2. Solve the following problem using only the newton iteration trapezoidal method.
Employ step size h=0.1, 0.05, 0.01 and iteration convergence tolerance E= 0.000001. Consider the h=0.01 solution to be the “exact” in order to carry out convergence testes between the h= 0.1 and h=0.05 solutions at t=0.5, 1, 1.5, 2. Make a table, similar to the table in problem number 1.
Mathematical Description
HEUN’S METHOD
Heun’s Method, explained in a short manner, uses the line tangent to the function at the beginning of an interval. Now if a small step is applied to it, the error with the function result will be small. Heun’s method can be explained in more detailed in the following way:
2.-
To obtain solution point (t1,y1) we can use the fundamental theorem of calculus and integrate y’(t) over [t0,t1] to get
3.- Solving for y(t1) we find,
4.- We can use a numerical integration to approximate definite integral. If we use trapezoidal rule with step size h = t1 – t0, then we get
5.- We still need to find, y(t1) but an estimation for this value will work. After this we get the following, which is the Heun’s method.
6.- When this process is repeated it generates a sequence of points that approximate the solution curve y =y(t). At each step, Euler’s method is used as a prediction then the trapezoidal rule helps to make the correction to obtain the final value. [1]
Newton’s Method
It is way to approximate the roots of an equation by taking out the curve in the equation and then replace with a tangent line. Then, it find ...
The document applies the variational iteration method (VIM) to solve linear and nonlinear ordinary differential equations (ODEs) with variable coefficients. It emphasizes the power of the method by using it to solve a variety of ODE models of different orders and coefficients. The document also uses VIM to solve four scientific models - the hybrid selection model, Thomas-Fermi equation, Kidder equation for unsteady gas flow through porous media, and the Riccati equation. The VIM provides efficient iterative approximations for both analytic solutions and numeric simulations of real-world applications in science and engineering.
On the Numerical Fixed Point Iterative Methods of Solution for the Boundary V...BRNSS Publication Hub
In this research work, we have studied the finite difference method and used it to solve elliptic partial differential equation (PDE). The effect of the mesh size on typical elliptic PDE has been investigated. The effect of tolerance on the numerical methods used, speed of convergence, and number of iterations was also examined. Three different elliptic PDE’s; the Laplace’s equation, Poisons equation with the linear inhomogeneous term, and Poisons equations with non-linear inhomogeneous term were used in the study. Computer program was written and implemented in MATLAB to carry out lengthy calculations. It was found that the application of the finite difference methods to an elliptic PDE transforms the PDE to a system of algebraic equations whose coefficient matrix has a block tri-diagonal form. The analysis carried out shows that the accuracy of solutions increases as the mesh is decreased and that the solutions are affected by round off errors. The accuracy of solutions increases as the number of the iterations increases, also the more efficient iterative method to use is the SOR method due to its high degree of accuracy and speed of convergence
Semelhante a Applications Of MATLAB Ordinary Differential Equations (ODE (20)
My Summer Narrative Writing For The Beginning OJustin Knight
This document provides instructions for requesting and completing an assignment writing request on the HelpWriting.net website. It outlines a 5-step process: 1) Create an account with an email and password. 2) Complete a 10-minute order form with instructions, sources, and deadline. 3) Review bids from writers and choose one based on qualifications. 4) Review the completed paper and authorize payment. 5) Request revisions until satisfied with the work. The document emphasizes that original, high-quality content will be provided and work can be revised until the customer is fully satisfied.
Writing Paper With Drawing Space. Online assignment writing service.Justin Knight
The document provides instructions for creating an account and submitting a request on the website HelpWriting.net in order to have a paper written. It outlines a 5 step process which includes registering, completing an order form with instructions and deadline, reviewing bids from writers and selecting one, reviewing the completed paper, and having the option to request revisions if needed. The website promises original, high-quality content and refunds if plagiarism is found.
College Admission Essay Template - College ApplicaJustin Knight
The document provides instructions for requesting and completing an assignment writing request through the HelpWriting.net platform. It outlines a 5-step process: 1) Create an account; 2) Complete an order form with instructions and deadline; 3) Review bids from writers and select one; 4) Review the completed paper and authorize payment; 5) Request revisions until satisfied. It emphasizes the original, high-quality work and refund policy if plagiarized.
How To Open An Essay. How To Start An Essay (With Pictures. Online assignment...Justin Knight
The document provides instructions for requesting an assignment writing service from HelpWriting.net. It outlines a 5-step process: 1) Create an account with a password and email. 2) Complete a 10-minute order form providing instructions, sources, and deadline. 3) Review bids from writers and select one based on qualifications. 4) Review the completed paper and authorize payment if satisfied. 5) Request revisions until fully satisfied, with a refund option for plagiarism.
College Application Essay Sample College ApplicatioJustin Knight
While the captivity narrative and slave narrative genres share some similarities, they primarily focus on different experiences. The captivity narrative typically describes a white woman's capture by Native Americans, portraying them as savages. In contrast, the slave narrative focuses on the harsh realities of slavery from the perspective of slaves as they describe their treatment and often quest for freedom. Key differences between the genres can be seen in Mary Rowlandson's account of her captivity and Olaudah Equiano's narrative about his life as a slave.
Top Narrative Essay Examples Mla Most PopulJustin Knight
The document discusses eating disorders such as anorexia nervosa and bulimia, defining them as emotional disorders characterized by abnormal eating habits like refusing to eat or binge eating followed by purging. It notes that anorexia involves an obsessive desire to lose weight through not eating, while bulimia involves consuming large amounts of food and then feeling guilt or shame that leads to purging. The purpose is to provide an overview of these eating disorders for a capstone research paper.
Calamo - How To Buy Best Essay Wr. Online assignment writing service.Justin Knight
Charlemagne was an important historical figure who united much of Western Europe during the Middle Ages. He conquered numerous kingdoms across modern-day France, Germany, Austria and Italy to form the Carolingian Empire. Charlemagne promoted education, spreading Christianity and civilization across Europe during a period of decline after the fall of Rome. He was crowned the first Holy Roman Emperor by the Pope in 800 CE, significantly increasing the influence of the papacy.
Career Research Paper Sample. Online assignment writing service.Justin Knight
The document provides steps for requesting writing assistance from HelpWriting.net. It outlines the registration process, how to submit a request including instructions and deadline, and how writers bid on requests. It describes reviewing bids, selecting a writer, making a deposit, and receiving the paper for review. It notes free revisions are provided and plagiarized work results in a refund.
Writing The Ad Analysis Essay - YouTube. Online assignment writing service.Justin Knight
This document provides instructions for returning or exchanging items purchased from WinkerYo.com. It outlines the general return procedure, including obtaining a return authorization number and ensuring items are in their original condition. It discusses refund timelines and notes that refunds may take up to 14 days depending on payment method. The document also specifies that WinkerYo is not liable for any exchange rate differences between purchase and refund dates. Returned items must be in their original packaging and meet other criteria to qualify for a refund.
ABAP FAQ S On Reports Scripts BDC Dialogs ABAP Reporting SAP TERMINOLOGYJustin Knight
This document provides definitions and explanations of key SAP terminology related to master data, transactional data, workflow, cost objects, and other concepts. It defines terms like master data, transactional data, cost center, internal order, G/L account, and discusses SAP database tables, open SQL, and the BASIS layer interfaces.
Problem-solving agents use search algorithms to find sequences of actions that lead to desirable goal states. Search algorithms model the problem as a graph and explore it to find a solution. Breadth-first search (BFS) explores the shallowest nodes first, generating all nodes at a given depth before deeper ones. It is complete but uses large memory. Depth-first search (DFS) explores the deepest nodes first using a stack. It uses less memory than BFS but may not terminate on infinite graphs. Iterative deepening search repeatedly performs DFS with increasing depth limits, ensuring completeness.
Assessment focuses on providing feedback to improve learning, while evaluation judges performance against standards. Assessment involves collecting data on students to help teachers and improve teaching, without grades. Evaluation compares students to others and standards using grades. Both use tests, but evaluation is higher-stakes and summative, while assessment is lower-stakes and formative. Assessment should be ongoing to continuously provide feedback, while evaluation can be periodic. The goal of assessment is improving learning and teaching methods.
Application Of Lean Six Sigma To Improve Service In Healthcare Facilities Man...Justin Knight
The author conducted a case study applying Lean Six Sigma methodology to improve the service of a facilities management department at a large healthcare organization. The department was responsible for furniture and finish maintenance and repair. The Define, Measure, Analyze, Improve, and Control framework was used over five months. Quantitative and qualitative data showed that applying Lean Six Sigma helped reduce the department's average response time to service requests.
A Framework For Information Security Risk Management CommunicationJustin Knight
This document proposes a framework called the Bornman Framework for Information Security Risk Management Communication (BFIC) to help organizations effectively communicate information security risk information between different management levels. The BFIC is made up of three groups of indicators - core indicators related to key risk management processes, indicators that support the identification and control processes, and overarching indicators related to risk management program support. The framework is designed to provide concise yet meaningful information on an organization's information security risk management program to ensure strategic management has the information needed for proper governance and oversight.
An Object Approach For Web PresentationsJustin Knight
This document summarizes the coupling of the V-STORM multimedia presentation system with the AROM knowledge representation system. It presents an AROM knowledge base called the AVS model that provides a generic model for describing multimedia presentations using SMIL. The AVS model incorporates classes and associations corresponding to SMIL elements. By instantiating this knowledge base, authors can describe their multimedia presentations and how media objects interact in a more declarative way. The corresponding SMIL file is then generated and sent to V-STORM to be played, allowing spatial and temporal consistencies to be checked during the presentation's description.
American Ways - An Introducation To American Culture.PDFJustin Knight
The document discusses the history and evolution of chocolate production. It details how cocoa beans are harvested and fermented before being dried, roasted, and ground into chocolate liquor. The liquor is then further processed through conching and tempering to produce smooth chocolate for consumption.
A Compilation Of Case Digests For Transportation LawJustin Knight
This document contains summaries of 5 case digests related to maritime law:
1) Standard Oil Company v. Manuel Lopez Castelo - The ship owner is civilly liable for losses from cargo jettisoned by the captain during a storm.
2) Yu Con v. Ipil, Lauron, and Solamo - The ship owner and captain are liable for negligence when a passenger's money disappeared from the chartered boat.
3) Yangco v. Laserna - The ship owner and agent are not liable for damages when passengers died after the ship sank in a typhoon, as their liability is extinguished with the total loss of the vessel.
4) Chua Yek Hong v
A New Childhood Social Studies Curriculum For A New Generation Of CitizenshipJustin Knight
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive function. Exercise causes chemical changes in the brain that may help protect against mental illness and improve symptoms for those who already suffer from conditions like depression and anxiety.
A Supporting Hand In Dealing With Interpersonal Conflicts The Role Of Intera...Justin Knight
This study examined how conflict management styles and interactional justice influence subordinates' psychological strain. The researchers hypothesized that a bargaining style would be positively related to strain, while a problem-solving style would be negatively related. They also hypothesized that interactional justice from supervisors would weaken the relationship between bargaining and strain. Data was collected through surveys of 390 Malaysian public sector employees. Results supported the hypotheses, indicating that bargaining relates to increased strain, problem-solving relates to decreased strain, and interactional justice buffers the negative impact of bargaining. This research highlights the importance of interactional justice and conflict management styles for subordinates' well-being.
An Analytical Framework For Miles And Snow Typology And Dynamic CapabilitiesJustin Knight
This document presents a framework that connects the concept of dynamic capabilities to Miles and Snow's generic strategic model from 1978. It aims to clarify the concept of dynamic capabilities and propose an analytical framework. Dynamic capabilities refer to an organization's ability to adapt, integrate and reconfigure its internal and external resources and competencies in response to a changing environment. While dynamic capabilities have become an important area of strategic study, the literature remains confusing with overlapping definitions and contradictions. The proposed framework in this document analyzes how dynamic capabilities can generate sustainable competitive advantage and evolutionary fit based on the level of perceived environmental uncertainty.
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPRAHUL
This Dissertation explores the particular circumstances of Mirzapur, a region located in the
core of India. Mirzapur, with its varied terrains and abundant biodiversity, offers an optimal
environment for investigating the changes in vegetation cover dynamics. Our study utilizes
advanced technologies such as GIS (Geographic Information Systems) and Remote sensing to
analyze the transformations that have taken place over the course of a decade.
The complex relationship between human activities and the environment has been the focus
of extensive research and worry. As the global community grapples with swift urbanization,
population expansion, and economic progress, the effects on natural ecosystems are becoming
more evident. A crucial element of this impact is the alteration of vegetation cover, which plays a
significant role in maintaining the ecological equilibrium of our planet.Land serves as the foundation for all human activities and provides the necessary materials for
these activities. As the most crucial natural resource, its utilization by humans results in different
'Land uses,' which are determined by both human activities and the physical characteristics of the
land.
The utilization of land is impacted by human needs and environmental factors. In countries
like India, rapid population growth and the emphasis on extensive resource exploitation can lead
to significant land degradation, adversely affecting the region's land cover.
Therefore, human intervention has significantly influenced land use patterns over many
centuries, evolving its structure over time and space. In the present era, these changes have
accelerated due to factors such as agriculture and urbanization. Information regarding land use and
cover is essential for various planning and management tasks related to the Earth's surface,
providing crucial environmental data for scientific, resource management, policy purposes, and
diverse human activities.
Accurate understanding of land use and cover is imperative for the development planning
of any area. Consequently, a wide range of professionals, including earth system scientists, land
and water managers, and urban planners, are interested in obtaining data on land use and cover
changes, conversion trends, and other related patterns. The spatial dimensions of land use and
cover support policymakers and scientists in making well-informed decisions, as alterations in
these patterns indicate shifts in economic and social conditions. Monitoring such changes with the
help of Advanced technologies like Remote Sensing and Geographic Information Systems is
crucial for coordinated efforts across different administrative levels. Advanced technologies like
Remote Sensing and Geographic Information Systems
9
Changes in vegetation cover refer to variations in the distribution, composition, and overall
structure of plant communities across different temporal and spatial scales. These changes can
occur natural.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
Gender and Mental Health - Counselling and Family Therapy Applications and In...PsychoTech Services
A proprietary approach developed by bringing together the best of learning theories from Psychology, design principles from the world of visualization, and pedagogical methods from over a decade of training experience, that enables you to: Learn better, faster!
Temple of Asclepius in Thrace. Excavation resultsKrassimira Luka
The temple and the sanctuary around were dedicated to Asklepios Zmidrenus. This name has been known since 1875 when an inscription dedicated to him was discovered in Rome. The inscription is dated in 227 AD and was left by soldiers originating from the city of Philippopolis (modern Plovdiv).
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
Communicating effectively and consistently with students can help them feel at ease during their learning experience and provide the instructor with a communication trail to track the course's progress. This workshop will take you through constructing an engaging course container to facilitate effective communication.
Constructing Your Course Container for Effective Communication
Applications Of MATLAB Ordinary Differential Equations (ODE
1. Applications of MATLAB:
Ordinary Differential Equations (ODE)
David Houcque
Robert R. McCormick School of Engineering and
Applied Science - Northwestern University
2145 Sheridan Road
Evanston, IL 60208-3102
Abstract
Textbooks on differential equations often give the impression that most differential
equations can be solved in closed form, but experience does not bear this out. It
remains true that solutions of the vast majority of first order initial value problems
cannot be found by analytical means. Therefore, it is important to be able to approach
the problem in other ways. Today there are numerous methods that produce numerical
approximations to solutions of differential equations. Here, we introduce the oldest and
simplest such method, originated by Euler about 1768. It is called the tangent line
method or the Euler method. It uses a fixed step size h and generates the approximate
solution.
The purpose of this paper is to show the details of implementing a few steps of
Euler’s method, as well as how to use built-in functions available in MATLAB (2005)
[1]. In the first part, we use Euler methods to introduce the basic ideas associated with
initial value problems (IVP). In the second part, we use the Runge-Kutta method pre-
sented together with the built-in MATLAB solver ODE45. The implementations that
we develop in this paper are designed to build intuition and are the first step from
textbook formula on ODE to production software.
Key words: Euler’s methods, Euler forward, Euler modified, Euler backward, MAT-
LAB, Ordinary differential equation, ODE, ode45.
1 Introduction
The dynamic behavior of systems is an important subject. A mechanical system involves displace-
ments, velocities, and accelerations. An electric or electronic system involves voltages, currents,
and time derivatives of these quantities. An equation that involves one or more derivatives of the
1
2. unknown function is called an ordinary differential equation, abbreviated as ODE. The order of the
equation is determined by the order of the highest derivative. For example, if the first derivative
is the only derivative, the equation is called a first-order ODE. In the same way, if the highest
derivative is second order, the equation is called a second-order ODE.
The problems of solving an ODE are classified into initial-value problems (IVP) and boundary-
value problems (BVP), depending on how the conditions at the endpoints of the domain are spec-
ified. All the conditions of an initial-value problem are specified at the initial point. On the other
hand, the problem becomes a boundary-value problem if the conditions are needed for both initial
and final points. The ODE in the time domain are initial-value problems, so all the conditions are
specified at the initial time, such as t = 0 or x = 0. For notations, we use t or x as an independent
variable. Some literatures use t as time for independent variable.
It is important to note that our focus here is on the practical use of numerical methods in
order to solve some typical problems, not to present any consistent theoretical background. There
are many excellent and exhaustive texts on these subjects that may be consulted. For example, we
would recommend Edwards and Penny (2000) [2], Boyce and DiPrima (2001) [3], Coombes et al.
(2000) [4], Van Loan (1997) [5], Nakamura (2002) [6], Moler (2004) [7], and Gilat (2004) [8].
2 Numerical methods
Numerical methods are commonly used for solving mathematical problems that are formulated in
science and engineering where it is difficult or even impossible to obtain exact solutions. Only a
limited number of differential equations can be solved analytically. Numerical methods, on the
other hand, can give an approximate solution to (almost) any equation. An ordinary differential
equation (ODE) is an equation that contains an independent variable, a dependent variable, and
derivatives of the dependent variable. Literal implementation of this procedure results in Euler’s
method, which is, however, not recommended for any practical use. There are other methods
more sophisticated than Euler’s. Among them, there are three major types of practical numerical
methods for solving initial value problems for ODEs: (i) Runge-Kutta methods, (ii) Burlirsch-Stoer
method, and (iii) predictor-corrector methods. We will present these three approaches on another
occasion. Now, we are interested to talk about Euler’s methods.
2.1 EULER methods
The Euler methods are simple methods of solving first-order ODE, particularly suitable for quick
programming because of their great simplicity, although their accuracy is not high. Euler methods
include three versions, namely,
• forward Euler method
• modified Euler method
• backward Euler method
3. 2.1.1 Forward Euler method
The forward Euler method for y′ = f(y, x) is derived by rewriting the forward difference approxi-
mation,
(yn+1 − yn)/h ≈ y′
n (1)
to
yn+1 = yn + hf(yn, xn) (2)
where y′
n = f(yn, xn) is used. In order to advance time steps, Eq. 2 is recursively applied as
y1 = y0 + hy′
0
y1 = y0 + hf(y0, x0)
y2 = y1 + hf(y1, x1) (3)
y3 = y2 + hf(y2, x2)
.
.
.
yn = yn−1 + hf(yn−1, xn−1)
2.1.2 Modified Euler method
First, the modified Euler method is more accurate than the forward Euler method. Second, it is
more stable. It is derived by applying the trapezoidal rule to the solution of y′ = f(y, x)
yn+1 = yn +
h
2
[f(yn+1, xn+1) + f(yn, xn)] (4)
2.1.3 Backward Euler Method
The backward Euler method is based on the backward difference approximation and written as
yn+1 = yn + hf(yn+1, xn+1) (5)
The accuracy of this method is quite the same as that of the forward Euler method.
2.2 Steps for MATLAB implementation
The purpose of using an example is to show you the details of implementing the typical steps of
Euler’s method, so that it will be clear exactly what computations are being executed. For some
reasons, MATLAB does not include Euler functions. Therefore, if you really need one, you have to
code by yourselves. However, MATLAB has very sophisticated ones using Runge-Kutta algorithms.
We will show how to use one of them in the next section.
4. 2.2.1 Basic steps
The typical steps of Euler’s method are given below.
Step 1. define f(x, y)
Step 2. input initial values x0 and y0
Step 3. input step sizes h and number of steps n
Step 4. calculate x and y:
for i=1:n
x=x+h
y=y+hf(x,y)
end
Step 5. output x and y
Step 6. end
2.2.2 Example
As an application, consider the following initial value problem
dy
dx
=
x
y
, y(0) = 1 (6)
which was chosen because we know the analytical solution and we can use it for check. Its exact or
analytical solution is found to be
y(x) =
p
x2 + 1 (7)
Therefore, we will be able to compare the approximate solutions and the exact solution.
Here we wish to approximate y(0.3) using the Euler’s methods with step sizes h = 0.1 and
h = 0.05. We find by hand-calculation,
x0 = 0, x1 = 0.1, x2 = 0.2, x3 = 0.3
y0 = 1
y1 = y0 + hf(x0, y0) = y0 + hx0/y0 = 1
y2 = y1 + hx1/y1 = 1.01
y3 = y2 + hx2/y2 = 1.0298.
5. Since y(0.3) =
p
(0.3)2 + 1 = 1.044030, we find that
Error =
|y(0.3) − y3|
y(0.3)
× 100 = 1.36%
Similarly, for the step size h = 0.05, we find that the error is
Error =
|y(0.3) − y6|
y(0.3)
× 100 = 0.67%
2.2.3 MATLAB codes
• Step 1: Create user-defined function files: euler forward.m, euler modified.m,
and euler backward.m.
function [x,y]=euler_forward(f,xinit,yinit,xfinal,n)
% Euler approximation for ODE initial value problem
% Euler forward method
% File prepared by David Houcque - Northwestern U. 5/11/2005
% Calculation of h from xinit, xfinal, and n
h=(xfinal-xinit)/n;
% Initialization of x and y as column vectors
x=[xinit zeros(1,n)]; y=[yinit zeros(1,n)];
% Calculation of x and y
for i=1:n
x(i+1)=x(i)+h;
y(i+1)=y(i)+h*f(x(i),y(i));
end
end
function [x,y]=euler_modified(f,xinit,yinit,xfinal,n)
% Euler approximation for ODE initial value problem
% Euler modified method
% File prepared by David Houcque - Northwestern U. - 5/11/2005
% Calculation of h from xinit, xfinal, and n
h=(xfinal-xinit)/n;
% Initialization of x and y as column vectors
x=[xinit zeros(1,n)]; y=[yinit zeros(1,n)];
6. % Calculation of x and y
for i=1:n
x(i+1)=x(i)+h;
ynew=y(i)+h*f(x(i),y(i));
y(i+1)=y(i)+(h/2)*(f(x(i),y(i))+f(x(i+1),ynew));
end
end
function [x,y]=euler_backward(f,xinit,yinit,xfinal,n)
% Euler approximation for ODE initial value problem
% Euler backward method
% File prepared by David Houcque - Northwestern U. - 5/11/2005
% Calculation of h from xinit, xfinal, and n
h=(xfinal-xinit)/n;
% Initialization of x and y as column vectors
x=[xinit zeros(1,n)];
y=[yinit zeros(1,n)];
% Calculation of x and y
for i=1:n
x(i+1)=x(i)+h;
ynew=y(i)+h*(f(x(i),y(i)));
y(i+1)=y(i)+h*f(x(i+1),ynew);
end
end
• Step 2: Solve the problem by putting data and called functions into a script file called
main1.m:
% Script file: main1.m
% The RHS of the differential equation is defined as
% a handle function
% File prepared by David Houcque - Northwestern U. - 5/11/2005
f=@(x,y) x./y;
% Calculate exact solution
g=@(x) sqrt(x.^2+1);
xe=[0:0.01:0.3];
ye=g(xe);
7. % Call functions
[x1,y1]=euler_forward(f,0,1,0.3,6);
[x2,y2]=euler_modified(f,0,1,0.3,6);
[x3,y3]=euler_backward(f,0,1,0.3,6);
% Plot
plot(xe,ye,’k-’,x1,y1,’k-.’,x2,y2,’k:’,x3,y3,’k--’)
xlabel(’x’)
ylabel(’y’)
legend(’Analytical’,’Forward’,’Modified’,’Backward’)
axis([0 0.3 1 1.07])
% Estimate errors
error1=[’Forward error: ’ num2str(-100*(ye(end)-y1(end))/ye(end)) ’%’];
error2=[’Modified error: ’ num2str(-100*(ye(end)-y2(end))/ye(end)) ’%’];
error3=[’Backward error: ’ num2str(-100*(ye(end)-y3(end))/ye(end)) ’%’];
error={error1;error2;error3};
text(0.04,1.06,error)
• Step 3: Compare the results.
The calculated results are displayed in the graphical form below. Reasonably good results
are obtained even for a moderately large step size and the approximation can be improved
by decreasing the step size. According to the results (Figure 1) and Table 1, forward and
backward approaches give identically the same results (less than 1% of error), while modified
method give very good result when compared with the exact solution.
h Forward Modified Backward
0.05 0.67% 0.04% 0.67%
Table 1: Comparison of exact solution with Euler methods
2.3 Using built-in function
MATLAB has several different functions (built-ins) for the numerical solution of ordinary differ-
ential equations (ODE). In this section, however, we will present one of them. We will also give
an example how to use it, instead of writing our own MATLAB codes as we did in the first part.
The basic steps, previously defined, are still typically the same. These solvers can be used with
the following syntax:
[x,y] = solver(@odefun,tspan,y0)
8. 0 0.05 0.1 0.15 0.2 0.25 0.3
1
1.01
1.02
1.03
1.04
1.05
1.06
1.07
x
y
Forward error: −0.6751%
Modified error: 0.0003983%
Backward error: 0.67244%
Analytical
Forward
Modified
Backward
Figure 1: Comparison of exact solution with Euler methods
9. solver is the solver you are using, such as name, ode45 or ode23. odefun is the function that
defines the derivatives, so odefun defines y′ as a function of the independent parameter (typically
x or t) as well as y and other parameters. tspan a vector that specifies the interval of the solution
(e.g., [t0,tf]). y0 is the initial value of y. [x,y] is the output, which is the solution of the ODE.
2.3.1 Runge-Kutta methods
There are many variants of the Runge-Kutta method, but the most widely used one is the following.
Given:
y′
= f(x, y) (8)
y(xn) = yn
we compute in turn
k1 = hf(xn, yn)
k2 = hf(xn +
h
2
, yn +
k1
2
)
k3 = hf(xn +
h
2
, yn +
k2
2
) (9)
k4 = hf(xn + h, yn + k3)
yn+1 = yn +
1
6
(k1 + 2k2 + 2k3 + k4)
2.3.2 Using ode45
ode45 is based on an explicit Runge-Kutta (4,5) formula, the Dormand-Prince pair [9]. That means
the numerical solver ode45 combines a fourth order method and a fifth order method, both of which
are similar to the classical fourth order Runge-Kutta (RK) method discussed above. The modified
RK varies the step size, choosing the step size at each step in an attempt to achieve the desired
accuracy. Therefore, the solver ode45 is suitable for a wide variety of initial value problems in
practical applications. In general, ode45 is the best function to apply as a “first try” for most
problems. Table 2 lists ODE solvers, which are MATLAB built-in functions. A short description
of each solver is included.
Note - It is important to note that in MATLAB 7.0 (R14), latest version, it is preferred to have
odefun in the form of a function handle. For example, it is recommended to use the following
syntax,
ode45(@xdot,tspan,y0)
rather than
10. Solver Accuracy Description
ode45 Medium This should be the first solver you try
ode23 Low Less accurate than ode45
ode113 Low to high For computationally intensive problems
ode15s Low to medium Use if ode45 failed
Table 2: Some MATLAB ODE solvers
ode45(’xdot’,tspan,y0)
Note the use of @xdot and ’xdot’. Use function handles to pass any function that defines quantities
the MATLAB solver will compute, in particular for simple functions.
On the other hand, it is also important to remember that complicated differential equations
should be written an M-file instead of using inline command or function handle.
Following is an example of an ordinary differential equation using a MATLAB ODE solver.
First, let’s create a script file, called main2.m, as follows:
% Script file: main2.m
% The RHS of the differential equation is defined as
% a function handle.
% File prepared by David Houcque - Northwestern U. - 5/11/2005
f=@(x,y) x./y;
% Calculate exact solution
g=@(x) sqrt(x.^2+1);
xe=[0:0.01:0.3];
ye=g(xe);
% Call function
[x4,y4]=ode45(f,[0,0.3],1);
% Plot
plot(xe,ye,’k-’,x4,y4,’k:’)
xlabel(’x’)
ylabel(’y’)
legend(’Analytical’,’ode45’)
axis([0 0.3 1 1.05])
Here, we use the same data as defined in the first part for Euler’s methods. The initial conditions
and the time steps are the same as before.
The integration proceeds by steps, taken to the values specified in tspan. Note that the step
size (the distance between consecutive elements of tspan) does not have to be uniform.
11. A plot comparing the computed y versus x is shown in Figure 2. According to the plot, the
0 0.05 0.1 0.15 0.2 0.25 0.3
1
1.005
1.01
1.015
1.02
1.025
1.03
1.035
1.04
1.045
1.05
x
y
Analytical
ode45
Figure 2: Comparison of exact solution with ode45 solution
calculated results using the built-in function (ode45) give a very good result when compared with
the analytical solution.
Additional on all of these solvers can be found in the online help. For addition information
on numerical methods, we refer to Shampine (1994) [10] and Forsythe et al. (1977) [11].
3 Conclusion
The above plots show the results obtained from different algorithms. Consequently, we can see
better that Runge-Kutta algorithm is even more accurate at large step size (h = 0.1) than Euler
algorithms at small step size (h = 0.05). One can easily adapt these MATLAB codes as needed for
a different type of problem. In using numerical procedure, such as Euler’s method, one must always
keep in mind the question of whether the results are accurate enough to be useful. In the preceding
examples, the accuracy of the numerical results could be ascertained directly by a comparison with
the solution obtained analytically. Of course, usually the analytical solution is not always available
to compare.
12. Acknowledgement- The author is sincerely grateful to Associate Dean Steve Carr
for his support. Thanks also go to Professor MacIver for his support and discussions.
He is grateful to EA3 students (Honors Section) for their bright ideas and suggestions.
References
[1] The MathWorks Inc. MATLAB: SP2 R14. The MathWorks Inc., 2005.
[2] C. H. Edwards and D. E. Penny. Differential Equations and Boundary Value Problems: Com-
puting and Modeling. Prentice Hall, 2000.
[3] W. E. Boyce and R. C. DiPrima. Elementary Differential Equations and Boundary Value
Problems. John Wiley and Sons, 2001.
[4] K. R. Coombes, B. R. Hunt, R. L. Lipsman, J. E. Osborn, and G. J. Stuck. Differential
Equations with MATLAB. John Wiley and Sons, 2000.
[5] C. F. Van Loan. Introduction to Scientific Computing. Prentice Hall, 1997.
[6] S. Nakamura. Numerical Analysis with MATLAB. Prentice Hall, 2002.
[7] C. B. Moler. Numerical Computing with MATLAB. Siam, 2004.
[8] A. Gilat. MATLAB: An introduction with Applications. John Wiley and Sons, 2004.
[9] J. R. Dormand and P. J. Prince. A family of embedded Runge-Kutta formulae. J. Comp.
Appl. Math, 6:19–26, 1980.
[10] L. F. Shampine. Numerical Solution of Ordinary Equations. Chapman and Hall, 1994.
[11] G. Forsythe, M. Malcolm, and C. Moler. Computer Methods for Mathematical Computations.
Prentice-Hall, 1977.