# method

## Numerical Method Newtons Forward and Backward Interpolation in CC

Numerical Method: Newton’s Forward and Backward Interpolation in C/C++ #include #include int main() { float x[10],y[15][15]; int n,i,j; printf(“Enter n : “); scanf(“%d”,&n); printf(“X\tY\n”); for(i = 0;i

## Numerical Methods: Greatest Eigen value and corresponding Eigen vector using power method in C

Source Code: void matrix_mul(float matrix1[3][3],float matrix2[3][1],float matrix3[3][1]){ int i,j,k; for(i = 0; i < 3; i++){ for(j = 0; j < 1; j++){ matrix3[i][j] = 0; for(k = 0; k < 3; k++){ matrix3[i][j] += matrix1[i][k]*matrix2[k][j]; } } } } float findmax(float array[3][1]){ int i; float maximum; maximum = …

## Numerical Methods Solution of simultaneous algebraic equations using Gauss Jordan method in C

Numerical Methods: Solution of simultaneous algebraic equations using Gauss Jordan method in C Source Code: /***************************************************** Program: solution of linear algebraic equations using Gauss Jordan Method Language used: C Program written by Bibek Subedi July 2, 2011 Tribhuvan University *****************************************************/ #include int main() { double matrix[10][10],a,b; int i, j, k, …

## Numerical Methods Solution of simultaneous algebraic equations using Gauss Elimination method in C

Numerical Methods: Solution of simultaneous algebraic equations using Gauss Elimination method in C Source Code: /***************************************************** Program: Solution of Linear algebraic equations using Gauss Elimination method Language used: C Program written by Bibek Subedi *****************************************************/ #include int main() { double matrix[10][10],a,b, temp[10]; int i, j, k, n; printf(“Enter the no …

## Numerical MethodsFitting the curve of the form y a bx using least square method in C

Numerical Methods:Fitting the curve of the form y = a + bx using least square method in C ///Curve fitting of a straight line of the form y = a + bx #include #include int main(){ int ax[20], ay[20], i, n; int sum_x = 0, sum_xy = 0, sum_x2 = …

## Numerical Methods Interpolation with unequal interval with Lagranges method in C

Numerical Methods: Interpolation with unequal interval with Lagrange’s method in C Source Code: ///Interpolation with unequal intervals with Lagrange’s Formula #include #include #include COORD coord = {0, 0}; void gotoxy (int x, int y) { coord.X = x; coord.Y = y; // X and Y coordinates SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord); } int …

## Numerical Methods Solution of nonlinear equation by using Secant method in C

Numerical Methods: Solution of non-linear equation by using Secant method in C Source Code: ///solution of non linear equations using secant method #include #include float f(float x){ return (pow(x,5) – 3*pow(x,3)-1); } int main(){ float a, b, c; int count = 0; printf(“Enter the initial value of a: “); scanf(“%f”, …

## Numerical Methods Solution of nonlinear equation using Newton Raphson method in C

Numerical Methods: Solution of non-linear equation using Newton Raphson method in C Source Code: ///solution of non-linear equation using Newton Raphson Method #include #include float f(float x){ return (pow(x,3) + 5*pow(x,2) -7); } float df(float x){ return (3*pow(x,2) + 10*x ); } int main(){ float x0, x1, x2; int count …

## Numerical Methods Solution of nonlinear equations by using Bisection method in C

Numerical Methods: Solution of non-linear equations by using Bisection method in C Algorithm: Declare and initialize necessary variables like up_range, mid, low_range etc. Read the range( upper and lower)  from user within which the root of the equation  is to be calculated. If root lies within the range? if yes: …

## Numerical method Solution of ordinary differential equation using RK4 method in C

Numerical method : Solution of ordinary differential equation using RK4 method in C Algorithm: Start Declare and Initialize necessary variable likes K1, K2, K3, K4 etc. Declare and define the function that returns the functional value. Get the initial value of x, initial value of y, no. of iteration and …

## Write Code for Humans not Machines

Programmers spend more their time reading someone else’s code than reading or writing their own. This is why it is important that whoever writes the code pays particular attention not only to what it does but also to how it does it. For a compiler, it makes no difference if …