# JSXGraph 1.7.0 Reference

## JavaScript must be enabled in order for you to use JSXGraph and JSXGraph reference. However, it seems JavaScript is either disabled or not supported by your browser.

Class Index | File Index

Elements

Classes

- _global_
- Angle
- Arc
- Arrow
- Arrowparallel
- Axis
- Bisector
- Bisectorlines
- Boxplot
- Button
- Cardinalspline
- Chart
- Checkbox
- Circle
- Circumcenter
- Circumcircle
- CircumcircleArc
- CircumcircleSector
- Comb
- Conic
- Curve
- Curve3D
- CurveDifference
- CurveIntersection
- CurveUnion
- Derivative
- Ellipse
- ForeignObject
- Functiongraph
- Functiongraph3D
- Glider
- Grid
- Group
- Hatch
- Hyperbola
- Image
- ImplicitCurve
- Incenter
- Incircle
- Inequality
- Input
- Integral
- Intersection
- JXG
- JXG.AbstractRenderer
- JXG.Board
- JXG.Board.infobox
- JXG.C
- JXG.CA
- JXG.CanvasRenderer
- JXG.Chart
- JXG.Circle
- JXG.Complex
- JXG.Composition
- JXG.Coords
- JXG.CoordsElement
- JXG.Curve
- JXG.Curve3D
- JXG.Dump
- JXG.EventEmitter
- JXG.Expect
- JXG.ForeignObject
- JXG.GeometryElement
- JXG.GeometryElement3D
- JXG.GeonextParser
- JXG.Group
- JXG.Image
- JXG.JessieCode
- JXG.JSXGraph
- JXG.Legend
- JXG.Line
- JXG.Line3D
- JXG.Math
- JXG.Math.BoxQuadtree
- JXG.Math.Clip
- JXG.Math.Extrapolate
- JXG.Math.Geometry
- JXG.Math.ImplicitPlot
- JXG.Math.IntervalArithmetic
- JXG.Math.Metapost
- JXG.Math.Nlp
- JXG.Math.Numerics
- JXG.Math.Plot
- JXG.Math.Poly
- JXG.Math.Poly.Monomial
- JXG.Math.Poly.Polynomial
- JXG.Math.Poly.Ring
- JXG.Math.ProbFuncs
- JXG.Math.Quadtree
- JXG.Math.Statistics
- JXG.Math.Symbolic
- JXG.NoRenderer
- JXG.Options
- JXG.Plane3D
- JXG.Point
- JXG.Point3D
- JXG.Polygon
- JXG.PrefixParser
- JXG.Server
- JXG.Server.modules
- JXG.Surface3D
- JXG.SVGRenderer
- JXG.Text
- JXG.Ticks
- JXG.Transformation
- JXG.Turtle
- JXG.Util
- JXG.Util.Base64
- JXG.Util.Unzip
- JXG.Util.UTF8
- JXG.View3D
- JXG.VMLRenderer
- JXG.XML
- Label
- Legend
- Line
- Line3D
- Locus
- MajorArc
- MajorSector
- Measurement
- Metapostspline
- Midpoint
- MinorArc
- MinorSector
- mirrorelement
- Mirrorpoint
- NonReflexAngle
- Normal
- Orthogonalprojection
- OtherIntersection
- Parabola
- Parallel
- Parallelogram
- Parallelpoint
- ParametricSurface3D
- Perpendicular
- PerpendicularPoint
- PerpendicularSegment
- Point
- Point3D
- PolarLine
- PolePoint
- Polygon
- PolygonalChain
- RadicalAxis
- Reflection
- ReflexAngle
- RegularPolygon
- Riemannsum
- Sector
- Segment
- Semicircle
- Slider
- Slopefield
- Slopetriangle
- Smartlabel
- Spline
- Stepfunction
- Tangent
- Tapemeasure
- Text
- Ticks
- Tracecurve
- Transformation
- Turtle
- Vectorfield
- Vectorfield3D
- View3D

# 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(u) Tangent of norm 1 at point u.
<private> | tangent_A(A) Approximate tangent (of norm 1) with Quasi-Newton method
<private> | traceComponent(u0) 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
  Radius
{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 Thu Feb 15 2024 17:48:02 GMT+0000 (Coordinated Universal Time)