law:derivative
List of: Scheme Extensions
Subjects: Laws
Contents: Kernel

Action: Creates a law object that is the derivative of the given law with respect to the given variable.

Filename: kern/kern_scm/law_scm.cxx

Syntax: (law:derivative law [with-respect-to])

Arg Types: law law | string | real | position |


par-pos | gvector

with-respect-to law | string

Returns: law

Description: The law:derivative returns the exact derivative of the given law function.


law specifies a law.


with-respect-to is an optional argument specifying an identity law, such as x, y, z, or a#, etc. If with-respect-to is provided, then the derivative is performed with respect to this argument; else the derivative is assumed to be with respect to x or a1.

Example: ; law:derivative

; Define a law to use.

(define law1 (law "x^2"))

;; law1

; To get exact results, take the exact derivative.

; Create the derivative of that law.

(define d-law (law:derivative law1))

;; d-law

; Evaluate the derivative.

(law:eval d-law 3)

;; 6

; Evaluate the second derivative.

(law:eval (law:derivative d-law) 3)

;; 2

; Find the numerical derivative at 3.

(law:nderivative law1 3 "x" 1)

;; 5.9999999999838

; Find the second numerical derivative at 3.

(law:nderivative law1 3 "x" 2)

;; 1.9999997294066
PDF/KERN/14SCI.PDF
HTM/DATA/KERN/KERN/14SCI/0007.HTM