Anda di halaman 1dari 39

MADE BY

ROLL NUMBER

1) GOURANGA SARKAR

1) 000810301007

2) SANJOY CHANDRA MANDAL

2) 000810301013

3) BAPPA SAHA

3) 000810301018

4) KUNAL SINHA RAY

4) 000810301025

C0NTENTS
SET 1
SET 2
SET 3
SET 4
SET 5
SET 5
SET 6
SET 6
SET 7

PROBLEM NO.3
PROBLEM NO.7
PROBLEM NO.3
PROBLEM NO.3
PROBLEM NO.3
PROBLEM NO.9
PROBLEM NO.3
PROBLEM NO.9
PROBLEM NO.1

GROUP NO.3
CLASS: B.CH.E 2nd YEAR

SECTION: A - 1

SET 1 PROBLEM NO.3


TITLE: WRITE A PROGRAM TO FIND SUM OF THE FOLLOWING INFINITE SERIES
CORRECT TO THE FIFTH DECIMAL PLACES.
1+(1/2!)+(1/3!)+(1/4!)+(1/5!)+.
ALGORITHM:
Step 1: start algorithm.
Step 2: declare integer type variables a ,x ,float term=1,float sum=0. Initialize x with zero.

Step 3: clear the output screen.


Step 4: print the value of a.
Step 5: repeat step6 and step7 when a>0.

Step 6: term=term/x.
Step 7: sum=sum+term,x++, a--.

Step 8: print the sum.


Step 9: in the output and go to the next.

Step 10: end the algorithm.

PROGRAM:
// program to calculate sum of series //
# include<stdio.h>
# include<conio.h>
# include<math.h>
# define eps 1.0e-05
void main(void)
{
int a;
int x=1;
float term=1;
float sum=0;
clrscr();
printf("\n\n\n enter the value of term at which term sum will be needed a:");
scanf("%d" ,&a);
} while(a>0)
{
term=term/x;
sum=sum+term;
x++;
a--;
}
printf("\n\n\n sum of series upto following term is =%f",sum);
getch();
}

SAMPLE INPUT:

Enter the value of a

1) 2
2) 3
3) 4
4) 5
5) 6

SAMPLE OUTPUT: Sum of series of corresponding value of a.


1) 1.5000000
2) 1.6666667

3) 1.7083334
4) 1.7166667

5) 1.7180556
.

REMARKS: From this program we can easily calcute the sum of this series for upto various
terms.

SET 2 PROGRAM NO.7


TITLE:CALCULATE THE SPCIFIC VOLUME OF CHLORINE AT T=460K AND
P=15atm USING VANDER-WAALS EQUATION OF STATE USING BISECTION
TECHNIQUE.
P={RT/(v-b)} { a/(v*v)}
a=27(R*R)*(T_c*T_c)/64P_c, b=RT_c/8P_c.
TAKE THE IDEAL GAS VOLUME AS THE INITIAL GUESS,P_c=76atm, T_c=417K

ALGORITHM:
Step 1: define the equestion f(x)=0.
Step 2: read the diserid accuracy say,epsilon(e) & maxit.
Step 3: do
{ Enter the initial approximation say, a & b.
} while(f(a)*f(b)>0);
Step 4: k < - 0.
Step 5: do
{ x < - (a+b)/2
if(f(a)*f(b)<0), b < - x
else
a < - x, k+=1;
} while (fabs(b-a)>e & k < maxit);
Step 6: if (k<maxit)
Root < - x, No. of iteration < - k.
else
iteration does not converge.
Step 7: end the algorithm.

PROGRAM:
//program for bisection method//
#include <stdio.h>
#include<conio.h>
#include <math.h>
main()
{
float f(float);
float x0,x1,x2,f0,f1,f2,R=0.0821,T=417,P=76;
int i=1,j;
printf("\n the volume of ideal gas is =%f",(R*T)/8*P);
printf("Give the guess values x0,x1 (x0<x1)\n");
scanf("%f%f", &x0, &x1);
f0=f(x0);
f1=f(x1);
if((f0/f1)>0)
printf("Guess values unsuitable");
if((f0/f1)<0)
{
printf("Upto which decimal point you want the root?\n");
scanf("%d",&j);
while((x1-x0)>pow(10,(-1*j)))
{
x2=(x0+x1)/2.0;
f2=f(x2);

printf("%d %f %f %f %f %f %f\n",i,x0,x1,x2,f0,f1,f2);
if((f2/f0)>0)
{
x0=x2;
f0=f2;
}
else
{
x1=x2;
f1=f2;
}
i++;
}
}
printf("\n\nThe root of the eqn converges to %f.",x2);
}
float f(float x)
{
float f;
f=(pow(x,3)-0.257*x*x+0.43*x-0.024);
return(f);

SAMPLE

INPUT

the volume of ideal gas =325.239136


the gauss value is X0 , X1 ( X0 < X1 )
-0.5
1
Upto which decimal point you want to the root?

0.0001
SAMPLE

OUTPUT

1
2

REMARKS

-0.500000
-0.500000

1.000000
0.250000

0.250000

-0.428250

-0.125000

-0.428250

22

-0.500000

-0.499999

23

-0.500000

-0.500000

-0.500000

1.149000
0.000000

-0.428250

0.000000

-0.500000 -0.428250

0.000000

the equestion converges to "-0.500000"

SET 3 PROBLEM NO.3


TITLE: SOLVE THE FOLLOWING EQUESTION USING GAUSS-SIEDEL TECHNIQUE.
10*X1 X2 + 2*X3 =4
X1 + 10*X2 X3 =3
2*X1 + 3*X2 + 20*X3 =7

ALGORITHM:

Step 1: start the algorithm.


Step 2: sum < - 0.0
Step 3: read the desired accuracy say epsilone (e) & maxit.
Step 4: read the number of equestions.
Step 5: read the right handside constant ( b[][]).
Step 6: read the co-efficient matrix row wise ( a[][]).
Step 7: for i < - 1 to n.
X[i] < - 0.0
Repeat
Step 8: for i < - 1 to n.
for j < - 1 to n.
for k < - 1 to maxit
if( j!=1)
sum=sum + a[i][j]*X[j]
Previous x[i] < - X[i]
X[i] < - ( b[i] (sum) )/ a[i] [j]
Step 9: write i , x[i]
Step 10: fabs ( x[i]- prex[i])<e)
write the solution i,x[i]
Step 11: end the algorithm.

PROGRAM:
// program for gauss-siedel method //
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define n 3
void main ( )
{
int i,j,p,k,maxit;
float x[n],a[n][n],sum=0,px[n],e=pow(e,-0.5),b[n];
clrscr( );
printf("\n enter the number of equations say n:");
scanf("%d",&p);
printf("\enter the maximum iteration number say maxit:");
scanf("%d", & maxit);
printf("\n enter the right hand side constant say b:");
for(i=0;i<n;i++)
{
printf("\n b[%d]=\t",b[i]);
scanf("%f",&b[i]);
}
printf("\n enter the coefficient matrix(row wise)say a[][]:");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("\n a[%d][%d]=\t",i,j);
scanf("%f",&a[i][j]);
}
}
for(i=0;i<n;i++)
{
x[i]=0.0;
}

for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(j!=i){
sum=sum+a[i][j]*x[j];}
}
}
for(i=0;i<n;i++)
{
for(k=0;k<maxit;k++)
{
px[i]=x[i];
x[i]=(b[i]-(sum))/a[i][i];
if(fabs(x[i]-px[i])<e)
printf("\n the solution x[%d]=%f",i,x[i]);
}
}
getch();
}

SAMPLE

INPUT : enter the number of equestion ,say n : 3


enter the maximum iteration number say maxit :50

enter the right hand side constant, say b :


b[ 0 ] =

b[ 0 ] =

b[ 0 ] =

enter the coefficient matrix (raw wise),say a[ ][ ] :

CORRESPONDING

a[ 0 ][ 0 ]

10

a[ 0 ][ 1 ]

-1

a[ 0 ][ 2 ]

a[ 1 ][ 0 ]

a[ 1 ][ 1 ]

10

a[ 1 ][ 2 ]

-1

a[ 2 ][ 0 ]

a[ 2 ][ 1 ]

a[ 2 ][ 2 ]

20

SAMPLE

OUTPUT :

the solution x[ 0 ]

0.400000

the solution x[ 1 ]

0.300000

the solution x[ 2 ]

= 0.350000

REMARKS: this approximate value is very close to the actual mathematical value.

SET 4 PROBLEM NO.3


TITLE: USE LAGRANGIAN FORMULA FOR POLYNOMIAL APPROXIMATION AND
SIMPSOMS RULE TO EVALUTE THE INTEGRAL .

ALGORITHM:

Step 1: start the algorithm.


Step 2: define function f(x).
Step 3: read the values a(lower limit) , b(upper limit) & n(no. of strips).
Step 4: h < - (b-a)/n
Step 5: ends < - f(a) + f(b)
Step 6: k < - 1
sum 1< - 0.0
sum 2< - 0.0
do
{
If (k%2==0)
sum 1+=f(a+k*h)
else if (k%2==1)
sum 2+=f(a+k*h)
k< - k+1
}while (K<n)
Step 7: I < - 99(h/3)*(ends+ 4*sum1 + 2*sum2)
Step 8: display I as the required integral
Step 9: end the algorithm.

PROGRAM:
// program for lagrangian formula //
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float x[50],y[50],sum=0.0,product,z;
int n,i,j,k,X,Y;
clrscr();
printf("\n enter the total terms:");
scanf("%d",&x);
printf("\n \t\t--:enter the table:--");
printf("\n X:");
scanf("%d",&X);
printf("\n Y:");
scanf("%d",&Y);
for(i=0;i<n;i++)
scanf("%f",&x[i]);

for(i=0;i<n;i++)
scanf("\n%f",&y[i]);
printf("\n enter the point at which you want to interpolate:");
scanf("%f",&z);

for(k=0;k<n;k++);
{
product=1.0;
for(j=0;j<n;j++)
{
if(j!=k)
{
product=product*((z-x[i])/(x[k]-x[j]));
}
}
sum=sum+(y[k]*product);
printf("\n \t sum=%f",sum);
}
printf("\n interpolation at(x=%f)=%y",z,sum);
getch();
}

SAMPLE INPUT:
enter the total terms :
--:enter the table
x:
y:
enter the point at which you want to inter polate:

SAMPLE OUTPUT:
sum=
interpolation at (x=)=

PROGRAM:
// program for simson's rule//
#include<stdio.h>
#include<conio.h>
#include<math.h>

#define f(x) ((((x-1)*(x-2)*(x-4)*(x-5)*(x-6))/((0-1)*(0-2)*(0-4)*(0-5)*(0-6))*1)+(((x-0)*(x2)*(x-4)*(x-5)*(x-6))/((1-0)*(1-2)*(1-4)*(1-5)*(1-6))*15)+(((x-0)*(x-1)*(x-4)*(x-5)*(x6))/((2-0)*(2-1)*(2-4)*(2-5)*(2-6))*14)+(((x-0)*(x-2)*(x-5)*(x-1)*(x-6))/((4-0)*(4-1)*(45)*(4-6)*(4-2))*5)+(((x-0)*(x-2)*(x-4)*(x-6)*(x-1))/((5-0)*(5-1)*(5-2)*(5-4)*(56))*6)+(((x-0)*(x-2)*(x-1)*(x-4)*(x-6))/((6-0)*(6-1)*(6-2)*(6-4)*(6-5))*19))


void main()
{
float a,b,h,sum1,sum2,ends,i;
int j,n;
clrscr();
printf("\n enter the limits of integration:");
printf("\n lower limit (a)=\t");
scanf("%f",&a);
printf("\n uppar limit(b)=\t");
scanf("%f",&b);
printf("\n enter the no. of subinterval:\n by which the interval[a,b]to be
devided :\n");
scanf("%d",&n);
if(n%2==0)
{
h=(b-a)/(float)n;
ends=f(a)+f(b);
sum1=0.0;
sum2=0.0;
for(j=1;j<n;j++)
{
if(j%2==0)
sum1+=f(a+j*h);

else
sum2+=f(a+j*h);
}
i=(h/3)*(ends+(4*sum2)+(2*sum1));
printf("\n required integral(i)=%f",i);
}
else
{
printf("\n no need for calculations");
}
getch();
}

SAMPLE INPUT:
Enter the limits of integration :
Lower limit (a) = 0
Upper limit (b) = 6
Enter the no.of subinterval by which the interval [a,b] to be devided: 2

SAMPLE OUTPUT:
Required integral (i) =38.700001

REMARKS: the numerical value is approximately equal to the mathematical


value.

SET 5 PROGRAM NO.3


TITLE: THE EMPIRICAL EQUESTION FOR THE WORLDS POPULATION ,y AS A
FUNCTION OF TIME IS GIVEN BY
(1) dy/dt=4.25713*pow(10,-12)*pow(y,2010101) ,y0= pow(10,9)
THE BASE YEAR IS 1840 AD. OBTAIN THE WORLD POPULATION AT
DIFFERENT YEARS HENCEFORTH.
(2) Dy/dt= -200[y F(t)] + dF(t)/dt ; y0=10
F(t)=10 (10 + t)*pow(e,-t)
THE ANALYTIC SOLUTION IS
y= 10- (10 + t)*pow(e,-t) + 10*exp( -200t)
USING RANGA-KUTTA(4th ORDER).

ALGORITHM:
Step 1: Difine f(t,y) [=RHS of ODE dy/dx= f(t,y)
Step 2: Read t0,y0,h [initial value of t,y & step size h no of t]
Step 3: Read tp [value of t at which y required]
Step 4: n=( tp-t)/h + 0.5 [n= number of step size]
Step 5: For I < - 1 to n
Step 6: K1 < - f(t0,y0)
Step 7: K2 < - f(t0 +1/2*h, y0 + 1/2*K1*h)
Step 8: K3 < - f(t0 +1/2*h, y0 + 1/2*K2*h)
Step 9: K4 < - f(t0 + 1/2*h,y0 +1/2* K3*h)
Step 10: t0 < - t0 + h
Step 11: K < - h/6*(K1 + 2*K2 + 2*K3 + 1/2*K3*h)
Step 12: yi < - yi + K
Step 13: Write I,ti,yi
Step 14: next i /(repeat)
Step 15: end the algorithm.

PROGRAM (1);
//program for range kutta//
#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int i,n;
float p,t,y,xp,h,m11,m12,m21,m22,m13,m23,m14,m24;
float func(float,float,float);
printf("enter the base year and pop.\n");
scanf("%f%f",&t,&y);
printf("\n enter the year at which pop. req.:");
scanf("%f",&xp);
printf("\n enter the step size,h:");
scanf("%f",&h);
n=(int)((xp-t)/h+0.5);
for(i=1;i<=n;i++)
{
m11=func(p,t,y);
m21=func(p,t,y);
m12=func(p+0.5*h,t+0.5*m11,y+0.5*m21);
m22=func(p+0.5*h,t+0.5*m11,y+0.5*m21);
m13=func(p+0.5*h,t+0.5*m12,y+0.5*m22);

m23=func(p+0.5*h,t+0.5*m12,y+0.5*m22);
m14=func(p+h,t+m13,y+m23);
m24=func(p+h,t+m13,y+m23);
t=t+(m11+2.0*m12+2.0*m13+m14)/6.0;
y=y+(m21+2.0*m22+2.0*m23+m24)/6.0;

printf("%5d%15.6f%15.6f\n",i,t,y);
}
printf("\n value of pop.at req. year=%f is %f\n ",t,y);
}
float func(float p,float t,float y)
{
float f;
f=(4.25713*pow(10,-12)*pow(y,2.010101));
return(f);
}

SAMPLE

INPUT

ENTER THE BASE YEAR AND POPULATION 1840


0.2
ENTER THE YEARAT WHICH POPULATION REQUIRED

1841

ENTER THE STEP SIZE , h = 0.02


CORRESPONDING

SAMPLE

OUTPUT
1

REMARKS

:
1840.000000

0.200000

VALUE OF POPULATION AT REQUIRED YEAR = 1840 IS 0.200000

PROGRAM (2):
//program for range kutta//
#include<stdio.h>
#include<conio.h>
#include<math.h>

main()
{
int i,n;
float t,y,xp,h,m1,m2,m3,m4;
float func(float,float);
printf("enter the base year and pop.\n");
scanf("%f%f",&t,&y);
printf("\n enter the year at which pop. req.:");
scanf("%f",&xp);
printf("\n enter the step size,h:");
scanf("%f",&h);
n=(int)((xp-t)/h+0.5);
for(i=1;i<=n;i++)

{
m1=func(t,y);
m2=func(t+0.5*h,y+0.5*m1*h);
m3=func(t+0.5*h,y+0.5*m2*h);

m4=func(t+h,y+m3*h);
t=t+h;
y=y+(m1+2.0*m2+2.0*m3+m4)*h/6.0;
printf("%5d%15.6f%15.6f\n",i,t,y);
}
printf("\n value of pop.at req. year=%f is %f\n ",t,y);
}
float func(float t,float y)
{
float f;
f=(4.25713*pow(10,-12)*pow(y,2.010101));
return(f);
}

SAMPLE

INPUT

:
ENTER THE BASE YEAR AND POPULATION 1840
0.2

ENTER THE YEARAT WHICH POPULATION REQUIRED

1841

ENTER THE STEP SIZE , h = 0.02


CORRESPONDING

SAMPLE

OUTPUT
1

REMARKS

:
1840.000000

0.200000

VALUE OF POPULATION AT REQUIRED YEAR = 1840 IS 0.200000

SET 6 PROBLEM NO.3


TITLE: (1)COMPUTE THE NUMERICAL SOLUTION OVER THE INTERVEL [0,2]. USING
4TH ORDER RANGA KUTTA METHOD.
dy1/dt= -0.2*y1 + 0.2*y2
dy2/dt= 10*y1 (60+0.125*t)*y2 + 0.124*t ,[y0]=[0,0]T
(2)COMPUTE THE NUMERICAL SOLUTION, USING 4TH ORDER RANGA KUTTA.
dy1/dt= 1.3*(y2-y1) + 1.04*x*10^4ky2
dy2/dt= 1.88*x*10^3*[y4-(1+k)]
dy3/dt= 1752 + 266.1y2 - 269.3*y3
dy4/dt= 0.1 + 320y2 321*y4
k= 6*x*10^-3exp[20.7 - 15*x*10^3/y1]
[y0]= [759.167,0,600,0.1]^T
ALGORITHM:

Step 1: Difine f(t,y) [=RHS of ODE dy/dx= f(t,y)


Step 2: Read t0,y0,h [initial value of t,y & step size h no of t]
Step 3: Read tp [value of t at which y required]
Step 4: n=( tp-t)/h + 0.5 [n= number of step size]
Step 5: For I < - 1 to n
Step 6: K1 < - f(t0,y0)
Step 7: K2 < - f(t0 +1/2*h, y0 + 1/2*K1*h)
Step 8: K3 < - f(t0 +1/2*h, y0 + 1/2*K2*h)
Step 9: K4 < - f(t0 + 1/2*h,y0 +1/2* K3*h)
Step 10: t0 < - t0 + h
Step 11: K < - h/6*(K1 + 2*K2 + 2*K3 + 1/2*K3*h)
Step 12: yi < - yi + K
Step 13: Write I,ti,yi
Step 14: next i /(repeat)
Step 15: end the algorithm.

PROGRAM (1):
//program for 4th order ranga kutta//
#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int i,n;
float t,y1,y2,xp,h,m11,m12,m21,m22,m13,m23,m14,m24;
float func1(float,float,float);
float func2(float,float,float);
printf("enter the initial values of t,y1,y2 \n");
scanf("%f%f%f",&t,&y1,&y2);
printf("\n enter the time at which y1 and y2 are req.:");
scanf("%f",&xp);
printf("\n enter the step size,h:");
scanf("%f",&h);
n=(int)((xp-t)/h+0.5);
for(i=1;i<=n;i++)
{
m11=h*func1(t,y1,y2);
m21=h*func2(t,y1,y2);
m12=h*func1(t+0.5*h,y1+0.5*m11,y2+0.5*m21);
m22=h*func2(t+0.5*h,y1+0.5*m11,y2+0.5*m21);

m13=h*func1(t+0.5*h,y1+0.5*m12,y2+0.5*m22);
m23=h*func2(t+0.5*h,y1+0.5*m12,y2+0.5*m22);
m14=h*func1(t+h,y1+m13,y2+m23);
m24=h*func2(t+h,y1+m13,y2+m23);
t=t+h;
y1=y1+(m11+2.0*m12+2.0*m13+m14)/6.0;
y2=y2+(m21+2.0*m22+2.0*m23+m24)/6.0;

printf("%5d%15.6f%15.6f%15.6f\n",i,t,y1,y2);
}
printf("\n values of y1 and y2 at t=%f is %f and %f",t,y1,y2);
}
float func1(float t,float y1,float y2)
{
float f1;
f1=(-0.2*y1+0.2*y2);
return(f1);
}
float func2(float t,float y1, float y2)
{
float f2;
f2=(10.0*y1-(60.0+0.125*t)*y2+0.124*t);
return(f2);
}

SAMPLE INPUT :
ENTER THE INITIAL VALUES OF t , y1 , y2
0
0
0
ENTER THE TIME AT WHICH Y1 AND Y2 ARE REQUIRED :2

ENTER THE STEP SIZE ,h :0.001

CORRESPONDING SAMPLE OUTPUT

VALUES OF y1 AND y2 AT
0.000728
AND

0.004201

t = 2.000037

IS

PROGRAM (2):
//program for 4th order multidimentional range kutta//
#include<stdio.h>
#include<conio.h>
#include<math.h>

main()
{
int i,n;
float
t,y1,y2,y3,y4,xp,h,m11,m12,m21,m22,m13,m23,m14,m24,m31,m32,m33,m34,m41,m42,m43,
m44;
float func1(float,float,float,float,float);
float func2(float,float,float,float,float);
float func3(float,float,float,float,float);
float func4(float,float,float,float,float);

printf("enter the initial values of t,y1,y2,y3,y4 \n");


scanf("%f%f%f%f%f",&t,&y1,&y2,&y3,&y4);
printf("\n enter the time at which y1,y2,y3 and y4 are req.:");
scanf("%f",&xp);
printf("\n enter the step size,h:");
scanf("%f",&h);
n=(int)((xp-t)/h+0.5);

for(i=1;i<=n;i++)

{
m11=h*func1(t,y1,y2,y3,y4);
m21=h*func2(t,y1,y2,y3,y4);
m31=h*func3(t,y1,y2,y3,y4);
m41=h*func4(t,y1,y2,y3,y4);
m12=h*func1(t+0.5*h,y1+0.5*m11,y2+0.5*m21,y3+0.5*m31,y4+0.5*m41);
m22=h*func2(t+0.5*h,y1+0.5*m11,y2+0.5*m21,y3+0.5*m31,y4+0.5*m41);
m32=h*func3(t+0.5*h,y1+0.5*m11,y2+0.5*m21,y3+0.5*m31,y4+0.5*m41);
m42=h*func4(t+0.5*h,y1+0.5*m11,y2+0.5*m21,y3+0.5*m31,y4+0.5*m41);
m13=h*func1(t+0.5*h,y1+0.5*m12,y2+0.5*m22,y3+0.5*m32,y4+0.5*m42);
m23=h*func2(t+0.5*h,y1+0.5*m12,y2+0.5*m22,y3+0.5*m32,y4+0.5*m42);
m33=h*func3(t+0.5*h,y1+0.5*m12,y2+0.5*m22,y3+0.5*m32,y4+0.5*m42);
m43=h*func4(t+0.5*h,y1+0.5*m12,y2+0.5*m22,y3+0.5*m32,y4+0.5*m42);
m14=h*func1(t+h,y1+m13,y2+m23,y3+m33,y4+m43);
m24=h*func2(t+h,y1+m13,y2+m23,y3+m33,y4+m43);
m34=h*func3(t+h,y1+m13,y2+m23,y3+m33,y4+m43);
m44=h*func4(t+h,y1+m13,y2+m23,y3+m33,y4+m43);
t=t+h;
y1=y1+(m11+2.0*m12+2.0*m13+m14)/6.0;
y2=y2+(m21+2.0*m22+2.0*m23+m24)/6.0;
y3=y3+(m31+2.0*m32+2.0*m33+m34)/6.0;
y4=y4+(m41+0.2*m42+2.0*m43+m44)/6.0;

printf("%5d%15.6f%15.6f%15.6f%15.6f%15.6f\n",i,t,y1,y2,y3,y4);
}
printf("\n values of y1,y2,y3 and y4 at t=%f are %f,%f,%f and %f",t,y1,y2,y3,y4);
}
float func1(float t,float y1,float y2,float y3,float y4)
{
float f1;
f1=1.3*(y2-y1)+1.04*pow(10,4)*(6*pow(10,-4)*pow(2.73,(20.7(15*pow(10,3))/y1)))*y2;
return(f1);
}
float func2(float t,float y1, float y2,float y3,float y4)
{
float f2;
f2=1.88*pow(10,3)*(y4-(1.0+(6*pow(10,-4)*pow(2.73,(20.7-(15*pow(10,3))/y1)))));
return(f2);
}
float func3(float t,float y1,float y2,float y3,float y4)
{
float f3;
f3=(1752+266.1*y2-269.3*y3);
return(f3);
}

float func4(float t,float y1,float y2,float y3,float y4)


{
float f4;
f4=(0.1+320*y3-321.0*y4);
return(f4);
}

SAMPLE INPUT

ENTER THE INITIAL VALUES OF t , y1 , y2


0
0
0
ENTER THE TIME AT WHICH Y1 AND Y2 ARE REQUIRED :2

ENTER THE STEP SIZE ,h :0.001

CORRESPONDING SAMPLE OUTPUT

VALUES OF y1 AND y2 AT
IS

0.000728
AND

0.004201

t =

2.000037

SET 7 PROBLEM NO.1


TITLE:MULTIDIMENSIONAL NEWTON RAPSONS METHOD.
#include<stdio.h>
#include<conio.h>

#include <math.h>
#define f(x,y) (x*x+x*y+y*y-7)
#define g(x,y) (pow(x,3)+pow(y,3)-9)
main()
{
int i,j,k,n;
double x_0=1.5,y_0=0.5,det_J,b[2][1],a[2][1],x[2][1];
b[0][0]=x_0;
b[1][0]=y_0;
x[0][0]=x_0;
x[1][0]=y_0;

for(k=0;k<10;k++)
{
a[0][0]=((3*x[1][0]*x[1][0])*((x[0][0]*x[0][0])+(x[0][0]*x[1][0])+(x[1][0]*x[1][0])-7))+(((x[0][0]+2*x[1][0]))*(pow(x[0][0],3)+pow(x[1][0],3)-9));
a[1][0]=(-3*x[0][0]*x[0][0])*((x[0][0]*x[0][0])+(x[0][0]*x[1][0])+(x[1][0]*x[1][0])7)+((2*x[0][0]+x[1][0])*(pow(x[0][0],3)+pow(x[1][0],3)-9));
det_J=((3*x[1][0]*x[1][0])*(2*x[0][0]+x[1][0]))-((3*x[0][0]*x[0][0])*(x[0][0]+2*x[1][0]));

x[0][0]=b[0][0]-(a[0][0]/det_J);
x[1][0]=b[1][0]-(a[1][0]/det_J);
printf("\nFor the %d iteration current value: %f %f",k+1,x[0][0],x[1][0]);
b[0][0]=x[0][0];
b[1][0]=x[1][0];

getch();
return 0;
}

SAMPLE OUTPUT:
for the 1 iteration current value:2.267544 0.925439

for the 1 iteration current value:2.037271 0.964470

for the 1 iteration current value:2.001258 0.998737

for the 1 iteration current value:2.000002 0.999998

for the 1 iteration current value:2.000000 1.000000

for the 1 iteration current value:2.000000 1.000000