Kapan pun Anda memiliki rumus yang dapat digunakan untuk membangun turunan simbolik, itulah yang harus Anda gunakan. Turunan selisih hingga berguna dalam situasi di mana Anda tidak memiliki rumus seperti itu. Perhitungannya sederhana namun memiliki kelemahan yang menunjukkan kelebihan dari evanescent -h mendekati.

Kami akan memanggil pendekatan perbedaan hingga fq_sin()dan menggunakannya makeFun()untuk membangunnya:

library(mosaicCalc)
## Loading required package: mosaic
## Warning: package 'mosaic' was built under R version 4.3.2
## 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
## Warning: package 'mosaicCore' was built under R version 4.3.2
## 
## 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
fq_sin <- makeFun((sin(x+h)- sin(x-h))/(2*h) ~ x, h=0.01)
slice_plot(fq_sin(x, h=0.01) - cos(x) ~ x, bounds(x=-10:10)) %>%
  slice_plot(fq_sin(x, h=0.001) - cos(x) ~ x, color="magenta") %>%
  gf_labs(y="Error from true value.")

Daftar Pustaka: Daniel, K. (2022). MOSAIC Calculus. Diakses pada tanggal 1 Desember 2023 dari https://www.mosaic-web.org/MOSAIC-Calculus/