summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
library(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
library(mosaicCalc)
## 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, will retire 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:.
## The sp package is now running under evolution status 2
## (status 2 uses the sf package in place of rgdal)
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
Berikut adalah rangkuman singkat mengenai teori turunan dan diferensiasi:
Turunan - Turunan suatu fungsi f(x) di titik x adalah laju perubahan f(x) terhadap x. Secara matematis, turunan ditulis sebagai f’(x) dan didefinisikan sebagai limit dari nilai tambahan f(x+h) - f(x) dibagi h ketika h mendekati 0. - Turunan menunjukkan kemiringan kurva di suatu titik dan kecepatan perubahan fungsi. - Aturan turunan mencakup: - Turunan konstanta adalah 0 - Turunan x adalah 1 - Turunan fungsi kuadrat adalah 2x - Aturan rantai, turunan fungsi komposit, dll.
Diferensiasi - Diferensiasi adalah proses mencari turunan fungsi. - Konsep utama diferensiasi: - Mencari kemiringan (gradien) fungsi di berbagai titik - Mencari kecepatan perubahan - Optimasi nilai maksimum dan minimum - Menghitung luas di bawah kurva - Diferensial dx merupakan perubahan kecil dari x, df(x) adalah perubahan kecil f(x) yang disebabkan dx. - Hubungan antara dy, dx dan df adalah gradien/turunan f’(x).
Beberapa aplikasi diferensiasi: - Mengoptimalkan fungsi untuk bisnis,
ekonomi, dsb - Mencari kecepatan dan percepatan untuk masalah
fisika/teknik
- Menentukan nilai maksimum dan minimum pada geometri - Ekonomi:
elasticitas, pendapatan marginal, biaya marginal
Itu rangkuman singkat tentang konsep dasar turunan dan diferensiasi beserta aplikasinya.
Sebagai contoh
g <- D(x^2 ~ x)
g(1)
## [1] 2
g(3.5)
## [1] 7
g
## function (x)
## 2 * x
## <bytecode: 0x0000025f03f0d358>
h <- D(sin(abs(x - 3) ) ~ x)
h
## function (x)
## {
## .e1 <- x - 3
## cos(abs(.e1)) * sign(.e1)
## }
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
s2( t=3, A=4, P=8, C=2 )
## [1] -2.221441
slice_plot(s2(t, A=4, P=8, C=2) ~ t,
domain(t=range(0,15)))
df <- D(sin(x) ~ x)
ddf <- D(df(x) ~ x)
another.ddf <- D(sin(x) ~ x & x)