Referencefunction (Attributes 2)

<function>

The following examples illustrate use of the <function> tag attributes (Part 2).

Attributes

Attributes for <function>

Number display (5)
avoidScientificNotation

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

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

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

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

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

Labels (1)

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

Other (19)

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

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

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

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

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.

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

[ extrema ]. Local maxima of an interpolated function.

[ 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).

integer. Number of input arguments the function accepts.

numOutputs

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

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.

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

pointList. Points the interpolated function should pass through.

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

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

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

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

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.

Attribute Examples

Attribute Example: maxima

One way to specify required features of an interpolated function is set the maxima to a list of points that should be maxima of the function.

The maxima points can have an empty xx- or yy-coordinate, in which case the missing values will be determined algorithmically.

The attributes xscale and yscale will be used to determine aspects of the maxima that aren’t specified as well as the shape of the function.

If additional features (minima, extrema, through) of the function are specified, the function may have additional maxima that were not given by the maxima attribute.


Attribute Example: extrema

One way to specify required features of an interpolated function is set the extrema to a list of points that should be extrema of the function.

The extrema points can have an empty xx- or yy-coordinate, in which case the missing values will be determined algorithmically.

The attributes xscale and yscale will be used to determine aspects of the extrema that aren’t specified as well as the shape of the function.

If additional features (minima, maxima, through) of the function are specified, the function may have additional extrema that were not given by the extrema attribute.


Attribute Example: through

One way to specify required features of an interpolated function is set the through attribute to a list of points that the function should pass through.

To specify the slope of the function at the through points, use the throughSlopes attribute.


Attribute Example: throughSlopes

When the through attribute specifies a list of points that the function should pass through, the throughPoints can specify the slope of the function at those points.


Attribute Example: xscale

The xscale is used to determine the range of xx-values over which to look for function extrema.

The xscale attribute also influences the position of extrema when they are specified without an xx-component.


Attribute Example: yscale

The yscale attribute influences the position of extrema when they are specified without an yy-component.


Attribute Example: labelIsName

The labelIsName attribute will label the graph of function by its name.

To add a custom name instead, add a <label> child to the <function>.

Disclaimer: Sometimes the auto-generated location of labels is inconvenient with the <function> component. If this happens, one alternative is to use a separate <label> component on the graph and give it an exact location using the anchor attribute. (See the <label> component for some examples of this.)


Attribute Example: applyStyleToLabel

If the applyStyleToLabel attribute is set, then the lineColor from the selected style is applied to the label text.


Attribute Example: labelPosition

The labelPosition attribute changes the location of the label relative to the graph of the function. Valid options are:

  • upperRight (the default)
  • upperLeft
  • lowerRight
  • lowerLeft
  • top
  • bottom
  • left
  • right

Disclaimer: Sometimes the auto-generated location of labels (even with the labelPosition attribute) is inconvenient with the <function> component. If this happens, one alternative is to use a separate <label> component on the graph and give it an exact location using the anchor attribute. (See the <label> component for some examples of this.)


Attribute Example: layer

To make sure an object appears on top of another object in graph, one can use the layer attribute to put the object in a higher layer.

Objects default to be in layer 0. Layers 0-9 are supported.