Vous êtes sur la page 1sur 13

1

BMS COLLEGE OF ENGINEERING, BANGALORE – 560 019


(Autonomous Institute, affiliated to VTU)
Department of Information Science and Engineering

Probability Statistics and Queuing for Engineers


Usage of modern tools
2017 – 2018 – EVEN SEMESTER

Submitted by

NAME : KARTHIK HEBBAR P


USN : 1BM16IS044
2

BMS COLLEGE OF ENGINEERING, BANGALORE – 560 019

(Autonomous Institute, affiliated to VTU)

Department of Information Science and Engineering

Course: PSQE Course code: 15IS4DCPSQ

S.NO PROGRAMS PAGE NO

1. INTRODUCTION TO MODERN TOOL USED 5

2. COMMANDS DESCRIPTION 5

3. COMMANDS EXECUTED 6

4. RESULTS AND SNAPSHOTS 11


3

BMS COLLEGE OF ENGINEERING, BANGALORE – 560 019

(Autonomous Institute, affiliated to VTU)

Department of Information Science and Engineering

CERTIFICATE

Certified that Mr KARTHIK HEBBAR P bearing USN 1BM16IS044 of Fourth semester belonging to the
Department of Information Science and Engineering had successfully completed alternative assessment of
using modern tools and technology as a part of the course Probability Statistics and Queuing for Engineers
[ 15IS4DCPSQ ].

Faculty Incharge
MAMATHA K R
4

BMS COLLEGE OF ENGINEERING, BANGALORE – 560 019

(Autonomous Institute, affiliated to VTU)

Department of Information Science and Engineering

Course name: PSQE Course Code: 15IS4DCPSQ

Evaluation Form

NAME OF STUDENT : KARTHIK HEBBAR P USN 1 B M 1 6 I S 0 44

Commands executed:
Unsatisfactory Satisfactory
Criteria Good (3) Excellent (4)
(1) (2)
Delivery

Documentation

Runtime

Sample data
Use of Modern
tools

Evaluator comments

Teacher’s Signature
Marks Obtained : /20 Final Marks: /05 with Date
5

INTRODUCTION TO MODERN TOOL USED

• The compiler used is DEV C++.


• Language used to write a program is C++.

COMMANDS DESCRIPTION

• Binomial Distribution:

In probability theory and statistics, the binomial distribution with parameters n and p is the
discrete probability distribution of the number of successes in a sequence of n independent experiment.

• Point Estimation:

In statistics, point estimation involves the use of sample data to calculate a single value
(known as a statistic) which is to serve as a "best guess" or "best estimate" of an unknown
population parameter.

• Probability Distribution:

A probability distribution is a mathematical function that, stated in simple terms, can be


thought of as providing the probabilities of occurrence of different possible outcomes in an
experiment.

• Least Square Method:

The method of least squares is a standard approach in regression analysis to approximate the
solution of overdetermined systems, the sets of equations in which there are more equations than
unknowns. "Least squares" means that the overall solution minimizes the sum of the squares of the
residuals made in the results of every single equation.

• Standard Normal Distribution:

The normal distribution is a common continuous probability distribution. Normal


distributions are often used in the natural and social sciences to represent real-valued random
variables whose distributions are not known.
6

COMMANDS EXECUTION

• Binomial Distribution:

#include<iostream> int main()


#include<math.h> {
using namespace std; int n,r;
int mini(int a,int b) double s;
{ cout<<"Enter n,r,%ge of succes\n";
if(a<b) cin>>n>>r>>s;
return a; int x;
else do
return b; {
} cout<<"\n1:atleast\t2:atmost\t3:at the
int combination(int n,int r) point\n";
{ cin>>x;
int c[n+1][r+1]; double ans;
int i,j; double temp=0;
for(i=0;i<=n;i++) switch(x)
{ {
for(j=0;j<=mini(i,r);j++) case 1:
{ temp=0;
if(j==i||j==0) for(int i=n;i>r;i--)
c[i][j]=1;
else temp+=combination(n,i)*pow(s,i)*pow(1-s,n-i);
{ cout<<temp;
c[i][j]=c[i-1][j-1]+c[i-1][j]; break;
} case 2:
} temp=0;
} for(int i=0;i<=r;i++)

return c[n][r]; temp+=combination(n,i)*pow(s,i)*pow(1-s,n-i);


} cout<<temp;
break;
case 3:
ans=combination(n,r)*pow(s,r)*pow(1-
s,n-r);
cout<<ans;
break;
}
}while(x==1||x==2||x==3);
}
7

• Point Estimation

#include<iostream> mean=(double)sumFX/sumF;
#include<stdlib.h> int a=(int)(0+n)/2;
#include<math.h> for(int i=0;i<n;i++)
using namespace std; u[i]=i-a;
class estimate double sumFU=0,sumFU2=0;
{ for(int i=0;i<n;i++)
int n; {
int lower[10],upper[10],u[10]; sumFU+=f[i]*u[i];
double mean,var,sd,c,sumF,sumFX; sumFU2+=f[i]*u[i]*u[i];
double x[10],f[10]; }
public: c=x[1]-x[0];
estimate(int n)
{ cout<<sumFU2<<"\t"<<sumFU<<"\t"<<sumFX<<en
this->n=n; dl;
sumF=0; var=(double)pow(c,2)*((sumFU2/sumF)-
} pow((sumFU/sumF),2));
void getValue() sd=(double)sqrt(var);
{ cout<<"\nMean::"<<mean<<endl;

cout<<"Enter lower limits\n"; cout<<"Variance::"<<var<<endl<<"SD::"<<sd<<endl;


for(int i=0;i<n;i++) }
cin>>lower[i]; };
cout<<"Enter upper limit\n"; int main()
for(int i=0;i<n;i++) {
cin>>upper[i]; cout<<"Enter number of classes\n";
cout<<"Enter frequency\n"; int n;
for(int i=0;i<n;i++) cin>>n;
cin>>f[i]; estimate obj(n);
for(int i=0;i<n;i++) obj.getValue();
{ }
x[i]=(double)(lower[i]+upper[i])/2;
}
calValues();
}
void calValues()
{
sumFX=0;
for(int i=0;i<n;i++)
{
sumF+=f[i];
sumFX+=f[i]*x[i];
}
8

• Checking for probability Distribution Function

#include<iostream> for(i=0;i<n;i++)
using namespace std; {
int main() if(y[i]<0)
{ {
float a,b,c; cout<<"The function cannot
int n; serve as Probability Distribution function!!";
cout<<"Enter the value of a,b,c for the exit(0);
function in the form ax^2+bx+c \n"; }
cout<<"Value of a: "; }
cin>>a; float sum=0;
cout<<"Value of b: "; for(i=0;i<n;i++)
cin>>b; {
cout<<"value of c: "; sum=sum+y[i];
cin>>c; }
cout<<"Enter the number of x values: ";
cin>>n; if(sum==1)
float x[n]; {
int i,j; cout<<"The function serves as
cout<<"Enter the values of x: \n"; Probability distribution function!!";
for(i=0;i<n;i++) }
{ else
cin>>x[i]; {
} cout<<"sum of all function is not
float y[n]; equal to 1"<<"---- i.e The sum is "<<sum<<endl;
for(i=0;i<n;i++) cout<<"The function cannot serve
{ as Probability Distribution function!!";
y[i]=(a*x[i]*x[i])+(b*x[i])+c; }
if(y[i]<0) return 0;
{ }
cout<<"f("<<x[i]<<")"<<" is
negative"<<endl;
}
}
9

• Least square method

#include<iostream> Sxx=x2-(((sumx)*(sumx))/n);
using namespace std; Sxy=xy-((sumx*sumy)/n);
Syy=y2-(((sumy)*(sumy))/n);
int main()
{ cout<<endl<<endl;
float x,y,z; cout<<"---------------------------------------";
int n,i; cout<<endl;
cout<<"Enter the value of n: "; cout<<"Sxx : "<<Sxx<<endl;
cin>>n; cout<<"Syy : "<<Syy<<endl;
float air[n],eva[n]; cout<<"Sxy : "<<Sxy<<endl;
cout<<endl; cout<<"---------------------------------------";
cout<<"Enter the values for Air cout<<endl;
Velocity: \n"; cout<<"Least Square Estimates are: ";
for(i=0;i<n;i++) float a,b;
{ b=Sxy/Sxx;
cin>>air[i]; a=(sumy/n)-(b*(sumx/n));
} cout<<"a="<<a<<endl;
cout<<endl; cout<<"b="<<b<<endl;
cout<<"Enter the values for cout<<"---------------------------------------";
Evaporation Co efficient: \n"; cout<<endl;
for(i=0;i<n;i++)
{ cout<<"Estimated Regression line: ";
cin>>eva[i]; cout<<"y^="<<a<<"+"<<b<<"x";
} cout<<endl;
cout<<"---------------------------------------";
float Syy=0,Sxx=0,Sxy=0; cout<<endl;

float sumx=0,sumy=0; cout<<"Residual sum of squares: ";


for(i=0;i<n;i++) float SEE=0,k;
{ SEE=Syy-((Sxy*Sxy)/Sxx);
sumx=sumx+air[i]; cout<<SEE<<endl;
sumy=sumy+eva[i]; cout<<"***************************************";
} return 0;
}
float x2=0,y2=0,xy=0;
for(i=0;i<n;i++)
{
x=air[i]*air[i];
x2=x2+x;
y=eva[i]*eva[i];
y2=y2+y;
z=air[i]*eva[i];
xy=xy+z;
}
10

• Standard Normal Distribution

#include<iostream> switch(x)
#include<math.h> {
#include<stdlib.h> case 1:
#define pi 3.1415926535 cout<<"Enter Z\n";
using namespace std; cin>>z1;
double cnd(double x) cout<<"F(Z)::"<<cnd(z1)<<endl;
{ break;
double l,k,w; case 2:
double const a1=0.31938153,a2=- cout<<"Enter Z\n";
0.3565633782,a3=1.781477937,a4=- cin>>z1;
1.821255978,a5=1.330274429; cout<<"F(Z)::"<<1-cnd(z1)<<endl;
l=fabs(x); break;
k=1.0/(1.0+0.2316419*l); case 3:
w=1.0-1.0/sqrt(2*pi)*exp(- cout<<"Enter Z1,Z2\n";
l*l/2)*(a1*k+a2*k*k+a3*pow(k,3) cin>>z1>>z2;
+a4*pow(k,4)+a5*pow(k,5)); if(z1>z2)
if(x<0) {
{ double temp=z1;
w=1.0-w; z1=z2;
} z2=temp;
return w; }
} cout<<"F(Z)::"<<cnd(z2)-cnd(z1)<<endl;
int main() break;
{ }
double z1,z2; }
cout<<"1:less than\n2:greater than\n3:between
the point\n";
int x;
cin>>x;
11

Result and Snapshots

• Binomial Distribution:

• Point Estimation :
12

• Checking for Probability Distribution Function:

• Least Square Method:


13

• Standard Normal Distribution:

**********

Vous aimerez peut-être aussi