Posts

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

C Program To Find The Value Using Poison Algorithm | C Programming

C Programming | C Program to find the value using poison algorithm #include<stdio.h> #include<conio.h> #include<math.h> #define g(x,y) 2*(x)*(x)*(y)*(y) int main(){ int n,i,j,k; float sum,error,E[10],a[10][10],b[10],new_x[10],old_x[10],tl,tr,tu,tb,h,buffer; printf("\nPoision's' \n"); printf("Enter the dimension of plate\n"); scanf("%d",&n); printf("\nEnter the dimension of grid\n"); scanf("%f",&h); printf("\nEnter the temperatures at left, right, bottom and top of the plate \n"); scanf("%f%f%f%f",&tl,&tr,&tb,&tu); //construction of coefficient matrix for(i=0;i<=n;i++) a[i][i]=-4; for(i=0;i<=n;i++) a[i][n-i]=0; for(i=0;i<=n;i++) for(j=0;j<=n;j++){ if(i!=j && j!=(n-i)) a[i][j]=1; } //Construction of RHS vector k=0; for(i=1;i<n;i++) for(j=1;j<n;j++) b[k++]=h*h*g(i,j); k=0; for(i=1;i<n;i++){ for(j=1;j&l

C program for Simpson's 1/3 Rule | C Programming

Image
C program for Simpson's 1/3 Rule  Before Starting the program let us know about the Simpson's 1/3 rule and How it works? Simpson’s 1/3 Rule The trapezoidal rule was based on approximating the integrand by a first-order polynomial and then integrating the polynomial over an interval of integration. Simpson’s 1/3 rule is an extension of the Trapezoidal rule where the integrand is approximated by a second-order polynomial.

C Program to calculate value using composite trapezoidal rule | C Programming

C programming to calculate value using composite trapezoidal rule #include<stdio.h> #include<conio.h> #include<math.h> #define F(x) 2*x int main() { int n,i; float a,b,h,x,sum=0,integral; printf("Enter the two limits:\n"); scanf("%f%f",&a,&b); printf("Enter the difference n:\n"); scanf("%d",&n); h=(b-a)/n; for(i=1;i<n;i++) { x=a+i*h; sum=sum+F(x); } integral=(h/2)*(F(a)+F(b)+2*sum); printf("\nThe integral is: %f\n",integral); return 0; }

C Programming Codes To Compute Value Using Trapezoidal Rule

C Programming Codes To Compute Value Using Trapezoidal Rule #include<stdio.h> #include<conio.h> #include<math.h> #define F(x) exp(-(x/2)) int main() { int a,b,h; float i,x,y; printf("Enter the value for lower and upper limit\n"); scanf("%d%d",&a,&b); h=b-a;//Calculating height x=F(a);//Calculation Function and storing in x and y. y=F(b); i=h*((x+y)/2); printf("The Intregrated Value is %.3f",i); }