NIM : 220605110107
Universitas : Universitas Islam Negeri Maulana Malik Ibrahim Malang
Jurusan : Teknik Informatika
Dengan adanya fungsi diferensial dalam pemrograman R tak bisa dipungkiri bahwa akan muncul pikiran “Bagaimana dengan turunan kedua?”. Tentunya R sudah menyiapkan hal tersebut.
Anda dapat menggunakan D() operator dua kali untuk menemukan turunan kedua,seperti ini.
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
df <- D(sin(x) ~ x)
ddf <- D(df(x) ~ x)
ddf(1)
## [1] -0.841471
Untuk menyimpan pengetikan, terutama bila ada lebih dari satu variabel yang terlibat dalam ekspresi, Anda dapat meletakkan beberapa variabel di sebelah kanan ~ tanda, seperti pada turunan kedua ini terhadap x
another.ddf <- D(sin(x) ~ x & x)
Anda dapat memasukkan variabel baru anda pada diferensial juga seperti dibawah ini :
g<-D(another.ddf(x)~x)
g(1)
## [1] -0.5403023
Anda dapat mencoba membuat grafik dari turunan kedua anda menggunakan fungsi slice_plot.
slice_plot(another.ddf(1) ~ a,
domain(a=range(0,20)))