Introduction

This module provides functionality for drawing real plane algebraic curves defined by a polynomial $f$ in two variables over $\mathbb{Q}$.

draw_curve_tikzFunction
draw_curve_tikz(filename::String, f_in; solver_precision::Int=128, graph::Bool=false, custom_edge_plot=nothing)

Takes a polynomial in two variables and constructs a plot of the resulting real algebraic curve in TikZ.

The algorithm is based on the critical points of $f$, points where both $f$ and its $y$-derivative vanish. If there are no such points, e.g. if $f$ is strictly positive everywhere or consists of a bunch of parallel lines, currently an NotImplementedError is thrown.

The red points are the singularities of $f$ and the blue points are the places where the tangent is parallel to the $y$-axis. However, a random transformation may have been applied beforehand, so the blue points may not be critical points in the original coordinate system.

Keyword arguments:

  • transform::Union{MatrixElem, AbstractMatrix}: Provide a matrix such that transforming the curve with said transformation results in a curve with generic set of critical points, i.e. distinct $x$-coordinates. The default is to loop over a hard-coded list of transformation matrices.
  • ntries::Int: Apply transform repeatedly to reach generic critical points, but at most ntries times.
  • graph::Bool=false: Only draw isotopy graph.

Examples

julia> fn = tempname();

julia> R, (x, y) = polynomial_ring(QQ, [:x, :y])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y])

julia> f = (x^2+y^2-1)*((x-1)^2+y^2-1)
x^4 - 2*x^3 + 2*x^2*y^2 - x^2 - 2*x*y^2 + 2*x + y^4 - y^2

julia> b = draw_curve_tikz(fn, f)

Restarting with another random linear form
Restarting with a non-random linear form
Restarting with another random linear form
Restarting with a non-random linear formtrue

julia> b
true
Experimental

This function is part of the experimental code in Oscar. Please read here for more details.

source
Curves without critical points

Currently our code is unable to deal with curves without critical points. These are points where both $f$ and its $y$-derivative vanish. Such situations arise for example if the curve consists just of a bunch of parallel lines, or a parabola, or is empty.