## `plot::implicit` -- implicit plot of smooth functions

#### Introduction

`plot::implicit` is used to get a plot of f=0 for a smooth f from |R^2->|R. f must be regular almost everywhere on this curve.

#### Call(s)

`plot::implicit(expr, x=a..b, y=c..d <, options>)`
`plot::implicit([expr, ...], x=a..b, y=c..d <, options>)`

#### Parameters

`expr` | - | function(s) to plot, given as arithmetical expression(s) in two identifiers
`x, y` | - | identifiers used in `expr`
`a..b, c..d` | - | ranges to plot

#### Options

`Grid = gridval` | - | grid division to use for finding starting points
`Colors = [col1...]` | - | colors used for plotting the components.
`MinStepsize = hmin` | - | minimum step-size for tracing a contour
`MaxStepsize = hmax` | - | maximum step-size for tracing a contour
`StartingStepsize = hstart` | - | step-size the iteration starts with
`Precision = eps` | - | precision of the Newton iteration
`Contours = [c1...]` | - | contours to plot
`Splines = Boolean` | - | If set to `TRUE`, the contours will be plotted with cubic splines; otherwise, straight lines will be used. Default: `FALSE`.
`Factor = Boolean` | - | If set to `TRUE`, each function will be factored prior to iterating. This may improve the results. Default: `FALSE`.

#### Returns

a graphical object of the domain type `plot::Group`.

#### Related Functions

`plot::contour`, `plotfunc2d`, `plot2d`

#### Details

- `plot::implicit` plots f=0 by a curve tracking method. For this, it first generates start points with a Newton iteration starting at grid points (the number of grid points can be controlled with the option Grid) and then iteratively applies the implicit function lemma to get a local approximation to the curve. This approximation is then improved with another Newton step. On hitting a point where f is not regular, the iteration stops.

#### Option: Grid = `gridval`

- `gridval` must either be a list of two positive integers, the number of divisions in the two coordinates, or a single integer, which is equivalent to repeating this integer twice.
- Increase this number if you suspect not all components are found. The default is `[5, 5]`.

#### Option: Colors = `[col1...]`

- The colors used for plotting the components. A list is expected, each element of which must be a valid argument for the `Color=[Flat,...]` option of `plot2d`.
- Default: `[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0], [1.0, 1.0, 0.0], [1.0, 0.0, 1.0], [0.0, 1.0, 1.0], [1.0, 1.0, 1.0]]`.

#### Option: MinStepsize = `hmin`

- The minimum step-size for the iteration following a contour. This is a lower limit for the adaptive iteration to avoid spending a lot of time without real progress.
- The default is 1/1.000.000 of the minimum of width or height of the area under consideration.
- Increase this number if you think the algorithm gets stuck in a place unimportant to your application.

#### Option: MaxStepsize = `hmax`

- MaxStepsize is complementary to MinStepsize in that it defines the maximum step-width for the iteration.
- If this value is set too high, the algorithm may skip over details of the curves; if it is set lower than needed, the computation takes longer.
- The default is 1/100 of the shorter of width and height.

#### Option: StartingStepsize = `hstart`

- The step-size the iteration starts with. The default is 1/1.000 of the shorter side of the area.

#### Option: Precision = `eps`

- This floating-point value indicates the relative precision which should be achieved in the Newton iteration.
- Lower values may lead to more accurate results, but slow down the computation. Values smaller than 10.0-DIGITS may cause the function not to return.
- The default is 10.02-DIGITS.

#### Option: Contours = `[c1...]`

- A list of values for which the functions implicitly defined by f(x,y)=ci should be plotted.
- Default: `[0]`.

#### Example 1

Let's have a look at elliptic curves:

    >> plot(
         plot::implicit((x^3 + x + 2) - y^2,
                        x = -5..5, y = -5..5),
         Scaling=Constrained
       )

#### Example 2

To demonstrate how to plot multiple implicit functions, we plot y=x^2, y=x and x=y^2:

    >> s:= plot::implicit(
         [x^2 - y, x - y, x - y^2], x = -4..4, y = -4..4
       ):
       plot(s)

#### Example 3

We plot the family x=y^2+c for c in [-5,5]:

    >> p:= plot::implicit(
         y^2 - x, x = -1..25, y = -5..5, Contours = [$-5..5]
       ):
       plot(p, Axes = Origin)

#### Example 4

`plot::implicit` handles quite complex expressions. In the following example, the circle around the origin is left out by many similar tools:

    >> plot(
         plot::implicit((1-0.99*exp(x^2+y^2))*(x^10-1-y),
                        x=-1.25..1.25,y=-1.1..2)
       ):

    >> F2 := (x,y) -> x^4*y^4+sin(x)*cos(y)-(x-1)*(y-2)*exp(-x^2):
       plot(plot::implicit(F2(x,y),x=-10..10,y=-10..10)):

    >> delete F2:

#### Example 5

In some cases, `DIGITS` must be increased to get a correct result. In the following example, problems occur around the origin with the default setting of `DIGITS` when a small region is to be displayed. First, we display the whole picture:

    >> F3 := (x,y) -> y*(3*x^2-y^2)-(x^2+y^2)^2:
       plot(plot::implicit(F3(x, y), x = -1..1, y = -1.3..0.7)):

Near the origin, numeric cancellation occurs. If you try to depict a small area around the origin of the above curve, you need to increase `DIGITS`:

    >> delete DIGITS:
       plot(
         plot::implicit(F3(x, y), x = -0.005..0.005, y = -0.005..0.005)
       ):

    >> DIGITS := 15:
       plot(
         plot::implicit(F3(x, y), x = -0.005..0.005, y = -0.005..0.005)
       ):
       delete DIGITS:

#### Example 6

We plot sin(5*sin(x)*y)=0. This is an example where multiple implicit functions are found. With a low setting of `DIGITS`, strange artefacts occur:

    >> DIGITS := 50:
       plot(
         plot::implicit(sin(5*sin(x)*y), x = -5..5, y = -5..5)
       ):
       delete DIGITS:

#### Background

- Curve Tracking algorithms are usually found in numerics to track stable and instable manifolds of dynamic systems and in homotopy methods for finding roots of highly complicated functions.

#### Changes

- new function

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000