Evaluating ordinary differential equations by RK-4 or classical method both order first and second
//To compute ordinary differential equations by RK-4 or classical method for order first
#include
#include
#include
void main()
{
cout<<”\t first order R-K 4th Classical Method\t”<
double h,n,m1,i,m2,m3,m4,x[100],y[100];
cout<<”Number of intervals “;
cin>>n;
cout<
cout<<”Enter the value of h”<<<”h = “;
cin>>h;
cout<<”Enter the value of x0″<<<”x0 = “;
cin>>x[0];
cout<<”Enter the value of y0″<<<”y0 = “;
cin>>y[0];
cout<
for(i=0;i<=n;i++)
{
x[i+1]=x[i]+h;
m1=h*.5*(1+x[i])*(y[i]*y[i]);
m2=h*.5*(1+(x[i]+.5*h))*(y[i]+m1*.5*h)*(y[i]+m1*.5*h);
m3=h*.5*(1+(x[i]+.5*h))*(y[i]+m2*.5*h)*(y[i]+m2*.5*h);
m4=h*.5*(1+(x[i]+h))*(y[i]+m3*h)*(y[i]+m3*h);
y[i+1]=y[i]+(m1+2.0*m2+2.0*m3+m4)/6;
cout<<”x”<<<”= “<<
cout<<”y”<<<”= “<<
cout<
}
getch();
}
// To compute ordinary differential equations by RK-4 or classical method for order second
#include
#include
#include
void ...
Trapezoidal rule can be applied to find the value of a limiting integer programmatically in both cases whether individual functional values are given or not. A complete algorithm follows the both process below.
/*********
Trapezoidal rule complete algorithm
1. start
2. read n= no of intervals
3. read initial and final values ie a,b
4. h=(b-a)/n;
5. set x[0]=a; x[n]=b;
6. next element
i= 1 to n-1
x[i]=x[i-1]+h
7.
Program to calculate the Inverse of a Matrix using Gauss Jordon Method, a simple yet complete algorithm follows below.
Gauss Jordon Method can be employed to solve a system of linear equations having solutions. Unlink in Gauss Elimination method (in which triangular matrix is formed), in Gauss Jordon Method all off diagonal elements are eliminated producing a diagonal matrix.
Here are few programs written in C++ Programming Language for the Numerical Methods course for beginner Engineering Students. Sample codes, executing files and sometimes background theory can be found. Please, report back if you came across broken links or incorrect coding or anything you found to complain about. Queries will be replied.
To write a program to calculate the roots of a quadratic equation ie ax^2+bx+c=0
To calculate the real roots ...
Course Objectives
To present the theory of numerical computational procedures for solving engineering problems. Solution of ordinary and partial differential equations will be included.
1.0 Solution of Nonlinear Equations:(10 hours)
1.1 Review of calculus, continuity, differentiability, intermediate value theorem, Taylor’s theorem
1.2 Absolute, relative, and round off errors, error bounds for computational errors
1.3 Bisection method, its error bounds and convergence
1.4 Newton’s method, secant method and their convergence
1.5 Fixed point iteration, its convergence properties,
1.6 Zeros ...
Program to solve the linear equation using Gauss Elimination Method, the complete algorithm for Gauss Elimination Method is given below.
The Gauss Elimination process involves two techniques for solving linear equation. The first one is forming upper triangular matrix by forward elimination and the second is using backward substitution method to find the unknown values.
//lab 6 to solve the linear equation using Gauss Elimination method.
/* complete algorithm for Gauss Elimination Method
1.
Roots of a quadratic or polynomial can be computed using Bisection Method.
The only difference that lies between the bisection method and the regula falsi method is the way the next new point x0 is found.
The bisection method is linearly convergent as error decreases linearly with step each by a factor of 0.5. However, since the convergence is slow to achieve a higher degree of accuracy, a large number of iterations ...
Program to calculte the real roots of an equation using Regula Falsi (Bracketing) Method
The only difference that lies between the bisection method and the regula falsi method is the way the next new point x0 is found.
The bisection method is linearly convergent as error decreases linearly with step each by a factor of 0.5. However, since the convergence is slow to achieve a higher degree of accuracy, a large number ...
Program to calculate atleast one root of a cubical equation correct to 3 decimal place using Newton Raphson (NR) Method
To calculate atleast one root of a cubical equation correct to 3 decimal place using Newton Raphson (NR) Method in C++ Programming Language for Numerical Methods for Engineering Students
Program to understand and use Lagrange’s Interpolation for a polynomial to determine functional value of data
Lagrange’s Interpolation for a polynomial is used to determine nature of a polynomial with its degree based upon number of input values. As a polynomial is constructed, it is matched for the given data value to verify or to compute its functional value.