DIFERENSIASI Diferensiasi adalah proses menemukan turunan dari fungsi yang dapat dibedakan

library(mosaicCalc)
## Loading required package: mosaic
## Registered S3 method overwritten by 'mosaic':
##   method                           from   
##   fortify.SpatialPolygonsDataFrame ggplot2
## 
## The 'mosaic' package masks several functions from core packages in order to add 
## additional features.  The original behavior of these functions should not be affected by this.
## 
## Attaching package: 'mosaic'
## The following objects are masked from 'package:dplyr':
## 
##     count, do, tally
## The following object is masked from 'package:Matrix':
## 
##     mean
## The following object is masked from 'package:ggplot2':
## 
##     stat
## The following objects are masked from 'package:stats':
## 
##     binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
##     quantile, sd, t.test, var
## The following objects are masked from 'package:base':
## 
##     max, mean, min, prod, range, sample, sum
## Loading required package: mosaicCore
## 
## Attaching package: 'mosaicCore'
## The following objects are masked from 'package:dplyr':
## 
##     count, tally
## 
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
## 
##     D

Kita menggunakan fungsi D() untuk menghitung diferensiasi sebuah fungsi. D(x^y) => D`(yx^y-1)

g <- D(x^3 ~ x)
g(4)
## [1] 48

g = D(x^3) => g=D(3x^3-1) = D(3x^2) g(4) = D`(3(4)^2) = 48

Di bawah ini merupakan cara membuat fungsi, yaitu :

library(mosaicCalc)
my_function <- function(x) {
  return (2*x^3*5)
}
my_function(2)
## [1] 80

mari kita aplikasikan fungsi (my_function) dalam diferensiasi pemrograman R

g<-D(my_function(x)~x)
g(20)
## [1] 12000

g = D(my_function(x)) => g = D(2 * x^3 * 5) g= D(2 * 3 * x^(3-1) * 5) = D`(6 * x^2 * 5)

g(20) = D(6 * x^2 * 5) = D`(6 * 20^2 * 5) = 12000

Mari kita aplikasikan diferensial dalam pemrograman R dengan fungsi berisi variabel dan trigonometri serta definisi variabel.

s2 <- D(A  * sin(2 * pi * t / P) + C ~ t)
s2( t=3, A=2, P=10, C=4 )
## [1] -0.3883222

kemudian mari kita membuat grafik menggunakan slice_plot dalam aplikasi diferensial pemograman bahasa R yang terdiri fungsi Trigonometri

slice_plot(s2(t, A=2, P=20, C=100) ~ t, 
           domain(t=range(0,20)))