PYTHON - Kelas Metode Numerik

From ccitonlinewiki
Revision as of 11:50, 12 February 2019 by Edosyafei (talk | contribs)
Jump to: navigation, search

Tanggal : 12/02/2019

Pembahasan pertama, yaitu contoh sederhana bagaimana cara menyelesaikan persamaan menggunakan metode numerik..... Materi singkat dapat dilihat pada link berikut

Code Python:


import numpy as np

  1. 1. tentukan nilai nilai variabel


X1 = 0 print("-----Simulasi Perhitungan Numerik-----") dx1 = input ('berapa inrement yang diinginkan?') dx=float(dx1) X2 = X1 +dx Fx_1 = ((X2**2)-1)/(X1-1) n =1 error = 0 print ("n X F(x) error") print (n," ",X1," ",Fx_1," ", error)

while X2<1 :

   Fx_2 = ((X2**2)-1)/(X2-1)
   error= ((Fx_2-Fx_1)/Fx_1)
   Fx_1 = Fx_2
   n=n+1
   print (n," ",X1,"   ",Fx_1,"    ",   error)
   X2=X2+dx