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
my_function <- function(x){
  return (5 * x^2)
}
my_function(2)
## [1] 20
g <- D(my_function(x) ~ x)
g(2)
## [1] 20
library(mosaicCalc)
my_function <- function(x){
return (sin(x - 45))
}
my_function(3)
## [1] 0.9165215
s2 <- D(A  * sin(2 * pi * t / P) + C ~ t)
## function (t, A, P, C) 
## A * (cos(2 * pi * t/P) * (2 * pi/P))
s2( t=3, A=5, P=20, C=4 )
## [1] 0.9232909
slice_plot(s2(t, A=5, P=20, C=4) ~ t, 
           domain(t=range(0,50)))