Turunan fungsi (diferensial) ialah fungsi lain dari suatu fungsi sebelumnya, misalnya fungsi f menjadi fâ yang memiliki nilai tak beraturan. Turunan (diferensial) dipakai sebagai suatu alat untuk menyelesaikan berbagai masalah dalam geometri dan mekanika.
Input: ekspresi menggunakan ~notasi. Contoh: x^2~xatau sin(x^2)~xatauy*cos(x)~y
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
## The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
## which was just loaded, were retired in October 2023.
## Please refer to R-spatial evolution reports for details, especially
## https://r-spatial.org/r/2023/05/15/evolution4.html.
## It may be desirable to make the sf package available;
## package maintainers should consider adding sf to Suggests:.
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
g <- D(x^2 ~ x)
g(1)
## [1] 2
g(3.5)
## [1] 7
Untuk ekspresi input lainnya, D()akan mengembalikan fungsi yang didasarkan pada perkiraan numerik ke turunan
Sebagai Contoh :
h <- D(sin(abs(x - 3) ) ~ x)
h
## function (x)
## {
## .e1 <- x - 3
## cos(abs(.e1)) * sign(.e1)
## }
Parameter Simbolik â>
Kita dapat menyertakan parameter simbolik dalam ekspresi yang dimasukkan ke D()
Contoh :
s2 <- D(A * sin(2 * pi * t / P) + C ~ t)
s2
## function (t, A, C, P)
## (2 * A * pi * cos((2 * pi * t)/P))/P
library(mosaicCalc)
slice_plot(s2(t, A=2, P=10, C=4) ~ t,
domain(t=range(0,20)), color = "red")