Wednesday, May 29, 2013

Solution of Ordinary Differential Equation using Runge-Kutta Method | RK4 method for ODE Solution in C

In numerical analysis, the Runge–Kutta methods are an important family of implicit and explicit iterative methods for the approximation of solutions of ordinary differential equations. These techniques were developed around 1900 by the German mathematicians C. Runge and M. W. Kutta.

There are many variants of the Runge-Kutta method, but the most widely used one is the following known as RK-4 method: 
y' = f(x,y) 
y(xn) = yn 
we compute in turn 
k1 = hf(xn,yn) 
k 2 = hf (xn+h/2,yn+k1/2)
k3 = hf (xn+h/2,yn+k2/2)
k4 = hf(xn + h, yn + k3) 
yn+1 = yn + (k1 + 2*k2 + 2*k3 + k4 )/6

This algorithm can be implemented  using the following source code in C:

Friday, May 24, 2013

Gauss Jordan Method Implementation with C Source Code

In linear algebra, Gaussian Jordan method is an algorithm for solving systems of linear equations. It is usually understood as a sequence of operations performed on the associated matrix of coefficients. This method can also be used to find the rank of a matrix, to calculate the determinant of a matrix, and to calculate the inverse of an invertible square matrix.

We can implement this method in C using the following source code:
//Implementation of Gauss Jordan Method, @author: +Jivan Nepali, @URL: codeplustech
 #define Max 10  
 int main()  
   float a[Max][Max+1],t,det=1;  
   int i,j,k,N;  
   printf("Enter the number of unknowwns : ");  

Thursday, May 23, 2013

Modeling & Simulation of Chemical Reaction | Continuous System Simulation | C++ Implementation

Chemical reactions exhibit dynamic equilibrium, which means that a combination reaction is also accomplished by the reverse process of decomposition reaction. At the steady state the rates of the forward and the backward reaction is same.

In addition to the forward reaction where Ch1 and Ch2 react to produce Ch3, there may also be backward reaction, where by, Ch3 decomposes back into Ch1 and Ch2. Let the rate of formation of Ch3 be proportional to the product of the amounts Ch1 and Ch2 present in the mixture and let the rate of decomposition of Ch3 be proportional to its amount in the mixture. 
Let us consider C1, C2  and C3 Amount of Ch1, Ch2 and Ch3 at any instant of time t, the rate of increase of C1, C2& C3 are given by the following differential equations:

dC1/dt = K1C3– K1C1C2
dC2/dt = K2C3– K1C1C2

Where K1and K2 are constants.

Tuesday, May 21, 2013

Preventing Windows 8 from Automatically Launching Browser on Network Connection | Solutions

With the newer version of Microsoft's Windows Operating System- Windows 8, its users are experiencing newer and more advanced features than the older versions. But, at the same time they may have been facing with some of the strange troubles.

One such issue is that Windows 8 automatically launches its default browser upon the the internet connection. To some users it may be helpful as they need not to open the browser and especially for users in a LAN provided by some institutions such as University, it may be the sign of avialability of the internet connection. But, for most of the users such as those posting in Microsoft's Community Page, it may be really problematic. 

"Windows is launching the following link in Internet Explorer:

which leads to Bing. When I enable my internet connection Bing will popup from time to time. When I disable Internet Explorer via the Windows Features, the link will open in Mozilla Firefox."

So, the steps that I followed for solving this issue are given:

Saturday, May 18, 2013

Newton-Raphson Method in C with source codes

Newton-Raphson method is a method for finding successively better roots (zeros) of a real valued function
x: f(x) = 0.

The algorithm can be implemented in C as follows:

#define h pow(10,-6)
#define error pow(10,-6)
double f(double x)
double df(double x)
 return 2*x;