Setelah mengetahui materi tentang diferensiasi (turunan) dan juga cara penyelesainnya menggunakan beberapa metode yang dibahas di artikel sebelumnya. Kemudian, solusi penyelesaian diferensiasi (turunan) dengan metode titik pusat menggunakan Fungsidiff() di R Studio. Sekarang, kita juga akan menyelesaikan diferensiasi (turunan) dengan metode lain, yaitu menggunakan Fungsi findiff() Berikut penjelasannya.

Soal - soal disajikan di sini diambil dari buku berjudul Memahami Kalkulus Dasar Menggunakan
Wolfram Mathematica 9 karya Suhartono.

Soal No 1

Soal diambil dari hal 58.

f(x) = 3x^8 - 5x^6 + x^4 - x + 11. Berapa turunan dari f(x) jika x = 1?

Jawab :

findiff <- function(f, x, h, method=NULL){
  if(is.null(method)){
    warning("please select a method")
  }else{
    if(method == "forward"){
      return((f(x+h)-f(x))/h)
    }else if(method=="backward"){
      return((f(x)-f(x-h))/h)
    }else if(method=="central"){
      return((f(x+h)-f(x-h))/(2*h))
    }else{
      warning("you can use method: forward, bacward, or central")
    }
  }
}
findiff(function(x){  3*(x^8) - 5*(x^6) + x^4 - x + 11}, x=1,
        h=1*.Machine$double.eps^(1/3), 
        method="central")
## [1] -3

Soal No 2

Soal diambil dari hal 59.

f(x) = 3x^4 + 2x^2 + x. Berapa turunan dari f(x) jika x = 3?

Jawab :

findiff <- function(f, x, h, method=NULL){
  if(is.null(method)){
    warning("please select a method")
  }else{
    if(method == "forward"){
      return((f(x+h)-f(x))/h)
    }else if(method=="backward"){
      return((f(x)-f(x-h))/h)
    }else if(method=="central"){
      return((f(x+h)-f(x-h))/(2*h))
    }else{
      warning("you can use method: forward, bacward, or central")
    }
  }
}
findiff(function(x){  3*(x^4) + 2*(x^2) + x}, x=3,
        h=1*.Machine$double.eps^(1/3), 
        method="central")
## [1] 337

Soal No 3

Soal diambil dari hal 59.

f(x) = x^3 + 3x^2. Berapa turunan dari f(x) jika x = 3?

Jawab :

findiff <- function(f, x, h, method=NULL){
  if(is.null(method)){
    warning("please select a method")
  }else{
    if(method == "forward"){
      return((f(x+h)-f(x))/h)
    }else if(method=="backward"){
      return((f(x)-f(x-h))/h)
    }else if(method=="central"){
      return((f(x+h)-f(x-h))/(2*h))
    }else{
      warning("you can use method: forward, bacward, or central")
    }
  }
}
findiff(function(x){  x^3 + 3*(x^2)}, x=3,
        h=1*.Machine$double.eps^(1/3), 
        method="central")
## [1] 45

Soal No 4

Soal diambil dari hal 59.

f(x) = 3x^2 + 2x + 4. Berapa turunan dari f(x) jika x = 2?

Jawab :

findiff <- function(f, x, h, method=NULL){
  if(is.null(method)){
    warning("please select a method")
  }else{
    if(method == "forward"){
      return((f(x+h)-f(x))/h)
    }else if(method=="backward"){
      return((f(x)-f(x-h))/h)
    }else if(method=="central"){
      return((f(x+h)-f(x-h))/(2*h))
    }else{
      warning("you can use method: forward, bacward, or central")
    }
  }
}
findiff(function(x){  3*(x^2) + 2*x + 4}, x=2,
        h=1*.Machine$double.eps^(1/3), 
        method="central")
## [1] 14

Soal No 5

Soal diambil dari hal 61.

f(x) = 3x^4 + 2x^2 + x. Berapa turunan dari f(x) jika x = 4?

Jawab :

findiff <- function(f, x, h, method=NULL){
  if(is.null(method)){
    warning("please select a method")
  }else{
    if(method == "forward"){
      return((f(x+h)-f(x))/h)
    }else if(method=="backward"){
      return((f(x)-f(x-h))/h)
    }else if(method=="central"){
      return((f(x+h)-f(x-h))/(2*h))
    }else{
      warning("you can use method: forward, bacward, or central")
    }
  }
}
findiff(function(x){  3*(x^4) + 2*(x^2) + x}, x=4,
        h=1*.Machine$double.eps^(1/3), 
        method="central")
## [1] 785

Demikian, contoh penyelesaian persamaan diferensiasi (turunan) dengan menggunakan Fungsi findiff() ** di R Studio