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
Diferensial
Untuk mendapatkan turunan dari fungsi dapat dengan menggunakan fungsi yang sudah disediakan oleh R yaitu D atau deriv Contoh :
Turunan dari f(x)=x2
xfs <- expression (exp(x^2))
D(xfs ,"x")
## exp(x^2) * (2 * x)
atau
xturunan <- deriv (~x^2,"x")
x <- 2
eval ( xturunan )
## [1] 4
## attr(,"gradient")
## x
## [1,] 4
Integral
Untuk mendapatkan integral dari suatu fungsi, dapat menggunakan fungsi yang sudah disediakan oleh R yaitu fungsi integrate atau dengan menggunakan package Ryacas
Integral Tak Tentu Integral tak tentu dapat dicari dengan menggunakan fungsi yac_str. Contoh : 1. Integral dari f(x)=x2+4x
("Integrate(x) x^2 + 4*x")
## [1] "Integrate(x) x^2 + 4*x"
("Integrate(t) t^4 * Exp(-t)")
## [1] "Integrate(t) t^4 * Exp(-t)"
Integral Tentu
Integral tentu dapat dicari dengan menggunakan fungsi integrate.
f1 <-function(x) x^2 + 4*x
integrate(f1,lower = -10,upper = 10)
## 666.6667 with absolute error < 7.6e-12
f2 <-function(t) t^(4) * exp(-t)
integrate(f2,lower = 0,upper = Inf)
## 24 with absolute error < 2.2e-05