00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 Vector A(361);
00063 Vector A1(361);
00064 Numeric X;
00065 Numeric llim=0.;
00066 Numeric ulim=180.;
00067 Numeric N=40;
00068 Numeric h=(ulim-llim)/N;
00069 cout<<"Lower Limit :" << llim <<"\n" ;
00070 cout<<"Upper Limit :" << ulim <<"\n" ;
00071 cout<<"Number of points :" << N <<"\n" ;
00072 cout<<"Step length :" << h <<"\n" ;
00073 for (Numeric theta=0;theta<ulim+1;theta=theta+1)
00074 {
00075 A[theta]=sin(theta*DEG2RAD);
00076
00077 A1[theta]=DEG2RAD*A[theta];
00078
00079 }
00080 single_trapez(X,A1,llim,ulim,h);
00081 cout << "Integral of the Expression "<< " " <<X<<"\n" ;
00082
00083
00084
00085 Matrix B(181,361);
00086 Matrix B1(181,361);
00087
00088
00089
00090 Numeric Y2;
00091
00092 Numeric llim2=0;
00093 Numeric ulim2=180;
00094 Numeric llim1=0.;
00095 Numeric ulim1=180;
00096 Numeric N1=180;
00097 Numeric h1=(ulim1-llim1)/N1;
00098 Numeric N2=180;
00099 Numeric h2=(ulim2-llim2)/N2;
00100 cout<<"Number of points inner integral :" << N1 <<"\n" ;
00101 cout<<"Step length - inner integral:" << h1 <<"\n" ;
00102 cout<<"Number of points outer integral:" << N2 <<"\n" ;
00103 cout<<"Step length - outer integral:" << h2 <<"\n" ;
00104 for (Numeric i=llim2;i<ulim2+1;i=i+1)
00105 {
00106 for (Numeric j=llim1;j<ulim1+1;j=j+1)
00107 {
00108 B(i,j)=sin(j*DEG2RAD);
00109 B1(i,j)=DEG2RAD*B(i,j);
00110
00111 }
00112 }
00113 double_trapez(Y2,B1,llim1,llim2,ulim1,ulim2,h1,h2);
00114 cout << " Double Integral of the Expression "<< " " <<Y2<<"\n" ;
00115
00116
00117
00118 Matrix C(181,361);
00119 Vector CC1(181);
00120 Numeric CCC,CC;
00121 for (Numeric i=llim2;i<ulim2+1;i=i+1)
00122 {
00123 for (Numeric j=llim1;j<ulim1+1;j=j+1)
00124 {
00125 C(i,j)=sin(j*DEG2RAD);
00126 }
00127 }
00128 for (Numeric i=llim2;i<ulim2+1;i=i+1)
00129 {
00130 Vector C1=C(i,Range(joker));
00131 C1 *= DEG2RAD;
00132
00133 single_trapez(CC,C1,llim1,ulim1,h1);
00134 CC1[i]=CC;
00135 }
00136
00137 single_trapez(CCC,CC1,llim2,ulim2,h2);
00138 cout << " Double Integral of the Expression through successive single integrations "<< " " <<CCC<<"\n";
00139 return 0;
00140 }