Jurusan : Teknik Informatika

Lembaga : Universitas Islam Maulana Malik Ibrahim Malang

Linear dan Non Linear

Persamaan linear adalah persamaan aljabar yang setiap sukunya mengandung konstanta atau hasil kali konstanta dengan variabel tunggal. Persamaan non-linier dapat diartikan sebagai persamaan yang tidak mengandung syarat seperti persamaan linier sehingga persamaan non-linier dapat merupakan :

  1. Persamaan yang memiliki pangkat selain satu (misal : x^2)

  2. Persamaan yang memiliki produk dua variabel (misal : xy)

Berikut merupakan sintaks dari fungsi root_secant() tersebut :

root_secant <- function(f, x, tol=1e-7, N=100){
  iter <- 0
  
  xold <- x
  fxold <- f(x)
  x <- xold+10*tol
  
  while(abs(x-xold)>tol){
    iter <- iter+1
    if(iter>N)
      stop("No solutions found")
    
    fx <- f(x)
    xnew <- x - fx*((x-xold)/(fx-fxold))
    xold <- x
    fxold <- fx
    x <- xnew
  }
  
  root<-xnew
  return(list(`function`=f, root=root, iter=iter))
}

Lembar Kerja Mahasiswa

Soal 1

  1. (x+2)^2 (x-1)^4 (x+5)

    root_secant(function(x){(x+2)^2 * (x-1)^4 * (x+5)}, x=0)
    ## $`function`
    ## function(x){(x+2)^2 * (x-1)^4 * (x+5)}
    ## <bytecode: 0x0000000011594e90>
    ## 
    ## $root
    ## [1] 0.9999996
    ## 
    ## $iter
    ## [1] 72

Soal 2

  1. 6x^4 + 11x^3 - 56x^2 - x + 60

    root_secant(function(x){6*(x^4) + 11*(x^3) - 56*(x^2) - x + 60}, x=0.6)
    ## $`function`
    ## function(x){6*(x^4) + 11*(x^3) - 56*(x^2) - x + 60}
    ## <bytecode: 0x00000000110e3e00>
    ## 
    ## $root
    ## [1] 1.5
    ## 
    ## $iter
    ## [1] 8

Soal 3

  1. root_secant(function(x){6(x^4) + 11(x^3) - 56*(x^2) - x + 60}, x=0.6)

    root_secant(function(x){x^4 - 5*(x^3) + 3*(x^2) + x}, x=0)
    ## $`function`
    ## function(x){x^4 - 5*(x^3) + 3*(x^2) + x}
    ## <bytecode: 0x000000000fa480f0>
    ## 
    ## $root
    ## [1] 0
    ## 
    ## $iter
    ## [1] 2

Soal 4

  1. 7x - 1 < 2x + 3

    root_secant(function(x){7*x - 1 - 2*x + 3}, x=0)
    ## $`function`
    ## function(x){7*x - 1 - 2*x + 3}
    ## <bytecode: 0x000000000f399958>
    ## 
    ## $root
    ## [1] -0.4
    ## 
    ## $iter
    ## [1] 2

Daftar Pustaka

  1. https://bookdown.org/moh_rosidi2610/Metode_Numerik/dataviz.html#customise

  2. file:///D:/Kalkulus/buku%20matenmatika%20suhartono.pdf