Usage (signatures)
board.create('slopefield', [F, xData, yData]);
Parameters
| Name | Type | Description |
|---|---|---|
F |
function | String | Function |
xData |
Array | Array of length 3 containing start value for |
yData |
Array | Array of length 3 containing start value for |
Examples
var field = board.create('slopefield', [
(x, y) => x * x - x - 2,
[-6, 25, 6], // Horizontal mesh
[-5, 20, 5] // Vertical mesh
]);
// Slider to control length of vectors
var s = board.create('slider', [[-3, 7], [3, 7], [0, 0.33, 1]], {name: 'length'});
// Slider to control number of steps
var stepsize = board.create('slider', [[-3, 6], [3, 6], [1, 20, 100]], {name: 'steps', snapWidth: 1});
var field = board.create('slopefield', [
(x, y) => x * x - y * y,
[-6, () => stepsize.Value(), 6],
[-5, () => stepsize.Value(), 5]],
{
strokeWidth: 1.5,
highlightStrokeWidth: 0.5,
highlightStrokeColor: JXG.palette.blue,
scale: () => s.Value(),
arrowHead: {
enabled: false,
size: 8,
angle: Math.PI / 16
}
});
Attributes
Own
arrowhead
- Description
Customize arrow heads of vectors. Be careful! If enabled this will slow down the performance. Fields are:
- enabled: Boolean
- size: length of the arrow head legs (in pixel)
- angle: angle of the arrow head legs In radians.
- Type
- Object
- Default Value
- {enabled: false, size: 5, angle: Math.PI * 0.125}
- Source
- options.js, line 9262
scale
- Description
Set length of the vectors in user coordinates. This in contrast to vector fields, where this attribute just scales the vector.
- Type
- Number | function
- Default Value
- 1
- See
- Source
- options.js, line 9251
Inherited
none
Methods
Own
setF(func) → {Object}
Set the defining functions of slope field.
Example
field.setF((x, y) => x * x + y * y);
board.update();
Parameters
| Name | Type | Description |
|---|---|---|
func |
function | Function f(x, y) returning a number. |
Returns
Reference to the slope field object.
- Type
- Object
Details
- Source
- element/vectorfield.js, line 397
Inherited
none
Throws
-
If the element cannot be constructed with the given parent objects an exception is thrown.
- Type
- Error
Details
- Type
- JXG.Curve
- Source
- element/vectorfield.js, line 268