diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /2294/CH12/EX12.20/EX12_20.sce | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '2294/CH12/EX12.20/EX12_20.sce')
-rwxr-xr-x | 2294/CH12/EX12.20/EX12_20.sce | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/2294/CH12/EX12.20/EX12_20.sce b/2294/CH12/EX12.20/EX12_20.sce new file mode 100755 index 000000000..49e3075a5 --- /dev/null +++ b/2294/CH12/EX12.20/EX12_20.sce @@ -0,0 +1,24 @@ +Xo=0;X1=1
+X=integrate('X*(X+0.5)','X',Xo,X1)
+disp(X,'E[X]=')
+Yo=0;Y1=1
+Y=integrate('Y*(Y+0.5)','Y',Yo,Y1)
+disp(Y,'E[Y]=')
+x=[0,0;1,1;1,0]
+y=[0,0;1,1;0,1]
+deff('z=f(x,y)','z=x*y*(x+y)')
+I=int2d(x,y,f)
+disp(I,'E[XY]=')
+disp(I-X*Y,'cov(X,Y)=E[XY]-E[X]E[Y]=');
+cov=I-X*Y
+Xo=0;X1=1
+X2=integrate('X^2*(X+0.5)','X',Xo,X1)
+disp(X2,'E[X^2]=')
+Yo=0;Y1=1
+Y2=integrate('Y^2*(Y+0.5)','Y',Yo,Y1)
+disp(Y2,'E[Y^2]=')
+disp(X2-X^2,'Variance of X=E[X^2]-E[X]^2)=')
+v1=X2-X^2
+disp(Y2-Y^2,'Variance of Y=E[Y^2]-E[Y]^2)=')
+v2=Y2-Y^2
+disp(cov/sqrt(v1*v2),'Correlation coefficient of X and Y=cov(X,Y)/(s.d of X*s.d of Y)=')
|