Simpson's and Weddle's Rule

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

r:::>OH~ !Page No.

Experiment No. __,;,'2-


_ _ _ Name :

------- -- '"Date I I

euul

-x,o )l ~
- - - ~

Teacher-s Signature:
------
- ':>0~1~ !Page No. "
Experiment No. Name: '"Date I I ~

---. T I l I I I I 1
'
• I
' ' ' T T T T I 1
' '
.•, .

h ..... I. '- '


~

--

- -~l~) d,<,:: 0 ..,.. t, t')


) -t ½ I,. \. 1 +\. + - - ) 4l. ~ 2 j \. ,. ... (.f &.f + _,.
)-·
'"'I \
6 ~ ~( ( - ( { . V l ( -J
')(,o
~

~vu, X,o ;:; CA.. ~ +-h ~-"' ~ 1<.+l-~ - _., ~"'-: b


- •
I
ILJ -:;
,...
.,_
l. ~ 1(,h ..-'Jlo -- 1,, °'
'l"l f)1
-
-
\J O ~ .
~ . ~ ~ \- ~ :: inA.t ~
l J
-.. 5wm
I (
( ~,
;il
-tl.2-t
(
-- ) & ocld -t~
r~'y ~\.1-1~ , --) , - SW°YY'- !/ ii_•~ Ao~
~ 1 ~
- 6CN-1nhi1. •;,
~~ \AU- ~~ ()_ ~ 1.. ~rJ b~3 ~d ~ ::.4
~ h~ 3-)
-- 1- -
- · -
J - o. _t:;
\ Li ~ 2,

"k. 0 'X,) ')(.. ,. X.a ,c., J.f


1 I. 5 J- :i .5 3
~lo \.. 1 l. 1,.- t.• ~ \... Lt
{
"
o.5 o,11 '
o.33 o.is
( t
0,1.5 s~ ~en'\ DbEM 1;~ ~
(.
I'\

,;;} "
) '111. - h -~ 0 .... ~ ( \.•' +~I 2)-. .\,- ~ ( ~ ,,"tr \.f 11 ~ ..
"'1 . ) ~)t 3 ~ { -£ \ - ' J
(' ~

- 0•5
...
I,
0,5 -t ~ I* O, J..t-+
"'
O, J-,8) -}, J-( fJ ,3 6), .J-
.....
I
o. l-5
J
1
3

-- C,.b85
AL Ulo~\T>4M :
1. ~
.2. Ln"' 111'\J, h, I'\~
1
l
1

tL ~
3. hi~ -ik A,W\l'tL t.e \u \!M'\t 011xoi'tA.
) ) l
' . • • I
' • I • I I I • . . . • • I I
• I I


Teacher-s Signature:
r:::>OHS lPage No.
Experiment No. _ _ _ _ Name: _ _ _ _ _ _ _ _ __ '"Date I I

10

\. S3
S3 ~ Sl 3 b
Tl f~ ~ V~ si
13 0
,~.
SIMPSON RULE

#include<iostrea m>
#include<math.h>
using namespace std;

/*DEFINE THE FUNCTION TO BE INTEGRATED HERE*/


double func(double x)
{
return x•x;
}
float sim3(float x,float y)
{
float w = 0,h,wl,w2,w3,n;
wl = func(y);
w2 = func(x);
w3 = func((x+y)/2);
h = (y-x)/2;
w = (h/3)*(wl+w2+4*w3);
return w;
}

int main()
{
float s3,a,b;
cout<<"\n Enter the initial limit : ";
cin>>a;
cout<<"\n Enter the final limit : ";
cin>>b;
s3=sim3(a,b);
cout<<"\n The integral of x•x from "<<a<<" to "<<b<<" is : "<<s3<<"\n"<<endl;
return O;
}
~I ·e:vuscrs\lANRJKA,~ '_ op\l X

Enter the initial limit : 0


Enter the final limit : 5
The integral o·F x•x from e ·to 5 is : Ill. 66,167

Process returned 0 (9x0) execution time : 5.538 s


P1·ess any ~ey to continue.
/:>OM~ jPage No. "

Experiment No, _ _ _ Name: _ _ _ _ _ _ __ , Date I I

~Mlt,).4
.
~
~ h, ~ 5.2 -l-J ~ o.i.
b
~ i., 11 .1. i..,, 11 J..} ,c, 4,g 5'.o 5, 2- )(..

J.3s,i l .1135\ )~L-J 8 b ) 15 lb ' 1.5(,8(, 1. b01~ } .bl..f87 -.

• 10 + 5((,(,0'1'1 t-Jt{,487
r:,Q~1~ jPage No.
Experiment No. _ _ _ Name: _ _ _ _ _ _ __ '"Date I I

LfuO~ T~M :
1.
,. b

wCo] 2(01

5.

t -z. CbJJ .
G. IIY\,

1.

\)~

K.
0
WEDDLE RULE

#include< iostrea m>


using namespace std;

float wed(float x,float y) //function deft nation


{
float w[7),z[7],h = O,k = O; //arrays('N,Z)

h = {y-x)/6;

w[O]=x;
z[O)=w[O]*w[O];
w[6]=y;
z[6]=w(6]•w[6];

for(int i=l;i<6;++i)
{
w[i]=w[i-l]+h;
z(i]=w[i]•w(i); //y=x" 2
}

k=3*h/10*(z[O)+S*z(l)+z[2)+6•z[3]+z[4]+5•z[S]+z(6));
return k;
}
int main()
{
float a,b,wedl;
cout<<"\n Enter the initial limit : ";
cin>>a;
cout<<"\n Enter the final limit : ";
cin>>b;
wedl=wed(a,b); //function invoking
11
cout<<"\n The integral of x•x from "<<a<<" to <<b<<" is: "<<wedl<<"\nn<<endl;
return O;
}

You might also like