ImplicitCurve

Element

An implicit curve is a plane curve defined by an implicit equation relating two coordinate variables, commonly \(x\) and \(y\). For example, the unit circle is defined by the implicit equation \[x^2 + y^2 = 1.\] In general, every implicit curve is defined by an equation of the form \(f(x, y) = 0\) for some function \(f\) of two variables. (Wikipedia)

The partial derivatives for \(f\) are optional. If not given, numerical derivatives are used instead. This is good enough for most practical use cases. But if supplied, both partial derivatives must be supplied.

The most effective attributes to tinker with if the implicit curve algorithm fails are

Usage (signatures)
board.create('implicitcurve', [f, dfxopt, dfyopt, rangexopt, rangeyopt]);
Parameters
Name Type Attributes Default Description
f function | String

Function of two variables for the left side of the equation \(f(x,y)=0\). If f is supplied as string, it has to use the variables 'x' and 'y'.

dfx function | String <optional>
null

Optional partial derivative in respect to the first variable If dfx is supplied as string, it has to use the variables 'x' and 'y'.

dfy function | String <optional>
null

Optional partial derivative in respect to the second variable If dfy is supplied as string, it has to use the variables 'x' and 'y'.

rangex Array | function <optional>
boundingbox

Optional array of length 2 of the form [x_min, x_max] setting the domain of the x coordinate of the implicit curve. If not supplied, the board's boundingbox (+ the attribute 'margin') is taken.

rangey Array | function <optional>
boundingbox

Optional array of length 2 of the form [y_min, y_max] setting the domain of the y coordinate of the implicit curve. If not supplied, the board's boundingbox (+ the attribute 'margin') is taken.

Examples
var f, c;
  f = (x, y) => 1 / 16 * x ** 2 + y ** 2 - 1;
  c = board.create('implicitcurve', [f], {
      strokeWidth: 3,
      strokeColor: JXG.palette.red,
      strokeOpacity: 0.8
  });

var a, c, f;
 a = board.create('slider', [[-3, 6], [3, 6], [-3, 1, 3]], {
     name: 'a', stepWidth: 0.1
 });
 f = (x, y) => x ** 2 - 2 * x * y - 2 * x + (a.Value() + 1) * y ** 2 + (4 * a.Value() + 2) * y + 4 * a.Value() - 3;
 c = board.create('implicitcurve', [f], {
     strokeWidth: 3,
     strokeColor: JXG.palette.red,
     strokeOpacity: 0.8,
     resolution_outer: 20,
     resolution_inner: 20
 });

var c = board.create('implicitcurve', ['abs(x * y) - 3'], {
     strokeWidth: 3,
     strokeColor: JXG.palette.red,
     strokeOpacity: 0.8
 });

var niveauline = [];
niveauline = [0.5, 1, 1.5, 2];
for (let i = 0; i < niveauline.length; i++) {
    board.create("implicitcurve", [
        (x, y) => x ** .5 * y ** .5 - niveauline[i],
           [0.25, 3], [0.5, 4] // Domain
    ], {
        strokeWidth: 2,
        strokeColor: JXG.palette.red,
        strokeOpacity: (1 + i) / niveauline.length,
        needsRegularUpdate: false
    });
}

Attributes

Own

alpha_0

Description

Angle α0 between two successive tangents: determines the smoothness of the curve.

Type
Number | function
Default Value
0.05
Source
options.js, line 6236

delta_0

Description

Allowed distance (in user units) of predictor point to curve.

Type
Number | function
Default Value
0.05
Source
options.js, line 6308

h_critical

Description

If h is below this threshold (in user units), we bail out of the tracing phase of that component.

Type
Number | function
Default Value
0.001
Source
options.js, line 6328

h_initial

Description

Initial step width (in user units).

Type
Number | function
Default Value
0.1
Source
options.js, line 6318

h_max

Description

Maximum step width (in user units).

Type
Number | function
Default Value
0.5
Source
options.js, line 6339

kappa_0

Description

Inverse of desired number of Newton steps.

Type
Number | function
Default Value
0.2
Source
options.js, line 6298

loop_detection

Description

Use Gosper's loop detector.

Type
Boolean | function
Default Value
true
Source
options.js, line 6369

loop_dir

Description

Minimum acos of angle to detect loop.

Type
Number | function
Default Value
0.99
Source
options.js, line 6359

loop_dist

Description

Allowed distance (in user units multiplied by actual step width) to detect loop.

Type
Number | function
Default Value
0.09
Source
options.js, line 6349

margin

Description

Defines the margin (in user coordinates) around the JSXGraph board in which the implicit curve is plotted.

Type
Number | function
Default Value
1
Source
options.js, line 6191

max_steps

Description

Maximum iterations for one component of the implicit curve.

Type
Number | function
Default Value
1024
Source
options.js, line 6226

qdt_box

Description

Half of the box size (in user units) to search for existing line segments in the quadtree.

Type
Number | function
Default Value
0.2
Source
options.js, line 6288

resolution_inner

Description

Vertical resolution (in pixel) to search for components of the implicit curve. A small number increases the running time. For large number components may be missed. Minimum value is 0.01.

Type
Number | function
Default Value
5
Source
options.js, line 6214

resolution_outer

Description

Horizontal resolution: distance (in pixel) between vertical lines to search for components of the implicit curve. A small number increases the running time. For large number components may be missed. Minimum value is 0.01.

Type
Number | function
Default Value
5
Source
options.js, line 6202

tol_0

Description

Tolerance to find starting points for the tracing phase of a component.

Type
Number | function
Default Value
JXG.Math.eps
Source
options.js, line 6247

tol_cusp

Description

Tolerance for cusp / bifurcation detection.

Type
Number | function
Default Value
0.05
Source
options.js, line 6267

tol_newton

Description

Tolerance for the Newton steps.

Type
Number | function
Default Value
1.0e-7
Source
options.js, line 6257

tol_progress

Description

If two points are closer than this value, we bail out of the tracing phase for that component.

Type
Number | function
Default Value
0.0001
Source
options.js, line 6277

Inherited

Members

Own

domain

Description

Defines a domain for searching f(x,y)=0. Default is null, meaning the bounding box of the board is used. Using domain, visProp.margin is ignored.

Source
base/curve.js, line 3605

Inherited

Methods

Own

dfx() → {Number}

Partial derivative in the first variable of the left side of the equation (f(x,y)=0\). If null, then numerical derivative is used.

Returns

Type
Number

Details

Source
base/curve.js, line 3573

dfy() → {Number}

Partial derivative in the second variable of the left side of the equation \(f(x,y)=0\). If null, then numerical derivative is used.

Returns

Type
Number

Details

Source
base/curve.js, line 3589

f() → {Number}

Function of two variables for the left side of the equation \(f(x,y)=0\).

Returns

Type
Number

Details

Source
base/curve.js, line 3563

Inherited

Events

Own

none

Inherited

Details

Type
JXG.Curve
Source
base/curve.js, line 3363

Extends