Referencefunction (Properties)

<function>

The following examples illustrate use of the <function> tag properties.

Properties

Properties for <function name="f">

Number display (5)
$f.avoidScientificNotation

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

$f.displayDecimals

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

$f.displayDigits

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

$f.displaySmallAsZero

number. Threshold below which numbers are displayed as zero.

$f.padZeros

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

Labels (2)
$f.label

label. The label rendered with this component.

$f.labelIsName

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

Other (42)
$f.applyStyleToLabel

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

$f.backgroundColor

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

$f.disabled

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

$f.domain

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

$f.expand

text. Whether to expand the formula.

$f.expandSpecified

boolean. Whether to expand the function's formula.

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

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

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

$f.fixed

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

$f.fixLocation

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

math. The symbolic formula of the function.

$f.globalInfimum

[ number ]. The global infimum of the function.

$f.globalMaximum

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

$f.globalMinimum

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

$f.globalSupremum

[ number ]. The global supremum of the function.

$f.hidden

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

$f.labelPosition

text. Position of the function's label.

latex. The function rendered as a LaTeX string.

$f.layer

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

[ number ]. Local maxima of the function.

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

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

[ number ]. Local minima of the function.

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

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

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

$f.numInputs

integer. Number of input variables of the function.

number. Number of local maxima of the function.

number. Number of local minima of the function.

integer. Number of output values of the function.

$f.simplify

text. Level of simplification applied when displaying the formula.

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

text. Style description including the word "function".

$f.symbolic

boolean. Whether the function is treated symbolically.

$f.text

text. The function rendered as a plain text string.

$f.textColor

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

$f.textStyleDescription

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

$f.variable

_variableName. The function's first input variable name.

$f.variables

[ _variableName ]. The names of the function's input variables.

$f.xscale

number. Scale factor used along the x-axis.

$f.yscale

number. Scale factor used along the y-axis.

Common to all components (4)
$f.doenetML

text. The DoenetML source code that produced this component.

$f.hide

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

$f.isResponse

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

$f.styleNumber

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

Property Examples

Property Example: Attributes as properties

The <function> attributes listed above are also accessible as properties.


Property Example: numOutputs

The numOutputs property of a function is the dimension of its range.


Property Example: formula

If a function is defined by a formula, the formula property gives that formula. If the expand or simplify attributes are used, these are applied only during evaluation , so they do not effect the formula property. To simplify or expand the formula property of a function, you should nest it inside a <math> with the appropriate attributes.

The formula property isn’t currently implemented for interpolated functions.


Property Example: latex

The latex property gives the LaTeX of the function’s formula.


Property Example: numMinima

The property numMinima gives the number of minima calculated for a function of a single variable. By default, it looks for minima in the interval [100,100][-100,100]. This interval can be changed with the xscale attribute.


Property Example: minima/minimumLocations/minimumValues

The property minima gives the minima of a function of a single variable as an array of points. The property minimumLocations gives the values of the independent variable where the minima occur. The property minimumValues gives the values of the function at the minima.

By default, minima are calculated in the interval [100,100][-100,100].
This interval can be changed with the xscale attribute.


Property Example: numMaxima

The property numMaxima gives the number of maxima calculated for a function of a single variable. By default, it looks for maxima in the interval [100,100][-100,100].
This interval can be changed with the xscale attribute.


Property Example: maxima/maximumLocations/maximumValues

The property maxima gives the maxima of a function of a single variable as an array of points. The property maximumLocations gives the values of the independent variable where the maxima occur. The property maximumValues gives the values of the function at the maxima.

By default, maxima are calculated in the interval [100,100][-100,100]. This interval can be changed with the xscale attribute.


Property Example: numExtrema

The property numExtrema gives the number of extrema calculated for a function of a single variable. By default, it looks for maxima in the interval [100,100][-100,100].
This interval can be changed with the xscale attribute.


Property Example: extrema/extremumLocations/extremumValues

The property extrema gives the extrema of a function of a single variable as an array of points. The property extremumLocations gives the values of the independent variable where the extrema occur. The property extremumValues gives the values of the function at the extrema.

By default, extrema are calculated in the interval [100,100][-100,100]. This interval can be changed with the xscale attribute.


Property Example: styleDescription/styleDescriptionWithNoun

Since users can override styles and so may see different colors and line styles, don’t directly refer to the colors and line styles you create. Instead, use the properties styleDescription and styleDescriptionWithNoun. With those properties, the text will change to match the displayed styles.