Download modul lengkap Metode Numerik pdf
special thanks to "http://umardanny.com/materi-kuliah/"
- Taylor Series dan Galat Analysis (Numerical Series)
- Metode Biseksi (Solusi Persamaan Non Linier)
- Metode Regula Falsi
- Metode Newton Raphson
- Metode Secant
- Gauss Siedel Method (Simultaheous Linear Equations)
- Gauss Pivot Elimination Method
- Interpolation (Numerical Methods)
- Approximation
- Integral
- Integral Trapesium (Trapesoid Rule – Numerical Method)
- Integral Simpson (Metode Numerik)
- Integral Romberg
Download Modul Lengkap Metode Numerik PDF
Posted by RZDev: Belajar Programming! on Wednesday, November 8, 2017
Berikut contoh program menghitung dengan Regula Falsi metode numerik.
#include<iostream>
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<process.h>
using namespace std;
// Deklarasi Formulanya
#define EPS 0.00001
#define f(x) (pow(2.718,-x)-x)
int n;
void FAL_POS();
int main()
{
cout <<"Metode Regula-Falsi "<< endl;
cout <<"Equation is -> f(x)=(e^-x)-x "<< endl;
cout <<"Masukkan Iterasi Maximum : "; cin >> n;
FAL_POS();
getch();
}
void FAL_POS()
{
float x1,x2,x0;
float f1,f2,f0;
int itr=n,i;
for(x1=0.0;;)
{
f1=f(x1);
if(f1>0)
break;
else
x1=x1+0.1;
}
x0=x1-0.1;
f0=f(x0);
printf("\n----------------------------------------------------");
printf("\n ITERATION\t x2\t\t\t F(X)\n");
printf("\n----------------------------------------------------\n");
for(i=0;i<itr;i++)
{
x2=x0-((x1-x0)/(f1-f0))*f0;
f2=f(x2);
if(f0*f2>0)
{
x1=x2;
f1=f2;
}
else
{
x0=x2;
f0=f2;
}
if(fabs(f(2))>EPS)
printf("\n %d \t %.7f \t %.7f ",i+1,x2,f2);
}
printf("\n----------------------------------------------------");
printf("\n Result = %.10f ",x2);
printf("\n----------------------------------------------------");
}
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<process.h>
using namespace std;
// Deklarasi Formulanya
#define EPS 0.00001
#define f(x) (pow(2.718,-x)-x)
int n;
void FAL_POS();
int main()
{
cout <<"Metode Regula-Falsi "<< endl;
cout <<"Equation is -> f(x)=(e^-x)-x "<< endl;
cout <<"Masukkan Iterasi Maximum : "; cin >> n;
FAL_POS();
getch();
}
void FAL_POS()
{
float x1,x2,x0;
float f1,f2,f0;
int itr=n,i;
for(x1=0.0;;)
{
f1=f(x1);
if(f1>0)
break;
else
x1=x1+0.1;
}
x0=x1-0.1;
f0=f(x0);
printf("\n----------------------------------------------------");
printf("\n ITERATION\t x2\t\t\t F(X)\n");
printf("\n----------------------------------------------------\n");
for(i=0;i<itr;i++)
{
x2=x0-((x1-x0)/(f1-f0))*f0;
f2=f(x2);
if(f0*f2>0)
{
x1=x2;
f1=f2;
}
else
{
x0=x2;
f0=f2;
}
if(fabs(f(2))>EPS)
printf("\n %d \t %.7f \t %.7f ",i+1,x2,f2);
}
printf("\n----------------------------------------------------");
printf("\n Result = %.10f ",x2);
printf("\n----------------------------------------------------");
}
Sekian script C++ untuk Regula-Falsi Method, jika ada yang ingin ditanyakan bisa melaui komentar dibawah ini atau langsung menghubungi saya melalui contact person yang ada. Terima Kasih & Semoga Bermanfaat
Program C++ Regula Falsi Method (Metode Regula-Falsi)
Posted by RZDev: Belajar Programming! on Saturday, October 21, 2017
Berikut ini merupakan program metode numerik yaitu Bisection Method atau metode bagidua.
#define cek 17
#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <cmath>
#include <iomanip>
using namespace std;
float f(float x);
int main()
{
float a,b,c,lebar;
float epsilon;
int i=0;
cout << "METODE BAGI DUA " <<endl;
cout << endl;
cout <<"BATAS PERTAMA (a) : ";
cin >>a;
cout <<"BATAS KEDUA (b) : ";
cin >>b;
cout <<"EPSILON : ";
cin >>epsilon;
cout <<endl <<endl;
if (f(a)*f(b)>0){
return 0;
}
else{
cout <<"i"<<setw(cek)<<"a"<<setw(cek)<<"c"<<setw(cek)<<"b"<<setw(cek)<<"f(a)";
cout <<setw(cek)<<"f(c)"<<setw(cek)<<"f(b)"<<setw(cek)<<"Selang Baru"<<setw(cek)<<"Lebarnya"<<endl;
do
{
c=(a+b)/2;
f(c);
if(c<epsilon || i>40){
return 0;
}
else{
if(f(a)*f(c)<0){
cout <<i<<setw(cek)<<a<<setw(cek)<<c<<setw(cek)<<b<<setw(cek)<<f(a)<<setw(cek);
cout <<f(c)<<setw(cek)<<f(b)<<setw(cek)<<"[A,C]";
b=c;
lebar= abs(b-a);
cout<<setw(cek)<<lebar<<endl;
cout<<endl;
}
else{
cout<<i<<setw(cek)<<a<<setw(cek)<<c<<setw(cek)<<b<<setw(cek)<<f(a)<<setw(cek);
cout<<f(c)<<setw(cek)<<f(b)<<setw(cek)<<"[C,B]";
a=c;
lebar= abs(b-a);
cout<<setw(cek)<<lebar<<endl;
cout<<endl;
}
i++;
}
}
while( (lebar > epsilon) );
cout<<"Hampiran Akarnya = "<<c<<endl;
cout<<"Banyaknya Iterasi : "<<i;
}
getch();
return 0;
}
float f(float x)
{
float e=2.71828182845904523536;
float hasil,hasil2,hasil3,hasil4;
hasil = x*(-1);
hasil3 = pow(e,hasil);
hasil4=hasil3-x;
return (hasil4);
}
#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <cmath>
#include <iomanip>
using namespace std;
float f(float x);
int main()
{
float a,b,c,lebar;
float epsilon;
int i=0;
cout << "METODE BAGI DUA " <<endl;
cout << endl;
cout <<"BATAS PERTAMA (a) : ";
cin >>a;
cout <<"BATAS KEDUA (b) : ";
cin >>b;
cout <<"EPSILON : ";
cin >>epsilon;
cout <<endl <<endl;
if (f(a)*f(b)>0){
return 0;
}
else{
cout <<"i"<<setw(cek)<<"a"<<setw(cek)<<"c"<<setw(cek)<<"b"<<setw(cek)<<"f(a)";
cout <<setw(cek)<<"f(c)"<<setw(cek)<<"f(b)"<<setw(cek)<<"Selang Baru"<<setw(cek)<<"Lebarnya"<<endl;
do
{
c=(a+b)/2;
f(c);
if(c<epsilon || i>40){
return 0;
}
else{
if(f(a)*f(c)<0){
cout <<i<<setw(cek)<<a<<setw(cek)<<c<<setw(cek)<<b<<setw(cek)<<f(a)<<setw(cek);
cout <<f(c)<<setw(cek)<<f(b)<<setw(cek)<<"[A,C]";
b=c;
lebar= abs(b-a);
cout<<setw(cek)<<lebar<<endl;
cout<<endl;
}
else{
cout<<i<<setw(cek)<<a<<setw(cek)<<c<<setw(cek)<<b<<setw(cek)<<f(a)<<setw(cek);
cout<<f(c)<<setw(cek)<<f(b)<<setw(cek)<<"[C,B]";
a=c;
lebar= abs(b-a);
cout<<setw(cek)<<lebar<<endl;
cout<<endl;
}
i++;
}
}
while( (lebar > epsilon) );
cout<<"Hampiran Akarnya = "<<c<<endl;
cout<<"Banyaknya Iterasi : "<<i;
}
getch();
return 0;
}
float f(float x)
{
float e=2.71828182845904523536;
float hasil,hasil2,hasil3,hasil4;
hasil = x*(-1);
hasil3 = pow(e,hasil);
hasil4=hasil3-x;
return (hasil4);
}
Sekian script C++ untuk Bisection Method, jika ada yang ingin ditanyakan bisa melaui komentar dibawah ini atau langsung menghubungi saya melalui contact person yang ada. Terima Kasih & Semoga Bermanfaat