SCILAB

You might also like

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

1 disp-

')
2 disp('Name: AARTI PARULKAR')
3 disp('Class: FE INFT-B')
4 disp( 'Roll no. 719')
5 disp('
')
6 11 Input
7 d e f f ' y = f ( x ) ' , 'y = = x^3 5*x +

3')
8
deff('y=df (x) ' 'y , 3*x^2 -

5')
9 XX=0;//previous root
10 x=1;// next root
11 i=0;
12 eps=0.0001;// permissible error
13 disp("Using Newton Raphson
method roots');
14 while(abs (x-Xx)>=eps)
15 z=x-(f(x)/df(x));
16 disp('iteration: '+string(i)+'
'+String (z));
17 xX=X;
18 x-Z
19 i=i+1;
20 end
21 dispRoot of the equation
using Newton- Raphson method is
x='+string(x)) ;
Name: AARTI PARULKAR
Class: FE INFT-B
Roll no. 719

Using Newton Raphson method


roots
iteration :0 0.5
iteration:1 0.6470588
iteration :2 0.6565728
iteration 3 0.6566204
Root of the equation using
Newton-Raphson method is
x=0.6566204
1 disp('
')
2
disp( Name:AARTI PARULKAR')
3 disp('Class: FE INFT-B')
4 disp(Roll no. 719'
5 disp('_
')
6 // Input
7 deff'[y]=f(x)' , 'y = xA3 9 * x
+1);
8 a-2;
9 b=3;
10 c 0 ; / / previous root
11 CC#1;//next root
12 i=0; / / iteration counter
13 eps=0.0001;//permissible error
14 disp( 'Using Regula Falsi method
following are iterations ');
15 while (abs(cc-C)>=eps)
16 x=(a*f(b)-b*f(a))/(f(b)-f(a));
17 if(f(a)*f(x)<0)
18 b-X;
19
elseif(f(b)*f (x) <0)
20 a-x
21 end
22 C=CC;
23 CC-X;
24 i=i+1;
25 disp(Iteration no.
'+string(i)+': '+String(x));
26 end
27 dispRoot of the equation is
X= '+String(cc));
Name:AARTI PARULKARR
Class: FE INFT-B
Roll no. 719

Using Regula Falsi method


following are iterationns
Iteration no. 1: 2.9
Iteration no. 2: 2.9415546
Iteration no. 3: 2.9427833
Iteration no. 4: 2.942819
Root of the equation is X
2.942819

You might also like