Metode & Algoritma | List Tutorials | Source Code | About | Sitemap
Konsultan Tesis
Bimbingan dan Konsultasi Tesis Informatika bersama team Project Graduate Indonesia. Konsultasi hanya untuk yang sudah me-Like FB kami (Silahkan LIKE tombol ini jika belum).
. Scroll kebawah untuk memasukan kode AntiSpam Protection. Hasil konsultasi akan kami kirimkan ke email Anda.

Metode Pencarian Akar




.


Metode dan Algoritma | Metode Pencarian Akar . Anda bisa melakukan konsultasi tentang Metode Pencarian Akar melalui form di samping kanan !!!

Contoh Program Metode Pencarian Akar

Untuk tugas Rekayasa Komputer kali ini, kami ditugaskan untuk mengubah algoritma dari metode Biseksi (Bagi Dua), Regula falsi , Newton Raphson, dan Secant ke dalam suatu aplikasi matematika tertentu. Aplikasi matematika yang dipakai oleh kelompok kami adalah SAGE.Dengan bahasa bawaannya adalah Pyhton, berikut Algoritma dari metode-metode tersebut:

Metode Bagi Dua

omega=1.5
z_0=1
def f(z): return abs(math.cos(omega*z))-z/z_0 #nilai absolut dari kosinus omega z kurang z/z_0
a=-2
b=1
err=0.00001
n=0
nmax=10000 
# Menentukan variabel-variabel float
dos = float(2); err = float(err)
# Sebelum ke algoritma kita mengevaluasi apakah perubahan fungsi mendaftar di ujung
if (f(a)*f(b)<0 data-blogger-escaped--="" data-blogger-escaped-2="" data-blogger-escaped-2x="" data-blogger-escaped-a="" data-blogger-escaped-abs="" data-blogger-escaped-akar=",c, " data-blogger-escaped-b="" data-blogger-escaped-c="(a+b)/dos" data-blogger-escaped-calculate="" data-blogger-escaped-carilah="" data-blogger-escaped-def="" data-blogger-escaped-default="" data-blogger-escaped-f="" data-blogger-escaped-fn="" data-blogger-escaped-fn_d="" data-blogger-escaped-if="" data-blogger-escaped-iterasi=",n
Output:
Akar= -0.5    Nilai= 1.23168886887      Iterasi= 0 (default)     Presisi= 1e-05
Akar= 0.60990524292     Nilai= -2.02227274149e-06      Iterasi= 17
# x1 = x - f(x)/f" data-blogger-escaped-kar=",c, " data-blogger-escaped-lambda="" data-blogger-escaped-n="" data-blogger-escaped-newthon_method="" data-blogger-escaped-newton_sqrt="" data-blogger-escaped-nilai=",f(c)," data-blogger-escaped-nmax="" data-blogger-escaped-num="" data-blogger-escaped-number="" data-blogger-escaped-of="" data-blogger-escaped-pertama="" data-blogger-escaped-pre="" data-blogger-escaped-precision:="" data-blogger-escaped-presisi=",err
while abs(f(c))>err: # kondisi mutlak bahwa f (root) lebih besar dari kesalahan (perhatikan nilai absolut)
if f(c)*f(a)<0: # kondisi ini mengembalikan berbagai baru dengan perubahan tanda 
b=c
else:
a=c
n=n+1 # iterasi memiliki
c=(a+b)/dos
print " data-blogger-escaped-print="" data-blogger-escaped-return="" data-blogger-escaped-sqrt="" data-blogger-escaped-square="" data-blogger-escaped-tengah="" data-blogger-escaped-the="" data-blogger-escaped-titik="" data-blogger-escaped-true:="" data-blogger-escaped-while="" data-blogger-escaped-x0="" data-blogger-escaped-x1="" data-blogger-escaped-x:="" data-blogger-escaped-x="">

Output:

804.5
404.247513984
206.099044271
110.846744125
69.9208659915
57.9435579501
56.7056644466
56.6921527424
56.692151132233484

Metode Secant

PRECISION = 0.00001
# x2 = x1 - ((x1-x0)/(fn(x1)-fn(x0)))*fn(x1)
def secant_method(x0,x1,fn):
while True:
x2 = x1 - ((x1-x0)/(fn(x1)-fn(x0)))*fn(x1)
if abs(x2 - x1) <= RECISION: return x2
x0 = x1
x1 = x2
print x2
# calculate the square sqrt of a number
# f(x) = X^2 - Number
def secant_sqrt(num):
return secant_method(num/2,num/4,lambda x: x**2-num)
secant_sqrt(3214.0)

Output:

537.0
324.277135397
205.916091836
132.004478363
89.9496774389
67.9769216068
59.0685940696
56.9032377885
56.6964766256
56.6921591697
56.692151132540069

Metode Regula-Falsi


def sign(x): # determines the sign of its argument
if x == abs(x) : return 1 # argument was positive or zero
else: return -1 # argument was negative

# Solve f = 0 on interval [x1,x2] by interpolation, with tolerances
def interpol_solve(f,x1,x2,ftol,xtol):
f1 = f(x1)
if abs(f1) <= ftol : return x1
s1 = sign(f1)
f2 = f(x2)
if abs(f2) <= ftol : return x2
s2 = sign(f2)
if s1 == s2 :
sys.stderr.write("Same sign at %g to %g - exit!\n" % (x1,x2))
sys.exit(1)
while abs(x2 - x1) > xtol :
x3 = x2 - f2*(x2 - x1)/(f2 - f1)
f3 = f(x3)
if abs(f3) <= ftol : break
s3 = sign(f3)
if s3 == s1 :
(x1,f1) = (x3,f3) # replace pair (x1,f1) by (x3,f3)
else :
(x2,f2) = (x3,f3) # replace pair (x2,f2) by (x3,f3)
return x3

def quad(x): # a simple test function with known zeroes
return (x - 5.0)*(x - 2.0)


# a simple main to test the regula falsi solver *
root = interpol_solve(quad,1.0,3.0,0.000001,0.000001)
print root





Source Code ActionScript AS3 ASP.NET AJAX C / C++ C# Clipper COBOL ColdFusion DataFlex Delphi Emacs Lisp Fortran FoxPro Java J2ME JavaScript JScript Lingo MATLAB Perl PHP PostScript Python SQL VBScript Visual Basic 6.0 Visual Basic .NET Flash MySQL Oracle Android
Related Post :


Project-G
Judul: Metode Pencarian Akar
Rating: 100% based on 99998 ratings. 5 user reviews.
Ditulis Oleh hank2

Anda sedang membaca artikel tentang Metode Pencarian Akar, Semoga artikel tentang Metode Pencarian Akar ini sangat bermanfaat bagi teman-teman semua, jangan lupa untuk mengunjungi lagi melalui link Metode Pencarian Akar.


Posted by: Metode Algoritma Updated at: 12.04

Label

3 Variabel Adaptive Resonance Theory Algorirma RSA Algoritma Algoritma Clonal Selection Algoritma Djikstra Android ANN Annaeling Aritmetika Modulo ART Artificial Neural Network Backpropagation Biometrik Blowfish Brute Force Buble Sort Business Process Management C++ C-Means Caesar Cipher CISM Contoh Contoh Kode Contoh Penerapan contoh program Contoh Soal Corporate Information System Management CRC Cyclic Redundancy Code Deteksi Wajah Dijkstra Djikstra Eigenface Enterprise Resource Planning ERP Expectation Maximization Face Detection Face Extractor Face Recognition Facebook FCFS FCM Filterbank First Come First Server Fisherface FP-Growth Fuzzy ART Fuzzy C-Means Gaussian Generate & Test Genetika greedy Green Computing Huffman image processing Implementasi Information System Risk Management iOS 5 Iris Recognition IS Strategic Planning Jaringan Jaringan Saraf Tiruan jaringan syaraf tiruan Jasa Pembuatan Tesis Skripsi TA Informatika Komputer Java JST K-means knowledge management konsultan tesis informatika kriptografi Kruskal Kruskall Linear Programming list judul informatika LOKI LOOK Low Bit Coding LSB Manajamen Proses Bisnis Manajemen Perubahan MANET Masalah Rute Kendaraan Mass Transport Vehicle Routing Problem Metode Grafik metode LSB Minimum Spanning Tree mobile Mobile Ad hoc Network MTVRP negascout Online Learning Open Shortest Path First OpenCV OSPF PCA Pemrograman Linear Pencarian Akar Pencarian Linear Pencocokan Pengenalan Iris Mata Pengenalan Suara Pengenalan Wajah Pengolahan Citra Pengolahan Citra Digital Pengukuran Garis-Garis Telapak Tangan Penjadwalan Persamaan Linier Pewarnaan Graf Pewarnaan Graph Prim Project and Change Management Quantum Random Waypoint real time tracking Recognition Recursive Large First RLF RMSE Root Mean square Error RSA RWP Sandi Sidik Jari Simulated Annaeling SISP Sistem Verifikasi Biometrik skripsi sorting Source Code Spanning Tree Speech Speech Recognition Steganography Strategic Information Systems Planning Stream Cipher Technopreneurship Traveling Salesman Problem Travelling Salesman problem Tree TSP Voice Recognition Watermaking Web Service Welch dan Powell