Posts

C Program for Insertion Sort | C Programming

C Program For Insertion Sort Using time.h Function and Generating Random Number #include <math.h> #include <time.h> #include <stdlib.h> #include <stdio.h> void insertionSort ( int arr [], int n ) {     int i , key , j ;     for ( i = 1 ; i < n ; i ++)     {         key = arr [ i ];         j = i - 1 ;         while ( j >= 0 && arr [ j ] > key )         {             arr [ j + 1 ] = arr [ j ];             j = j - 1 ;         }         arr [ j + 1 ] = key ;     } } void printArray ( int arr [], int n ) {     int i ;     for ( i = 0 ; i < n ; i ++)         printf ( " %d  " , arr [ i ]);     printf ( " \n " ); } int main () {     int arr [ 100 ], n , i ;     time_t t ;     printf ( "Enter the max number \n " );     scanf ( " %d " , & n );     srand (( unsigned ) time (& t ));     for ( i = 0 ; i < n ; i ++)     {         arr [ i ] = rand () % 100 ;     }    

Eigen Values and Eigen Vectors

Eigenvalues Eigenvalues are a special set of scalars associated with a linear system of equation (i.e., a matrix equation) that are sometimes also known as characteristic roots, characteristic values, proper values, or latent roots.

Doolittle Algorithm: LU Decomposition Algorithm

Image
DOOLITTLE Algorithm In the numerical method Doolittle Algorithm : LU Decomposition Algorithm (where LU stands for Lower and Upper and also called LU factorization Algorithm) factors a matrix as the product of a lower triangular matrix and an upper triangular matrix. Computers usually solve square systems of linear equations using the LU decomposition, and it is also a key step when inverting a matrix, or computing the determinant of a matrix. Let A be a square matrix. An LU factorization algorithm refers to the factorization of A, with proper row and/or column orderings or permutations, into two factors, a lower triangular matrix L and an upper triangular matrix U,  A=LU . Assume that  A  has a Crout factorization  A  =  LU . 

Improved Euler's Method and Euler's Method with their C Program

Image
Improved Euler’s Method The Improved Euler’s method, also known as the Heun formula or the average slope method, gives a more accurate approximation than the Euler rule and gives an explicit formula for computing  y n+1 . The basic idea is to correct some errors of the original Euler's method. The syntax of the Improved Euler’s method is similar to that of the trapezoid rule, but the  y  value of the function in terms of  y n+1  consists of the sum of the  y  value and the product of  h  and the function in terms of  x n  and  y n .

Runge Kutta Method Formula and C Program

Image
Runge Kutta Method A Runge Kutta Method of numerically integrating ordinary differential equations by using a trial step at the midpoint of an interval to cancel out lower-order error terms. The second-order formula is

C Program for Shooting Method | C Programming

Introduction The  shooting method  is a method for solving a Boundary Value Problem by reducing it to the solution of an Initial Value Problem. Roughly speaking, we 'shoot' out trajectories in different directions until we find a trajectory that has the desired boundary value.

C Program for Laplace Algorithm | C Programming

Image
Laplace Algorithm Laplace’s approximation is one of the most fundamental asymptotic techniques for the estimation of integrals containing a large parameter or variable. For integrals of the form