16 views

Uploaded by vipulgupta2012

- GSM AFP Planet v53 Sep2011
- Numerical Analysis Chap 1
- Tut4Soln
- Ecenumel Project Gui
- Front Matter
- Hard work by Natansh(Bhund)
- 19690021375
- !EulerIntro
- Lecture 04
- Lecture 14
- Calicuit Sem 3
- Gaussian Elimination and Lu Decomposition
- Numerical Methods
- Roots of Equations
- Chapter 1
- New Microsoft Word Document (3)
- Numerical Continuation Method
- MA2266
- AIAA-2009-4140.pdf
- Polynomial Approximation of Functions of Matrices

You are on page 1of 7

VIPUL GUPTA

2k8/EE/889

#include<iostream.h>

#include<conio.h>

#include<math.h>

void main()

{clrscr();

float a[5][5],b[5][5];

float x,y,z;

int i,j,p,q,r;

int max=0;

int n[4];

cout<<"enter coefficients of equation ax+by+cz=d \n";

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

{

cout<<"\nenter coefficients of "<< i <<"equation\n";

for(j=1;j<5;j++)

{ cin>>a[i][j];

// cout<<"\t";

}

cout<<"\n";

}

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

{ max=0;

for(j=1;j<4;j++)

{if (a[i][j]>max)

{max=a[i][j];

n[i]=j;

}

}

cout<<" max term in "<< i<<" equation is "<<max<<" at the position "<<n[i]<<"\n" ;

}

y=z=0;

for(int m=0;m<2000;m++)

{

for ( p=1;p<4;p++)

{ if(n[p]==1)

{ x=((a[p][4]-(z*a[p][3])-(y*a[p][2]))/a[p][1]);

for ( q=1;q<4;q++)

{ if(n[q]==2)

{

y=((a[q][4]-(x*a[q][1])-(z*a[q][3]))/a[q][2]);

for ( r=1;r<4;r++)

{ if(n[r]==3)

{

z=((a[r][4]-(x*a[r][1])-(y*a[r][2]))/a[r][3]);

}}}}}}}

cout<<"\n value of x : "<<x;

cout<<"\n value of y : "<<y;

cout<<"\n value of z :"<<z;

getch();

}

OUTPUT:

19/4/2011

5. EULERs METHOD

// A First Order differential dy/dx=1+xy2 0x1 and y(0)=1

#include<iostream>

#include<conio.h>

#include<cmath>

using namespace std;

float fdash(float x,float y)

{

float temp;

temp= 1+x*y*y;

return temp;

}

int main()

{

float x=0,h;

float y[60];

int i;

h=0.02;

y[0]=1;

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

{

y[i]=y[i-1]+fdash(x,y[i-1])*h;

x=x+h;

cout<<" Value of F(x,y) at "<<x<<" is "<<y[i]<<endl;

}

system("pause");

}

OUTPUT

Value of F(x,y) at 0.02 is 1.02

Value of F(x,y) at 0.04 is 1.04042

Value of F(x,y) at 0.06 is 1.06128

Value of F(x,y) at 0.08 is 1.08263

Value of F(x,y) at 0.1 is 1.10451

Value of F(x,y) at 0.12 is 1.12695

Value of F(x,y) at 0.14 is 1.15

Value of F(x,y) at 0.16 is 1.1737

Value of F(x,y) at 0.18 is 1.19811

Value of F(x,y) at 0.2 is 1.22328

Value of F(x,y) at 0.22 is 1.24926

Value of F(x,y) at 0.24 is 1.27613

Value of F(x,y) at 0.26 is 1.30395

Value of F(x,y) at 0.28 is 1.33279

Value of F(x,y) at 0.3 is 1.36273

VIPUL GUPTA

2k8/EE/889

Value of F(x,y) at 0.34 is 1.42631

Value of F(x,y) at 0.36 is 1.46014

Value of F(x,y) at 0.38 is 1.49549

Value of F(x,y) at 0.4 is 1.53249

Value of F(x,y) at 0.42 is 1.57128

Value of F(x,y) at 0.44 is 1.61202

Value of F(x,y) at 0.46 is 1.65489

Value of F(x,y) at 0.48 is 1.70008

Value of F(x,y) at 0.5 is 1.74783

Value of F(x,y) at 0.52 is 1.79838

Value of F(x,y) at 0.54 is 1.85201

Value of F(x,y) at 0.56 is 1.90906

Value of F(x,y) at 0.58 is 1.96988

Value of F(x,y) at 0.6 is 2.03489

Value of F(x,y) at 0.62 is 2.10458

Value of F(x,y) at 0.64 is 2.1795

Value of F(x,y) at 0.66 is 2.2603

Value of F(x,y) at 0.68 is 2.34774

Value of F(x,y) at 0.7 is 2.4427

Value of F(x,y) at 0.72 is 2.54624

Value of F(x,y) at 0.74 is 2.6596

Value of F(x,y) at 0.76 is 2.78429

Value of F(x,y) at 0.78 is 2.92212

Value of F(x,y) at 0.8 is 3.07532

Value of F(x,y) at 0.82 is 3.24665

Value of F(x,y) at 0.84 is 3.43951

Value of F(x,y) at 0.86 is 3.65826

Value of F(x,y) at 0.88 is 3.90845

Value of F(x,y) at 0.9 is 4.1973

Value of F(x,y) at 0.92 is 4.53442

Value of F(x,y) at 0.94 is 4.93274

Value of F(x,y) at 0.96 is 5.41018

Value of F(x,y) at 0.98 is 5.99216

Press any key to continue . . .

Graph of the Function obtained in the above Problem.

6

5.5

5

4.5

4

3.5

3

2.5

2

1.5

1

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

26/4/2011

6. SHOOTING METHOD

VIPUL GUPTA

2k8/EE/889

// Write a Program to solve a 2nd order Linear differential equation by SHOOTING METHOD

/* A Boundary Value Problem is given

d2y/d2x= 2y + 8x(9 x)

y(0) = 0 and y(9) = 0

*/

#include<iostream>

#include<conio.h>

#include<cmath>

using namespace std;

float y[4],z[4],fv=0,h=3,x;

int i,j;

float fdd(float x,float y)

{

float temp=2*y+8*x*(9-x);

return temp;

}

void solve(float d)

{

x=0;

z[0]=d;

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

{

y[i]=y[i-1]+z[i-1]*h;

z[i]=z[i-1]+fdd(x,y[i-1])*h;

x=x+h;

}

}

int main()

{

y[0]=0;

float l,m,q,k;

solve(4);

// Finding an interval in which Final value of function Lies

if(y[3]>fv)

{

for( i=1 , j=-1; ;i++,j--)

{

solve(i);

if(y[3]<=fv)

break;

solve(j);

if(y[3]<=fv)

break;

}

solve(i);

l=y[3];

solve(j);

m=y[3];

if(y[3]<=fv)

k=i;

else

k=j;

if(l<fv&&m<fv)

{

if(l>m)

k=i;

else

k=j;

}

}

else

{

for( i=1 , j=-1; ;i++,j--)

{

solve(i);

if(y[3]>=fv)

break;

solve(j);

if(y[3]>=fv)

break;

}

solve(i);

l=y[3];

solve(j);

m=y[3];

if(y[3]>=fv)

k=i;

else

k=j;

if(l>fv&&m>fv)

{

if(l>m)

k=j;

else

k=i;

}

}

solve(0);

l=y[3];

solve(k);

m=y[3];

q=fv;

// Interpolation

k=k+((k-0)/(m-l))*(q-m);

cout<<endl<<k;

solve(k);

cout<<"Final Value at "<<k<<" is "<<y[3]<<endl;

// Solution to equation

x=0;

for(i=0;i<4;i++)

{

cout<<"Value of function at "<<x<<" is "<<y[i]<<endl;

x= x+h;

}

system("pause");

}

/*

OUTPUT

-20.5714

Final Value at -20.5714 is -1.52588e-005

Value of function at 0 is 0

Value of function at 3 is -61.7143

Value of function at 6 is -123.429

Value of function at 9 is -1.52588e-005

Press any key to continue . . .

/*

Following GRAPH is obtained by solving above 2nd order Differential equation

0

-20

-40

-60

-80

-100

-120

-140

- GSM AFP Planet v53 Sep2011Uploaded byHs Robby
- Numerical Analysis Chap 1Uploaded byGibs Rivera
- Tut4SolnUploaded byMahtab Alam
- Ecenumel Project GuiUploaded byCyrene Mamaradlo
- Front MatterUploaded bygeomongolia
- Hard work by Natansh(Bhund)Uploaded byujjawalbhojawala
- 19690021375Uploaded byShafqat Hussain
- !EulerIntroUploaded byJey-r Ventura
- Lecture 04Uploaded byfanus
- Lecture 14Uploaded byYamaneko Shin
- Calicuit Sem 3Uploaded bySuresh Kumar
- Gaussian Elimination and Lu DecompositionUploaded byapuroopm
- Numerical MethodsUploaded byRobcvel Caparaz Velarde
- Roots of EquationsUploaded byJonathan Budinho
- Chapter 1Uploaded byAli Hassan
- New Microsoft Word Document (3)Uploaded byrahul
- Numerical Continuation MethodUploaded byMaroju Prashanth
- MA2266Uploaded byANAND
- AIAA-2009-4140.pdfUploaded byAli Yıldırım
- Polynomial Approximation of Functions of MatricesUploaded byHillel Tal-Ezer
- IB Command TermsUploaded byDBQ
- Prathamesh Manave(Kbp Satara)Uploaded byPrathamesh Manave
- A Posteriori Estimates for Partial Differential Equations, Sergey Repin.pdfUploaded byAnres Anres Dictador
- 1-s2.0-S0960077913001744-mainUploaded byhjgajjar
- ICP_+_TPS_(NM)Uploaded byothersk46
- Dual SimplexUploaded byPavanKumar
- 11 Events NotesUploaded byAnkur Singh
- DAYANGUploaded byshamsukarim2009
- n4e200553cbafcUploaded byTinkal Sharma
- Lecture 3Uploaded byZ_Jahangeer

- Railway Resevation System C++Uploaded byvipulgupta2012
- Mathematical Modelling_Dev C++ ProgramUploaded byvipulgupta2012
- Refrigerator Door AlarmUploaded byvipulgupta2012
- Availability Based TariffUploaded byvipulgupta2012
- 1 to 3_889Uploaded byvipulgupta2012
- Availability Based TariffUploaded byvipulgupta2012
- Transformer Auxiliaries 4Uploaded byvipulgupta2012
- Plant Overview 7Uploaded byvipulgupta2012
- Transformer Testing 8Uploaded byvipulgupta2012
- Tapchanger_3Uploaded byvipulgupta2012
- References 1Uploaded byvipulgupta2012

- 02 Adaptive Tracking Control of a Nonholonomic Mobile RobotUploaded bychoc_ngoay
- Summative Test 1 2 3_math 6_q1Uploaded byJennet Perez
- Calculation Genus SeifertUploaded byDiptaishik Choudhury
- MatricesUploaded byHimanshu Gupta
- Ofsted 2007Uploaded byJoe Cook
- sols4Uploaded byjiamin_tay5573
- Smarandache Semirings, Semifields,Semi Vector SpacesUploaded byfurrysammy17
- linear algebraUploaded byMattPorter
- REAL ANAUploaded byKyThoai
- UNIT 4 OPERATIONS RESEARCHUploaded bykeerthi_sm18
- O'Connor -- Matrix Chain MultiplicationUploaded byDerek O'Connor
- Optimal Design of Passenger Car Suspension for Ride and Road HoldingUploaded byPriscila Barros
- Al KhwarizmiUploaded byAmank D Harve
- A Comparison of Spotlight SAR Image Formation TechniquesUploaded byuranub
- math-0071 agriculture mathematics 2010Uploaded byapi-324493076
- Csc349a Cribsheet Rev3.0Uploaded byPaBa
- Appendix d 3 (Calculus 2231)Uploaded bySohil
- Lab Experiment 02Uploaded bySohail Afridi
- Data Mining Algorithms In R.pdfUploaded byMacLeod
- PDE Methods for Pricing Barrier OptionsqUploaded byMohammed Ali Al-belushi
- Abraham de MoivreUploaded byLuiz Henrique Soares
- c++ Lab ExercisesUploaded byJaya Ganthan
- On some connections between condensed matter and string theory. Mathematical connections with some sectors of Number Theory (2010)Uploaded byMichele Nardelli
- KS2 - 2001 - Mathematics - Test BUploaded byhenry_g84
- RESEARCH PAPER on Fracture Mechanics.pdfUploaded byAman Bansal
- ashleys lesson plan for boat building day 2 extentionUploaded byapi-241454734
- 9783642284410-c2Uploaded bySuraj Kumar
- Microsoft Word - Chotu Session Algebra Instructor NotesUploaded byGoodone Thisone
- Generalized Single Valued Triangular Neutrosophic Numbers and Aggregation Operators for Application to Multi-attribute Group Decision MakingUploaded byAnonymous 0U9j6BLllB
- (1993) 'the Growing Importance of LA in Undergrad Mathematics'Uploaded byCaio Viega