Elements
Classes

# Class JXG.Math.ImplicitPlot

↳ JXG.Math.ImplicitPlot

Defined in: implicitplot.js.

Class Summary
Constructor Attributes Constructor Name and Description

JXG.Math.ImplicitPlot(bbox, config, f, dfx, dfy)
Plotting of curves which are given implicitly as the set of points solving an equation f(x,y) = 0.
Method Summary
Method Attributes Method Name and Description

curveContainsPoint(p, dataX, dataY, tol, eps)
Test if the data points contain a given coordinate, i.e.
<private>
handleCriticalPoint(u, t_u, r, omega)
Search in an arc around a critical point for a further point on the curve.
<private>
isBifurcation(u, tol)
If both eigenvalues of the Hessian are different from zero, the critical point at u is a simple bifurcation point.

plot()
Implicit plotting method.
<private>
searchLine(fmi, fma, fix, interval, dir, num_components, dataX, dataY)
Recursively search a horizontal or vertical line for points on the fulfilling the given equation.
<private>
Tangent of norm 1 at point u.
<private>
Approximate tangent (of norm 1) with Quasi-Newton method
<private>
Starting at an initial point the curve is traced with a Euler-Newton method.
<private>
tracing(u0, direction)
Starting at a point u0, this routine traces the curve f(u)=0 until a loop is detected, a critical point is reached, the curve leaves the bounding box, or the maximum number of points is reached.
<private>
updateA(A, u0, u1)
Quasi-Newton update of the Moore-Penrose inverse.
Class Detail
JXG.Math.ImplicitPlot(bbox, config, f, dfx, dfy)
Plotting of curves which are given implicitly as the set of points solving an equation f(x,y) = 0.

The main class initializes a new implicit plot instance.

The algorithm should be able to plot most implicit curves as long as the equations are not too complex. We are aware of the paper by Oliver Labs, A List of Challenges for Real Algebraic Plane Curve Visualization Software which contains many equations where this algorithm may fail. For example, at the time being there is no attempt to detect solitary points. Also, it is always a trade off to find all components of the curve and keep the construction responsive.

Parameters:
{Array} bbox
Bounding box of the area in which solutions of the equation are determined.

{Object} config
Configuration object. Default:
``` {
resolution_out: 5,    // Horizontal resolution: distance between vertical lines to search for components
resolution_in: 5,     // Vertical resolution to search for components
max_steps: 1024,      // Max number of points in one call of tracing
alpha_0: 0.05,        // Angle between two successive tangents: smoothness of curve

tol_u0: Mat.eps,      // Tolerance to find starting points for tracing.
tol_newton: 1.0e-7,   // Tolerance for Newton steps.
tol_cusp: 0.05,       // Tolerance for cusp / bifurcation detection
tol_progress: 0.0001, // If two points are closer than this value, we bail out
qdt_box: 0.2,         // half of box size to search in qdt
kappa_0: 0.2,         // Inverse of planned number of Newton steps
delta_0: 0.05,        // Distance of predictor point to curve

h_initial: 0.1,       // Initial stepwidth
h_critical: 0.001,    // If h is below this threshold we bail out
h_max: 1,             // Maximal value of h (user units)
loop_dist: 0.09,      // Allowed distance (multiplied by actual stepwidth) to detect loop
loop_dir: 0.99,       // Should be > 0.95
loop_detection: true, // Use Gosper's loop detector
unitX: 10,            // unitX of board
unitY: 10             // unitX of board
};
```

{function} f
function from R2 to R

{function} dfx Optional
Optional partial derivative of f with regard to x

{function} dfy Optional
Optional partial derivative of f with regard to y

Examples:
```    var f = (x, y) => x**3 - 2 * x * y + y**3;
var c = board.create('curve', [[], []], {
strokeWidth: 3,
strokeColor: JXG.palette.red
});

c.updateDataArray = function () {
var bbox = this.board.getBoundingBox(),
ip, cfg,
ret = [],
mgn = 1;

bbox[0] -= mgn;
bbox[1] += mgn;
bbox[2] += mgn;
bbox[3] -= mgn;

cfg = {
resolution_out: 5,
resolution_in: 5,
unitX: this.board.unitX,
unitY: this.board.unitX
};

this.dataX = [];
this.dataY = [];
ip = new JXG.Math.ImplicitPlot(bbox, cfg, f, null, null);
ret = ip.plot();
this.dataX = ret[0];
this.dataY = ret[1];
};
board.update();
```

Method Detail
curveContainsPoint(p, dataX, dataY, tol, eps)
Test if the data points contain a given coordinate, i.e. if the given coordinate is close enough to the polygonal chain through the data points.
Parameters:
{Array} p
Homogenous coordinates [1, x, y] of the coordinate point
{Array} dataX
x-coordinates of points so far
{Array} dataY
y-coordinates of points so far
{Number} tol
Maximal distance of p from the polygonal chain through the data points
{Number} eps
Helper tolerance used for the quadtree
Returns:
Boolean

<private> {Array} handleCriticalPoint(u, t_u, r, omega)
Search in an arc around a critical point for a further point on the curve. Unused for the moment.
Parameters:
{Array} u
Critical point [x, y]
{Array} t_u
Tangent at u
{Number} r
{Number} omega
angle
Returns:
{Array} Coordinates [x, y] of a new point.

<private> isBifurcation(u, tol)
If both eigenvalues of the Hessian are different from zero, the critical point at u is a simple bifurcation point.
Parameters:
{Array} u
Critical point [x, y]
{Number} tol
Tolerance of the eigenvalues to be zero.
Returns:
Boolean True if the point is a simple bifurcation point.

{Array} plot()
Implicit plotting method.
Returns:
{Array} consisting of [dataX, dataY, number_of_components]

<private> {Array} searchLine(fmi, fma, fix, interval, dir, num_components, dataX, dataY)
Recursively search a horizontal or vertical line for points on the fulfilling the given equation.
Parameters:
{Function} fmi
Minimization function
{Function} fma
Maximization function
{Number} fix
Value of the fixed variable
{Array} interval
Search interval of the free variable
{String} dir
'vertical' or 'horizontal'
{Number} num_components
Number of components before search
{Array} dataX
x-coordinates of points so far
{Array} dataY
y-coordinates of points so far
Returns:
{Array} consisting of [dataX, dataY, number_of_components]-

<private> tangent(u)
Tangent of norm 1 at point u.
Parameters:
{Array} u
Point [x, y]
Returns:
Array

<private> tangent_A(A)
Approximate tangent (of norm 1) with Quasi-Newton method
Parameters:
{Array} A
Returns:
Array

<private> traceComponent(u0)
Starting at an initial point the curve is traced with a Euler-Newton method. After tracing in one direction the algorithm stops if the component is a closed loop. Otherwise, the curved is traced in the opposite direction, starting from the same initial point. Finally, the two components are glued together.
Parameters:
{Array} u0
Initial point in homogenous coordinates [1, x, y].
Returns:
Array [dataX, dataY] containing a new component.

<private> tracing(u0, direction)
Starting at a point u0, this routine traces the curve f(u)=0 until a loop is detected, a critical point is reached, the curve leaves the bounding box, or the maximum number of points is reached.

The method is a predictor / corrector method consisting of Euler and Newton steps together with step width adaption.

The algorithm is an adaption of the algorithm in Eugene L. Allgower, Kurt Georg: Introduction to Numerical Continuation methods.

Parameters:
{Array} u0
Starting point in homogenous coordinates [1, x, y].
{Number} direction
1 or -1
Returns:
Array [pathX, pathY, loop_closed] or []

<private> updateA(A, u0, u1)
Quasi-Newton update of the Moore-Penrose inverse. See (7.2.3) in Allgower, Georg.
Parameters:
{Array} A
{Array} u0
{Array} u1
Returns:
Array

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jun 28 2024 08:25:36 GMT+0200 (MitteleuropĂ¤ische Sommerzeit)