#include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;
float f(float x)
{
float y;
y=(x*x)-(5*x)-6;
return y;
}
main()
{
int n=0;
float x[20],tol,er;
cout<<"\t\t\t\tMETODE SECANT\n";
cout<<"\t\t\t\t=============\n\n";
cout<<"\t\t\t\tFAJAR NUGRAHA WAHYU\n";
cout<<"\t\t\t\t 11140910000013\n\n";
cout<<"\t\t\t\t2x^2+2x-3\n";
cout<<"\t\t\t\t=========\n\n";
cout<<"Batas Awal \t= ";
cin>>x[0];
cout<<"Batas AKhir \t= ";
cin>>x[1];
cout<<"toleransi \t= ";
cin>>tol;
cout<<"iterasi\t "<<"x(n-1) "<<" x(n) "<<" x(n+1) "<<" f n+1 "<<" eror\t\n\n\n";
do
{
n++;
x[n+1]=((x[n]*f(x[n-1]))-(x[n-1]*f(x[n])))/(f(x[n-1])-f(x[n]));
er=((6-x[n-1])/6)*100;
cout<<n<<"\t"<<x[n-1]<<" "<<x[n]<<" "<<x[n+1]<<" "<<f(x[n+1])<<" "<< fabs(er)<<" \n";
}
while(fabs(f(x[n+1]))>tol);
cout<<endl;
cout<<"akarnya adalah ="<<x[n+1];
cout<<endl;
}
MAU DOWNLOAD? KLIK DIBAWAH
KLIK DOWNLOAD
http://pastebin.com/8Mj49CX3
Sunday, 22 November 2015
New
SOURCE CODE METODE SECANT C++
About Fajar Nugraha Wahyu
Catatan
Product Tags:
Catatan
Subscribe to:
Post Comments (Atom)
Terimakasih gan sangat membantu kita dalam mengerjakan tugas metode numerik
ReplyDelete