Sabtu, 08 Oktober 2011

0 Metode Newton Raphson


#include
#include
#include

void garis (){
for (int a = 1; a<= 70;a++)
cout<<"=";
}

float f(double x){
return (pow(2.7,-x) - x);
}

void main (){
double xo, xn, yxn, y2xn, e, k=0;
garis();
cout<<"\nPROGRAM MENCARI SOLUSI METODE NUMERIK \nDENGAN METODE NEWTON RAPHSON\n";
garis();
cout<<"\n\nPersamaan Kuadrat yang Dipakai f(x) = e-x";
cout<<"\nMasukkan Nilai Xo : "; cin>>xo;
cout<<"Masukkan Nilai Error : "; cin>>e;
xn = xo;
garis();
cout<<"\nNO xn\t f(x)\t\tf'(x)\t|xn-g(xn|<=e\n" ;
garis();

do{
k=k+1;
cout<<"\n"<
cout<<" "<<
yxn = f(xn);
cout<<"\t"<<
y2xn = (2 * xn) - 6;
cout<<"\t"<<
if (fabs(yxn)<= e){
cout<<"\tSudah\n";
garis();
cout<<"\nIterasi Berhenti Pada Iterasi Ke-"<
cout<<"\nSolusinya Adalah "<
}
else if (fabs(yxn)>= e){
xn = xn - (yxn/y2xn);
cout<<"\tBelum";
}
}
while (fabs(yxn) >=e);
}

About the Author

I'm Author description here. Go to Blogger edit html and find these sentences. Now replace these sentences with your own descriptions. Subscribe to Our Feed and Follow Me on Twitter My user

    Other Recommended Posts

0 komentar:

Posting Komentar

 
back to top