Kalkulus by Prof. Dr. SUHARTONO, M.Kom || Izza Syahri Muharram _ 220605110073 || Teknik Informatika || UIN Maulana Malik Ibrahim Malang
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
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
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.
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
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
g <- D(x^2 ~ x)
g(1)
## [1] 2
input = ekspresi menggunakan ~ notasi contoh x^2~x atau sin (x^2)~x sisi kiri adalah ekspresi matematika yang akan dievaluasi menjadi angka ketika numerik tersedia tersedia untuk semua besaran yang dirujuk. sisi kanan ~ adalah variable yang akan diambil turunannya.
//RUMUS DAN SELISIH NUMERIK
h <- D(sin(abs(x - 3) ) ~ x)
h
## function (x)
## {
## .e1 <- x - 3
## cos(abs(.e1)) * sign(.e1)
## }
Untuk ekspresi lainnya D() akan mengembalikan fungsi yang didasarkan pada perasaan numerik ke turunan
//PARAMETER SIMBOLIK
library(mosaicCalc)
s2 <- D(A * sin(2 * pi * t / P) + C ~ t)
s2( t=3, A=2, P=10, C=4 )
## [1] -0.3883222
slice_plot(s2(t, A=2, P=10, C=4) ~ t,
domain(t=range(0,20)))
Menyertakan parameter simbolik dalam ekspresi yang dimasukkan ke D(),
misal dalam hal ini A,P, dan C akan diubah menjadi argumen ke S2().
fungsi s2 yang dibuat akan bekerja seperti fungsi matematika
lainnya.
// DERIVATIF PARSIAL /Turunan kedua menggunakan D() operator dua kali untuk menemukan turunan kedua.
df <- D(sin(x) ~ x)
ddf <- D(df(x) ~ x)
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")
}
}
}
Latihan 1. Jika ƒ(x) = 3 (x^8) − 5(x^6) + x*4 − x + 11, maka turunan dari f(x) di x = 3 adalah
findiff(function(x)
3*(x^8) + 5*(x^6) + x*4-x + 11, x=4, h=0.05,
method="central")
## [1] 424385.1
findiff(function(x)
3*x + 3*(x^2) + x , x=3, h=0.05,
method="central")
## [1] 22
findiff(function(x)
3*(x^4) + 2*(x^2) + 2*x, x=1, h=0.05,
method="central")
## [1] 18.03
Daftar pustaka https://dtkaplan.github.io/RforCalculus/derivatives-and-differentiation.html#partial-derivatives https://rumuspintar.com/turunan/#:text=Kesimpulan-,Definisi%20Turunan,suatu%20fungsi%20disebut%20sebagai%20diferensiasi