derivative: Derivative of a function with respect to x

Description Usage Arguments Value Examples

View source: R/KneeArrow.R

Description

Derivative of a function with respect to x

Usage

1
derivative(x, y, m = 0, n = 50)

Arguments

x

x coordinates of points in function's domain

y

y coordinates of points in function's range

m

the order of the derivative (0 for y, 1 for y', 2 for y”)

n

number of points in the domain for interpolation

Value

a function representing the mth derivative of y(x) with respect to x

Examples

1
2
3
4
5
x <- seq(0,5,0.1)
y <- x^2 - 2*x + 3 # So dy/dx = 2x - 2
fp <- derivative(x, y, 1)
fp(2) # 2
fp(5) # 8

KneeArrower documentation built on Oct. 23, 2020, 8:07 p.m.