derivative: Derivative of a function with respect to x

View source: R/KneeArrow.R

derivativeR Documentation

Derivative of a function with respect to x

Description

Derivative of a function with respect to x

Usage

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

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

agentlans/KneeArrower documentation built on May 17, 2022, 7:32 p.m.