Referencederivative

<derivative>

The derivative of a function

<derivative> is a Math component that renders the derivative of basic elementary functions (including polynomial, exponential, and trigonometric functions.)

Attributes and Properties

Attributes for <derivative>

Number display (5)
avoidScientificNotation

boolean. Default value: false. Whether to render numbers in full decimal form rather than scientific notation.

displayDecimals

integer. Default value: 2. Number of decimal places to display when rendering this number.

displayDigits

integer. Default value: 3. Number of significant digits to display when rendering this number.

displaySmallAsZero

number. Default value: 1e-14. Threshold below which numbers are displayed as zero.

padZeros

boolean. Default value: false. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.

Labels (1)
labelIsName

boolean. Default value: false. Whether to use this component's name as its rendered label.

Other (21)
applyStyleToLabel

boolean. Default value: false. Whether to apply the function's style to its label.

derivVariable

_variableName. Name of the variable to differentiate with respect to.

[ _variableNameList ]. Names of variables to differentiate with respect to.

domain

[ intervalList ]. Restriction of the function's domain to a list of intervals.

expand

boolean. Default value: false. Whether to expand the function's formula.

extrema

[ extrema ]. Local extrema (combined minima and maxima) of an interpolated function.

labelPosition

keyword. Position of the function's label.

ValueDescription
upperRight (default)Place the label above and to the right of the function curve.
upperLeftPlace the label above and to the left of the function curve.
lowerRightPlace the label below and to the right of the function curve.
lowerLeftPlace the label below and to the left of the function curve.
topPlace the label directly above the function curve.
bottomPlace the label directly below the function curve.
leftPlace the label directly to the left of the function curve.
rightPlace the label directly to the right of the function curve.
layer

number. Default value: 0. Z-order layer index for stacking the function on a graph.

maxima

[ extrema ]. Local maxima of an interpolated function.

minima

[ extrema ]. Local minima of an interpolated function.

nearestPointAsCurve

boolean. Default value: false. Whether nearest-point queries should treat the function as a curve in the plane rather than a graph y = f(x).

numInputs

integer. Number of input arguments the function accepts.

numOutputs

integer. Default value: 1. Number of output values the function produces.

simplify

keyword. Level of simplification applied to the function's formula.

ValueDescription
noneNo simplification is applied.
full (default)Fully simplify the function's formula.
numbersSimplify numeric subexpressions only, leaving symbolic structure intact.
numbersPreserveOrderLike numbers, but does not reorder commutative operands.
normalizeOrderReorder commutative operands into a canonical form without simplifying values.
symbolic

boolean. Default value: true. Whether the function should be evaluated symbolically rather than numerically.

through

pointList. Points the interpolated function should pass through.

throughSlopes

mathList. Slopes the interpolated function should have at each through-point.

variable

_variableName. Name of the function's single input variable.

[ _variableNameList ]. Names of the function's input variables.

xscale

number. Default value: 1. Scale factor used along the x-axis.

yscale

number. Default value: 1. Scale factor used along the y-axis.

Common to all components (9)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

hide

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. Default value: 1. The style number used to select this component's visual styling from the available style definitions.

Properties for <derivative name="d">

Number display (5)
$d.avoidScientificNotation

boolean. Whether to render numbers in full decimal form rather than scientific notation.

$d.displayDecimals

integer. Number of decimal places to display when rendering this number.

$d.displayDigits

integer. Number of significant digits to display when rendering this number.

$d.displaySmallAsZero

number. Threshold below which numbers are displayed as zero.

$d.padZeros

boolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.

Labels (2)
$d.label

label. The label rendered with this component.

$d.labelIsName

boolean. Whether to use this component's name as its rendered label.

Other (44)
$d.applyStyleToLabel

boolean. Whether to apply the function's style to its label.

$d.backgroundColor

text. Human-readable name for this component's background color, derived from the active style and theme.

$d.derivVariables

[ _variableName ]. Variables with respect to which derivatives are taken.

$d.disabled

boolean. Whether this component is disabled and cannot be interacted with.

$d.domain

[ interval ]. Domain interval(s) of the function.

$d.expand

text. Whether to expand the formula.

$d.expandSpecified

boolean. Whether to expand the function's formula.

$d.extrema

[ number ]. Local extrema (minima + maxima) of the function.

$d.extremumLocations

[ number ]. The x-coordinates of the function's local extrema.

$d.extremumValues

[ number ]. The values of the function's local extrema.

$d.fixed

boolean. Whether this component's value is fixed and cannot be modified.

$d.fixLocation

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$d.formula

math. The symbolic formula of the function produced by this operator.

$d.globalInfimum

[ number ]. The global infimum of the function.

$d.globalMaximum

[ number ]. The global maximum of the function (if attained).

$d.globalMinimum

[ number ]. The global minimum of the function (if attained).

$d.globalSupremum

[ number ]. The global supremum of the function.

$d.hidden

boolean. Whether this component is hidden from the rendered output.

$d.labelPosition

text. Position of the function's label.

$d.latex

latex. The function rendered as a LaTeX string.

$d.layer

number. Z-order layer index for stacking the function on a graph.

$d.maxima

[ number ]. Local maxima of the function.

$d.maximumLocations

[ number ]. The x-coordinates of the function's local maxima.

$d.maximumValues

[ number ]. The values of the function's local maxima.

$d.minima

[ number ]. Local minima of the function.

$d.minimumLocations

[ number ]. The x-coordinates of the function's local minima.

$d.minimumValues

[ number ]. The values of the function's local minima.

integer. Number of derivatives applied.

$d.numExtrema

number. Number of local extrema (minima + maxima) of the function.

$d.numInputs

integer. Number of input variables.

$d.numMaxima

number. Number of local maxima of the function.

$d.numMinima

number. Number of local minima of the function.

$d.numOutputs

integer. Number of output values of the function.

$d.simplify

text. Level of simplification applied when displaying the formula.

$d.styleDescription

text. A textual description of the function's style.

$d.styleDescriptionWithNoun

text. Style description including the word "function".

$d.symbolic

boolean. Whether the function is treated symbolically.

$d.text

text. The function rendered as a plain text string.

$d.textColor

text. Human-readable name for this component's text color, derived from the active style and theme.

$d.textStyleDescription

text. Human-readable description of this component's text styling (color and any background color).

$d.variable

_variableName. The function's first input variable name.

$d.variables

[ _variableName ]. Names of the input variables.

$d.xscale

number. Scale factor used along the x-axis.

$d.yscale

number. Scale factor used along the y-axis.

Common to all components (4)
$d.doenetML

text. The DoenetML source code that produced this component.

$d.hide

boolean. Whether to hide this component from the rendered output.

$d.isResponse

boolean. Whether this component is treated as a response for the purposes of assessment.

$d.styleNumber

integer. The style number used to select this component's visual styling from the available style definitions.

Examples

Example: <derivative> of a nested function

A <derivative> renders the derivative of the enclosed math expression, if the expression can be interpreted as a function in xx.


Example: <derivative> of a named function

A <derivative> renders the derivative of the named <function>.


Example: <derivative> of a function of a different variable

A <derivative> renders the derivative of the named <function>. The <function> is defined in terms of yy with the variables attribute and this information is carried over when evaluating the derivative.


Example: Partial derivatives

A <derivative> renders the derivative of the named <function>. The <function> is defined in terms of xx and zz with the variables attribute. The variable for differentiation of the partial derivative is specified with the derivVariables attribute.


Example: Higher-order derivatives

Higher-order derivatives can be rendered by entering multiple values in the derivVariables attribute.


Example: attributes as properties

Both attributes of the <derivative> component are also accessible as properties.

Attribute Examples

Attribute Example: derivVariables

The derivVariables attribute specifies the variable of differentiation (or a list of variables to differentiate with respect to) for multivariable functions.


Attribute Example: variables

The variables attribute can be used to specify the function variable if not specified by <function> definition.

Property Examples

Property Example: nInputs

The numInputs property returns the number of inputs associated with the enclosed function.


Property Example: numDerivatives

The numDerivatives property returns the number of differentiations performed on the enclosed function.