Friday, 21 March 2014

C PROGRAMMING FOR STUDENTS OF PHYSICS HONs. IN WEST BENGAL

C PROGRAMMING FOR STUDENTS OF PHYSICS HONs. IN   WEST BENGAL

 (dedicated to students of west bengal state university, calcutta university, kalyani university)

  BASICS

    c programming is included in 3rd year for physics honours students , students are either provided borland c++ or turbo c++. The programs are more or less same in both compilers , the main()body is almost same , there are only a few minor difference , the programs provided here can be tried on both of these compilers as they would work on both. Students are requested to try the programs and post for error if any in comments.

Types of programs in c

  The programs  in C are mainly for numerical methods, there are many equations which takes time to be solved by hand and paper, there are lots of datas which takes time to be calculated , so we use C to mainly ease our complication as we would procide the equations and C would compute them for us.

C is used in numerical methods for :-
1. sorting and arranging
2. integraion
3.differentiation
4.generate data for plotting graph
5.calculate mean,median,mode
6.find the solution of a series



SORTING AND ARRANGING

      Sorting means to pick up things and arrange in a desired way , we normally use bubble sorting and selection sorting. A sorting program is provided as under

   Creating an array of 1D array of any 12 integer numbers(1 to 100)taken as input and arranging them in descending order. Also the number of swaps are counted.
   

INTEGRATON

A program to integrate I=  cos(x)dx  in the limit 0 to pi(180) to determine the optimum value of h using Simpson’s 1/3 rule.


DIFFERENTIATION

No comments:

Post a Comment