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 yang saya sajikan di sini saya ambil dari buku berjudul Memahami Kalkulus Dasar Menggunakan Wolfram Mathematica 9 karya Suhartono.
Soal diambil dari hal 58.
Penyelesaian Secara Manual
f(x) = 3x^8 - 5x^6 + x^4 - x + 11
maka turunan f(x) adalah
f'(x) = 24x^7 - 30x^5 + 4x^3 -1
jika x = 1, maka masukan angka 1 dalam turunan fungsi tersebut
f'(1) = 24(1)^7 - 30(1)^5 + 4(1)^3 - 1
f'(1) = 24 - 30 + 4 - 1
f'(1) = -3
Untuk menyelesaikan penyelesaian deferensiasi dapat juga menggunakan Fungsi findiff() dengan sintaks sebagai berikut.
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 diambil dari hal 59.
Penyelesaian Secara Manual
f(x) = 3x^4 + 2x^2 + x
maka turunan f(x) adalah
f'(x) = 12x^3 + 4x + 1
jika x = 3, maka masukan angka 1 dalam turunan fungsi tersebut
f'(3) = 12(3)^3 + 4(3) + 1
f'(3) = 324 + 12 + 1
f'(3) = 337
Untuk menyelesaikan penyelesaian deferensiasi dapat juga menggunakan Fungsi findiff() dengan sintaks sebagai berikut.
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 diambil dari hal 59.
Penyelesaian Secara Manual
f(x) = x^3 + 3x^2
maka turunan f(x) adalah
f'(x) = 3x^2 + 6x
jika x = 3, maka masukan angka 1 dalam turunan fungsi tersebut
f'(3) = 3(3)^2 + 6(3)
f'(3) = 27 + 18
f'(3) = 45
Untuk menyelesaikan penyelesaian deferensiasi dapat juga menggunakan Fungsi findiff() dengan sintaks sebagai berikut.
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 diambil dari hal 59.
Penyelesaian Secara Manual
f(x) = 3x^2 + 2x + 4
maka turunan f(x) adalah
f'(x) = 6x + 2
jika x = 2, maka masukan angka 1 dalam turunan fungsi tersebut
f'(2) = 6(2) + 2
f'(2) = 12 + 2
f'(2) = 14
Untuk menyelesaikan penyelesaian deferensiasi dapat juga menggunakan Fungsi findiff() dengan sintaks sebagai berikut.
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 diambil dari hal 61.
Penyelesaian Secara Manual
f(x) = 3x^4 + 2x^2 + x
maka turunan f(x) adalah
f'(x) = 12x^3 + 4x + 1
jika x = 4, maka masukan angka 1 dalam turunan fungsi tersebut
f'(4) = 12(4)^3 + 4(4) + 1
f'(4) = 768 + 16 + 1
f'(4) = 785
Untuk menyelesaikan penyelesaian deferensiasi dapat juga menggunakan Fungsi findiff() dengan sintaks sebagai berikut.
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
Soal diambil dari hal 64.
Penyelesaian Secara Manual
f(x) = 5x^6 - 2x^4 + x^3 - 8x + 3
maka turunan f(x) adalah
f'(x) = 30x^5 - 8x^3 + 3x^2 - 8
jika x = 1, maka masukan angka 1 dalam turunan fungsi tersebut
f'(1) = 30(1)^5 - 8(1)^3 + 3(1)^2 - 8
f'(1) = 30 - 8 + 3 - 8
f'(1) = 17
Untuk menyelesaikan penyelesaian deferensiasi dapat juga menggunakan Fungsi findiff() dengan sintaks sebagai berikut.
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){ 5*(x^6) - 2*(x^4) + x^3 - 8*x + 3}, x=1,
h=1*.Machine$double.eps^(1/3),
method="central")
## [1] 17
Soal diambil dari hal 67.
Untuk menyelesaikan penyelesaian deferensiasi dapat juga menggunakan Fungsi findiff() dengan sintaks sebagai berikut.
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){ (2*x - 1)/(x^2 + 1)}, x=1,
h=1*.Machine$double.eps^(1/3),
method="central")
## [1] 0.5
Soal diambil dari hal 68.
Untuk menyelesaikan penyelesaian deferensiasi dapat juga menggunakan Fungsi findiff() dengan sintaks sebagai berikut.
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^2 + 7)}, x=1,
h=1*.Machine$double.eps^(1/3),
method="central")
## [1] 148
Soal diambil dari hal 68.
Untuk menyelesaikan penyelesaian deferensiasi dapat juga menggunakan Fungsi findiff() dengan sintaks sebagai berikut.
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))*(4*(x^2) + 2)}, x=3,
h=1*.Machine$double.eps^(1/3),
method="central")
## [1] 3006
Soal diambil dari hal 68.
Untuk menyelesaikan penyelesaian deferensiasi dapat juga menggunakan Fungsi findiff() dengan sintaks sebagai berikut.
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){ 1/(3*(x^2) + 1)}, x=5,
h=1*.Machine$double.eps^(1/3),
method="central")
## [1] -0.005193906
Soal diambil dari hal 68.
Untuk menyelesaikan penyelesaian deferensiasi dapat juga menggunakan Fungsi findiff() dengan sintaks sebagai berikut.
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){ 1/(4*(x^2) - 3*x + 9)}, x=1,
h=1*.Machine$double.eps^(1/3),
method="central")
## [1] -0.05
Demikian, solusi penyelesaian persamaan diferensiasi (turunan) dengan menggunakan Fungsi findiff() ** di R Studio Semoga bermanfaat. Terima kasih.