c19dc2da创建于 2022年9月16日历史提交

Implicit function

Plotting the zero level-set of a two-dimensional function.

Examples

  1. A simple function whose zero level-set is a hyperbola.

::

fimplicit({x:Float64, y:Float64 => pow(x, 2.0) - pow(y, 2.0) - 1.0})

Result:

.. image:: ../../../tests/imgs/fimplicit_plot/fimplicit_plot1.png :align: center :width: 360

  1. Plotting a contour with user-defined x and y limits.

::

fimplicit({x, y => pow(x, 2.0) + pow(y, 2.0) - 3.0},
    startx: -3.0, endx: 0.0, starty: -2.0, endy: 2.0)

Result:

.. image:: ../../../tests/imgs/fimplicit_plot/fimplicit_plot2.png :align: center :width: 360

  1. Plotting two contours.

::

fimplicit({x, y => pow(x, 2.0) + pow(y, 2.0) - 1.0})
hold(true)
fimplicit({x, y => pow(x, 2.0) + pow(y, 2.0) - 2.0}, line_spec: "--g")
.line_width(2.0)

Result:

.. image:: ../../../tests/imgs/fimplicit_plot/fimplicit_plot3.png :align: center :width: 360

  1. Plotting the contour of a complicated function.

::

fimplicit({x, y => y * sin(x) + x * cos(y)})
.color("r").line_style("--").line_width(2.0)

Result:

.. image:: ../../../tests/imgs/fimplicit_plot/fimplicit_plot4.png :align: center :width: 360

Methods

====================== ========================================== Method Description ====================== ========================================== fimplicit 1 method Plot implicit function ====================== ==========================================

Description

.. function:: fimplicit(f, startx!, endx!, starty!, endy!, mesh_density!, line_spec!)

:param f: (Float64, Float64)->Float64
:param startx: Float64 (optional, default -5.0)
:param endx: Float64 (optional, default 5.0)
:param starty: Float64 (optional, default -5.0)
:param endy: Float64 (optional, default 5.0)
:param mesh_density: Int64 (optional, default 100)
:param line_spec: String
:return: Line

Plot the given implicit function with the given boundaries and mesh density.