bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
def frequency_table(string): r""" Return the frequency table corresponding to the given string. INPUT: - ``string`` -- a string EXAMPLE:: sage: from sage.coding.source_coding.huffman import frequency_table sage: str = "Sage is my most favorite general purpose computer algebra system" sage: frequency_table(str) {'a': 5, ' ': 9, 'c': 1, 'b': 1, 'e': 8, 'g': 3, 'f': 1, 'i': 2, 'm': 4, 's': 5, 'o': 4, 'n': 1, 'p': 3, 'S': 1, 'r': 5, 'u': 2, 't': 4, 'v': 1, 'y': 2, 'l': 2} """ d = {} for l in string: d[l] = d.get(l,0) + 1 return d
|
def frequency_table(string): r""" Return the frequency table corresponding to the given string. INPUT: - ``string`` -- a string EXAMPLE:: sage: from sage.coding.source_coding.huffman import frequency_table sage: str = "Sage is my most favorite general purpose computer algebra system" sage: frequency_table(str) {'a': 5, ' ': 9, 'c': 1, 'b': 1, 'e': 8, 'g': 3, 'f': 1, 'i': 2, 'm': 4, 's': 5, 'o': 4, 'n': 1, 'p': 3, 'S': 1, 'r': 5, 'u': 2, 't': 4, 'v': 1, 'y': 2, 'l': 2} """ d = {} for l in string: d[l] = d.get(l,0) + 1 return d
| 473,000
|
def frequency_table(string): r""" Return the frequency table corresponding to the given string. INPUT: - ``string`` -- a string EXAMPLE:: sage: from sage.coding.source_coding.huffman import frequency_table sage: str = "Sage is my most favorite general purpose computer algebra system" sage: frequency_table(str) {'a': 5, ' ': 9, 'c': 1, 'b': 1, 'e': 8, 'g': 3, 'f': 1, 'i': 2, 'm': 4, 's': 5, 'o': 4, 'n': 1, 'p': 3, 'S': 1, 'r': 5, 'u': 2, 't': 4, 'v': 1, 'y': 2, 'l': 2} """ d = {} for l in string: d[l] = d.get(l,0) + 1 return d
|
def frequency_table(string): r""" Return the frequency table corresponding to the given string. INPUT: - ``string`` -- a string EXAMPLE:: sage: from sage.coding.source_coding.huffman import frequency_table sage: str = "Sage is my most favorite general purpose computer algebra system" sage: frequency_table(str) {'a': 5, ' ': 9, 'c': 1, 'b': 1, 'e': 8, 'g': 3, 'f': 1, 'i': 2, 'm': 4, 's': 5, 'o': 4, 'n': 1, 'p': 3, 'S': 1, 'r': 5, 'u': 2, 't': 4, 'v': 1, 'y': 2, 'l': 2} """ d = {} for l in string: d[l] = d.get(l,0) + 1 return d
| 473,001
|
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman
|
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman
| 473,002
|
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman
|
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman
| 473,003
|
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman
|
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman
| 473,004
|
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman
|
def __init__(self, string = None, frequencies = None): r""" Constructor for Huffman
| 473,005
|
def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix
|
def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix
| 473,006
|
def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix
|
def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix
| 473,007
|
def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix
|
def _build_code_from_tree(self, tree, d, prefix=''): r""" Builds the code corresponding to a given tree and prefix
| 473,008
|
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
|
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
| 473,009
|
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
|
def_build_code(self,dic):r"""ReturnsaHuffmancodeforeachoneofthegivenelements.
| 473,010
|
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
|
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
| 473,011
|
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
|
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
| 473,012
|
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
|
def _build_code(self, dic): r""" Returns a Huffman code for each one of the given elements.
| 473,013
|
def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table
|
def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table
| 473,014
|
def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table
|
defencode(self,string):r"""Returnsanencodingofthegivenstringbasedonthecurrentencodingtable
| 473,015
|
def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table
|
def encode(self, string): r""" Returns an encoding of the given string based on the current encoding table
| 473,016
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
| 473,017
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
| 473,018
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
| 473,019
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
| 473,020
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
| 473,021
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
| 473,022
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
|
def decode(self, string): r""" Returns a decoded version of the given string corresponding to the current encoding table.
| 473,023
|
def encoding_table(self): r""" Returns the current encoding table
|
def encoding_table(self): r""" Returns the current encoding table
| 473,024
|
def encoding_table(self): r""" Returns the current encoding table
|
def encoding_table(self): r""" Returns the current encoding table
| 473,025
|
def tree(self): r""" Returns the Huffman tree corresponding to the current encoding
|
def tree(self): r""" Returns the Huffman tree corresponding to the current encoding
| 473,026
|
def tree(self): r""" Returns the Huffman tree corresponding to the current encoding
|
def tree(self): r""" Returns the Huffman tree corresponding to the current encoding
| 473,027
|
def tree(self): r""" Returns the Huffman tree corresponding to the current encoding
|
def tree(self): r""" Returns the Huffman tree corresponding to the current encoding
| 473,028
|
def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root' else: u = father try: return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
|
def _generate_edges(self, tree, parent="", bit=""): """ Generate the edges of the given Huffman tree. INPUT: - ``tree`` -- a Huffman binary tree. - ``parent`` -- (default: empty string) a parent vertex with exactly two children. - ``bit`` -- (default: empty string) the bit signifying either the left or right branch. The bit "0" denotes the left branch and "1" denotes the right branch. OUTPUT: - An edge list of the Huffman binary tree. EXAMPLES:: sage: from sage.coding.source_coding.huffman import Huffman sage: H = Huffman("Sage") sage: T = H.tree() sage: T.edges(labels=None) [('0', 'S: 01'), ('0', 'a: 00'), ('1', 'e: 10'), ('1', 'g: 11'), ('root', '0'), ('root', '1')] """ if parent == "": u = "root" else: u = father try: return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
| 473,029
|
def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root' else: u = father try: return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
|
def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root' else: u = parent s = "".join([parent, bit]) try: return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
| 473,030
|
def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root' else: u = father try: return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
|
def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root' else: u = father try: return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
| 473,031
|
def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root' else: u = father try: return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
|
def _generate_edges(self, tree, father='', id=''): if father=='': u = 'root' else: u = father try: return self._generate_edges(tree[0], father=father+id, id='0') + \ self._generate_edges(tree[1], father=father+id, id='1') + \ ([(u, father+id)] if (father+id) != '' else [])
| 473,032
|
def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices.
|
def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices.
| 473,033
|
def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices.
|
def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices.
| 473,034
|
def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices.
|
def steiner_tree(self,vertices, weighted = False): r""" Returns a tree of minimum weight connecting the given set of vertices.
| 473,035
|
def cnf(self, xi=None, yi=None, format=None): """ Return a representation of this S-Box in conjunctive normal form.
|
def cnf(self, xi=None, yi=None, format=None): """ Return a representation of this S-Box in conjunctive normal form.
| 473,036
|
def cnf(self, xi=None, yi=None, format=None): """ Return a representation of this S-Box in conjunctive normal form.
|
def cnf(self, xi=None, yi=None, format=None): """ Return a representation of this S-Box in conjunctive normal form.
| 473,037
|
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
|
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
| 473,038
|
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
|
deflocal_coordinates_at_nonweierstrass(self,P,prec=20,name='t'):"""Foranon-WeierstrasspointP=(a,b)onthehyperellipticcurvey^2=f(x),returns(x(t),y(t))suchthat(y(t))^2=f(x(t)),wheret=x-aisthelocalparameter.
| 473,039
|
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
|
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
| 473,040
|
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
|
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
| 473,041
|
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
|
def local_coordinates_at_nonweierstrass(self, P, prec = 20, name = 't'): """ For a non-Weierstrass point P = (a,b) on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x - a is the local parameter.
| 473,042
|
def local_coordinates_at_weierstrass(self, P, prec = 20, name = 't'): """ For a finite Weierstrass point on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = y is the local parameter.
|
def local_coordinates_at_weierstrass(self, P, prec = 20, name = 't'): """ For a finite Weierstrass point on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = y is the local parameter.
| 473,043
|
def local_coordinates_at_weierstrass(self, P, prec = 20, name = 't'): """ For a finite Weierstrass point on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = y is the local parameter.
|
def local_coordinates_at_weierstrass(self, P, prec = 20, name = 't'): """ For a finite Weierstrass point on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = y is the local parameter.
| 473,044
|
def local_coordinates_at_weierstrass(self, P, prec = 20, name = 't'): """ For a finite Weierstrass point on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = y is the local parameter.
|
def local_coordinates_at_weierstrass(self, P, prec = 20, name = 't'): """ For a finite Weierstrass point on the hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = y is the local parameter.
| 473,045
|
def local_coordinates_at_infinity(self, prec = 20, name = 't'): """ For the genus g hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x^g/y is the local parameter at infinity
|
deflocal_coordinates_at_infinity(self,prec=20,name='t'):"""Forthegenusghyperellipticcurvey^2=f(x),returns(x(t),y(t))suchthat(y(t))^2=f(x(t)),wheret=x^g/yisthelocalparameteratinfinity
| 473,046
|
def local_coordinates_at_infinity(self, prec = 20, name = 't'): """ For the genus g hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x^g/y is the local parameter at infinity
|
deflocal_coordinates_at_infinity(self,prec=20,name='t'):"""Forthegenusghyperellipticcurvey^2=f(x),returns(x(t),y(t))suchthat(y(t))^2=f(x(t)),wheret=x^g/yisthelocalparameteratinfinity
| 473,047
|
def local_coordinates_at_infinity(self, prec = 20, name = 't'): """ For the genus g hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x^g/y is the local parameter at infinity
|
def local_coordinates_at_infinity(self, prec = 20, name = 't'): """ For the genus g hyperelliptic curve y^2 = f(x), returns (x(t), y(t)) such that (y(t))^2 = f(x(t)), where t = x^g/y is the local parameter at infinity
| 473,048
|
def local_coord(self, P, prec = 20, name = 't'): """ If P is not infinity, calls the appropriate local_coordinates function.
|
def local_coord(self, P, prec = 20, name = 't'): """ If P is not infinity, calls the appropriate local_coordinates function.
| 473,049
|
def local_coord(self, P, prec = 20, name = 't'): """ If P is not infinity, calls the appropriate local_coordinates function.
|
def local_coord(self, P, prec = 20, name = 't'): """ If P is not infinity, calls the appropriate local_coordinates function.
| 473,050
|
def super_categories(self): """ Returns a list of the immediate super categories of self.
|
def super_categories(self): """ Returns a list of the immediate super categories of self.
| 473,051
|
def one(self): r""" Returns the one of the monoid, that is the unique neutral element for `*`.
|
def one(self): r""" Returns the one of the monoid, that is the unique neutral element for `*`.
| 473,052
|
def one_element(self): r""" Backward compatibility alias for :meth:`self.one()`.
|
def one_element(self): r""" Backward compatibility alias for :meth:`self.one()`.
| 473,053
|
def prod(self, args): r""" n-ary product
|
def prod(self, args): r""" n-ary product
| 473,054
|
def prod(self, args): r""" n-ary product
|
defprod(self,args):r"""n-aryproduct
| 473,055
|
def is_one(self): r""" Returns whether self is the one of the monoid
|
def is_one(self): r""" Returns whether self is the one of the monoid
| 473,056
|
def __pow__(self, n): r""" INPUTS: - n: a non negative integer
|
def __pow__(self, n): r""" INPUTS: - n: a non negative integer
| 473,057
|
def _pow_naive(self, n): r""" A naive implementation of __pow__
|
def _pow_naive(self, n): r""" A naive implementation of __pow__
| 473,058
|
def _pow_naive(self, n): r""" A naive implementation of __pow__
|
def _pow_naive(self, n): r""" A naive implementation of __pow__
| 473,059
|
def _pow_naive(self, n): r""" A naive implementation of __pow__
|
def _pow_naive(self, n): r""" A naive implementation of __pow__
| 473,060
|
def tachyon_repr(self, render_params): """ Returns representation of the point suitable for plotting using the Tachyon ray tracer.
|
def tachyon_repr(self, render_params): """ Returns representation of the point suitable for plotting using the Tachyon ray tracer.
| 473,061
|
def obj_repr(self, render_params): """ Returns complete representation of the point as a sphere.
|
def obj_repr(self, render_params): """ Returns complete representation of the point as a sphere.
| 473,062
|
def tachyon_repr(self, render_params): """ Returns representation of the line suitable for plotting using the Tachyon ray tracer.
|
def tachyon_repr(self, render_params): """ Returns representation of the line suitable for plotting using the Tachyon ray tracer.
| 473,063
|
def _render_on_subplot(self, subplot): """ TESTS:
|
def _render_on_subplot(self, subplot): """ TESTS:
| 473,064
|
def _render_on_subplot(self, subplot): """ TESTS:
|
def _render_on_subplot(self, subplot): """ TESTS:
| 473,065
|
def _render_on_subplot(self, subplot): """ TESTS:
|
def _render_on_subplot(self, subplot): """ TESTS:
| 473,066
|
def contour_plot(f, xrange, yrange, **options): r""" ``contour_plot`` takes a function of two variables, `f(x,y)` and plots contour lines of the function over the specified ``xrange`` and ``yrange`` as demonstrated below. ``contour_plot(f, (xmin, xmax), (ymin, ymax), ...)`` INPUT: - ``f`` -- a function of two variables - ``(xmin, xmax)`` -- 2-tuple, the range of ``x`` values OR 3-tuple ``(x,xmin,xmax)`` - ``(ymin, ymax)`` -- 2-tuple, the range of ``y`` values OR 3-tuple ``(y,ymin,ymax)`` The following inputs must all be passed in as named parameters: - ``plot_points`` -- integer (default: 100); number of points to plot in each direction of the grid. For old computers, 25 is fine, but should not be used to verify specific intersection points. - ``fill`` -- bool (default: ``True``), whether to color in the area between contour lines - ``cmap`` -- a colormap (default: ``'gray'``), the name of a predefined colormap, a list of colors or an instance of a matplotlib Colormap. Type: ``import matplotlib.cm; matplotlib.cm.datad.keys()`` for available colormap names. - ``contours`` -- integer or list of numbers (default: ``None``): If a list of numbers is given, then this specifies the contour levels to use. If an integer is given, then this many contour lines are used, but the exact levels are determined automatically. If ``None`` is passed (or the option is not given), then the number of contour lines is determined automatically, and is usually about 5. - ``linewidths`` -- integer or list of integer (default: None), if a single integer all levels will be of the width given, otherwise the levels will be plotted with the width in the order given. If the list is shorter than the number of contours, then the widths will be repeated cyclically. - ``linestyles`` -- string or list of strings (default: None), the style of the lines to be plotted, one of: solid, dashed, dashdot, or dotted. If the list is shorter than the number of contours, then the styles will be repeated cyclically. - ``labels`` -- boolean (default: False) Show level labels or not. The following options are to adjust the style and placement of labels, they have no effect if no labels are shown. - ``label_fontsize`` -- integer (default: 9), the font size of the labels. - ``label_colors`` -- string or sequence of colors (default: None) If a string, gives the name of a single color with which to draw all labels. If a sequence, gives the colors of the labels. A color is a string giving the name of one or a 3-tuple of floats. - ``label_inline`` -- boolean (default: False if fill is True, otherwise True), controls whether the underlying contour is removed or not. - ``label_inline_spacing`` -- integer (default: 3), When inline, this is the amount of contour that is removed from each side, in pixels. - ``label_fmt`` -- a format string (default: "%1.2f"), this is used to get the label text from the level. This can also be a dictionary with the contour levels as keys and corresponding text string labels as values. EXAMPLES: Here we plot a simple function of two variables. Note that since the input function is an expression, we need to explicitly declare the variables in 3-tuples for the range:: sage: x,y = var('x,y') sage: contour_plot(cos(x^2+y^2), (x, -4, 4), (y, -4, 4)) Here we change the ranges and add some options:: sage: x,y = var('x,y') sage: contour_plot((x^2)*cos(x*y), (x, -10, 5), (y, -5, 5), fill=False, plot_points=150) An even more complicated plot:: sage: x,y = var('x,y') sage: contour_plot(sin(x^2 + y^2)*cos(x)*sin(y), (x, -4, 4), (y, -4, 4),plot_points=150) Some elliptic curves, but with symbolic endpoints. In the first example, the plot is rotated 90 degrees because we switch the variables `x`, `y`:: sage: x,y = var('x,y') sage: contour_plot(y^2 + 1 - x^3 - x, (y,-pi,pi), (x,-pi,pi)) :: sage: contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi)) We can play with the contour levels:: sage: x,y = var('x,y') sage: f(x,y) = x^2 + y^2 sage: contour_plot(f, (-2, 2), (-2, 2)) :: sage: contour_plot(f, (-2, 2), (-2, 2), contours=2, cmap=[(1,0,0), (0,1,0), (0,0,1)]) :: sage: contour_plot(f, (-2, 2), (-2, 2), contours=(0.1, 1.0, 1.2, 1.4), cmap='hsv') :: sage: contour_plot(f, (-2, 2), (-2, 2), contours=(1.0,), fill=False, aspect_ratio=1) :: sage: contour_plot(x-y^2,(x,-5,5),(y,-3,3),contours=[-4,0,1]) We can change the style of the lines:: sage: contour_plot(f, (-2,2), (-2,2), fill=False, linewidths=10) :: sage: contour_plot(f, (-2,2), (-2,2), fill=False, linestyles='dashdot') :: sage: P=contour_plot(x^2-y^2,(x,-3,3),(y,-3,3),contours=[0,1,2,3,4],\ ... linewidths=[1,5],linestyles=['solid','dashed'],fill=False) sage: P :: sage: P=contour_plot(x^2-y^2,(x,-3,3),(y,-3,3),contours=[0,1,2,3,4],\ ... linewidths=[1,5],linestyles=['solid','dashed']) sage: P We can add labels and play with them:: sage: contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), fill=False, cmap='hsv', labels=True) :: sage: P=contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), fill=False, cmap='hsv',\ ... labels=True, label_fmt="%1.0f", label_colors='black') sage: P :: sage: P=contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), fill=False, cmap='hsv',labels=True,\ ... contours=[-4,0,4], label_fmt={-4:"low", 0:"medium", 4: "hi"}, label_colors='black') sage: P :: sage: P=contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), \ ... fill=False, cmap='hsv', labels=True, label_fontsize=18) sage: P :: sage: P=contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), \ ... fill=False, cmap='hsv', labels=True, label_inline_spacing=1) sage: P :: sage: P= contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), \ ... fill=False, cmap='hsv', labels=True, label_inline=False) sage: P If fill is True (the default), then we may have to color the labels so that we can see them:: sage: contour_plot(f, (-2,2), (-2,2), labels=True, label_colors='red') This should plot concentric circles centered at the origin:: sage: x,y = var('x,y') sage: contour_plot(x^2+y^2-2,(x,-1,1), (y,-1,1)).show(aspect_ratio=1) Extra options will get passed on to show(), as long as they are valid:: sage: f(x, y) = cos(x) + sin(y) sage: contour_plot(f, (0, pi), (0, pi), axes=True) :: sage: contour_plot(f, (0, pi), (0, pi)).show(axes=True) # These are equivalent Note that with ``fill=False`` and grayscale contours, there is the possibility of confusion between the contours and the axes, so use ``fill=False`` together with ``axes=True`` with caution:: sage: contour_plot(f, (-pi, pi), (-pi, pi), fill=False, axes=True) TESTS: To check that ticket 5221 is fixed, note that this has three curves, not two:: sage: x,y = var('x,y') sage: contour_plot(x-y^2,(x,-5,5),(y,-3,3),contours=[-4,-2,0], fill=False) """ from sage.plot.plot import Graphics from sage.plot.misc import setup_for_eval_on_grid g, ranges = setup_for_eval_on_grid([f], [xrange, yrange], options['plot_points']) g = g[0] xrange,yrange=[r[:2] for r in ranges] xy_data_array = [[g(x, y) for x in xsrange(*ranges[0], include_endpoint=True)] for y in xsrange(*ranges[1], include_endpoint=True)] g = Graphics() g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax'])) g.add_primitive(ContourPlot(xy_data_array, xrange, yrange, options)) return g
|
def contour_plot(f, xrange, yrange, **options): r""" ``contour_plot`` takes a function of two variables, `f(x,y)` and plots contour lines of the function over the specified ``xrange`` and ``yrange`` as demonstrated below. ``contour_plot(f, (xmin, xmax), (ymin, ymax), ...)`` INPUT: - ``f`` -- a function of two variables - ``(xmin, xmax)`` -- 2-tuple, the range of ``x`` values OR 3-tuple ``(x,xmin,xmax)`` - ``(ymin, ymax)`` -- 2-tuple, the range of ``y`` values OR 3-tuple ``(y,ymin,ymax)`` The following inputs must all be passed in as named parameters: - ``plot_points`` -- integer (default: 100); number of points to plot in each direction of the grid. For old computers, 25 is fine, but should not be used to verify specific intersection points. - ``fill`` -- bool (default: ``True``), whether to color in the area between contour lines - ``cmap`` -- a colormap (default: ``'gray'``), the name of a predefined colormap, a list of colors or an instance of a matplotlib Colormap. Type: ``import matplotlib.cm; matplotlib.cm.datad.keys()`` for available colormap names. - ``contours`` -- integer or list of numbers (default: ``None``): If a list of numbers is given, then this specifies the contour levels to use. If an integer is given, then this many contour lines are used, but the exact levels are determined automatically. If ``None`` is passed (or the option is not given), then the number of contour lines is determined automatically, and is usually about 5. - ``linewidths`` -- integer or list of integer (default: None), if a single integer all levels will be of the width given, otherwise the levels will be plotted with the width in the order given. If the list is shorter than the number of contours, then the widths will be repeated cyclically. - ``linestyles`` -- string or list of strings (default: None), the style of the lines to be plotted, one of: solid, dashed, dashdot, or dotted. If the list is shorter than the number of contours, then the styles will be repeated cyclically. - ``labels`` -- boolean (default: False) Show level labels or not. The following options are to adjust the style and placement of labels, they have no effect if no labels are shown. - ``label_fontsize`` -- integer (default: 9), the font size of the labels. - ``label_colors`` -- string or sequence of colors (default: None) If a string, gives the name of a single color with which to draw all labels. If a sequence, gives the colors of the labels. A color is a string giving the name of one or a 3-tuple of floats. - ``label_inline`` -- boolean (default: False if fill is True, otherwise True), controls whether the underlying contour is removed or not. - ``label_inline_spacing`` -- integer (default: 3), When inline, this is the amount of contour that is removed from each side, in pixels. - ``label_fmt`` -- a format string (default: "%1.2f"), this is used to get the label text from the level. This can also be a dictionary with the contour levels as keys and corresponding text string labels as values. EXAMPLES: Here we plot a simple function of two variables. Note that since the input function is an expression, we need to explicitly declare the variables in 3-tuples for the range:: sage: x,y = var('x,y') sage: contour_plot(cos(x^2+y^2), (x, -4, 4), (y, -4, 4)) Here we change the ranges and add some options:: sage: x,y = var('x,y') sage: contour_plot((x^2)*cos(x*y), (x, -10, 5), (y, -5, 5), fill=False, plot_points=150) An even more complicated plot:: sage: x,y = var('x,y') sage: contour_plot(sin(x^2 + y^2)*cos(x)*sin(y), (x, -4, 4), (y, -4, 4),plot_points=150) Some elliptic curves, but with symbolic endpoints. In the first example, the plot is rotated 90 degrees because we switch the variables `x`, `y`:: sage: x,y = var('x,y') sage: contour_plot(y^2 + 1 - x^3 - x, (y,-pi,pi), (x,-pi,pi)) :: sage: contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi)) We can play with the contour levels:: sage: x,y = var('x,y') sage: f(x,y) = x^2 + y^2 sage: contour_plot(f, (-2, 2), (-2, 2)) :: sage: contour_plot(f, (-2, 2), (-2, 2), contours=2, cmap=[(1,0,0), (0,1,0), (0,0,1)]) :: sage: contour_plot(f, (-2, 2), (-2, 2), contours=(0.1, 1.0, 1.2, 1.4), cmap='hsv') :: sage: contour_plot(f, (-2, 2), (-2, 2), contours=(1.0,), fill=False, aspect_ratio=1) :: sage: contour_plot(x-y^2,(x,-5,5),(y,-3,3),contours=[-4,0,1]) We can change the style of the lines:: sage: contour_plot(f, (-2,2), (-2,2), fill=False, linewidths=10) :: sage: contour_plot(f, (-2,2), (-2,2), fill=False, linestyles='dashdot') :: sage: P=contour_plot(x^2-y^2,(x,-3,3),(y,-3,3),contours=[0,1,2,3,4],\ ... linewidths=[1,5],linestyles=['solid','dashed'],fill=False) sage: P :: sage: P=contour_plot(x^2-y^2,(x,-3,3),(y,-3,3),contours=[0,1,2,3,4],\ ... linewidths=[1,5],linestyles=['solid','dashed']) sage: P We can add labels and play with them:: sage: contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), fill=False, cmap='hsv', labels=True) :: sage: P=contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), fill=False, cmap='hsv',\ ... labels=True, label_fmt="%1.0f", label_colors='black') sage: P :: sage: P=contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), fill=False, cmap='hsv',labels=True,\ ... contours=[-4,0,4], label_fmt={-4:"low", 0:"medium", 4: "hi"}, label_colors='black') sage: P :: sage: P=contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), \ ... fill=False, cmap='hsv', labels=True, label_fontsize=18) sage: P :: sage: P=contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), \ ... fill=False, cmap='hsv', labels=True, label_inline_spacing=1) sage: P :: sage: P= contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), \ ... fill=False, cmap='hsv', labels=True, label_inline=False) sage: P We can change the color of the labels if so desired:: sage: contour_plot(f, (-2,2), (-2,2), labels=True, label_colors='red') This should plot concentric circles centered at the origin:: sage: x,y = var('x,y') sage: contour_plot(x^2+y^2-2,(x,-1,1), (y,-1,1)).show(aspect_ratio=1) Extra options will get passed on to show(), as long as they are valid:: sage: f(x, y) = cos(x) + sin(y) sage: contour_plot(f, (0, pi), (0, pi), axes=True) :: sage: contour_plot(f, (0, pi), (0, pi)).show(axes=True) # These are equivalent Note that with ``fill=False`` and grayscale contours, there is the possibility of confusion between the contours and the axes, so use ``fill=False`` together with ``axes=True`` with caution:: sage: contour_plot(f, (-pi, pi), (-pi, pi), fill=False, axes=True) TESTS: To check that ticket 5221 is fixed, note that this has three curves, not two:: sage: x,y = var('x,y') sage: contour_plot(x-y^2,(x,-5,5),(y,-3,3),contours=[-4,-2,0], fill=False) """ from sage.plot.plot import Graphics from sage.plot.misc import setup_for_eval_on_grid g, ranges = setup_for_eval_on_grid([f], [xrange, yrange], options['plot_points']) g = g[0] xrange,yrange=[r[:2] for r in ranges] xy_data_array = [[g(x, y) for x in xsrange(*ranges[0], include_endpoint=True)] for y in xsrange(*ranges[1], include_endpoint=True)] g = Graphics() g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax'])) g.add_primitive(ContourPlot(xy_data_array, xrange, yrange, options)) return g
| 473,067
|
def region_plot(f, xrange, yrange, plot_points, incol, outcol, bordercol, borderstyle, borderwidth,**options): r""" ``region_plot`` takes a boolean function of two variables, `f(x,y)` and plots the region where f is True over the specified ``xrange`` and ``yrange`` as demonstrated below. ``region_plot(f, (xmin, xmax), (ymin, ymax), ...)`` INPUT: - ``f`` -- a boolean function of two variables - ``(xmin, xmax)`` -- 2-tuple, the range of ``x`` values OR 3-tuple ``(x,xmin,xmax)`` - ``(ymin, ymax)`` -- 2-tuple, the range of ``y`` values OR 3-tuple ``(y,ymin,ymax)`` - ``plot_points`` -- integer (default: 100); number of points to plot in each direction of the grid - ``incol`` -- a color (default: ``'blue'``), the color inside the region - ``outcol`` -- a color (default: ``'white'``), the color of the outside of the region If any of these options are specified, the border will be shown as indicated, otherwise it is only implicit (with color ``incol``) as the border of the inside of the region. - ``bordercol`` -- a color (default: ``None``), the color of the border (``'black'`` if ``borderwidth`` or ``borderstyle`` is specified but not ``bordercol``) - ``borderstyle`` -- string (default: 'solid'), one of 'solid', 'dashed', 'dotted', 'dashdot' - ``borderwidth`` -- integer (default: None), the width of the border in pixels EXAMPLES: Here we plot a simple function of two variables:: sage: x,y = var('x,y') sage: region_plot(cos(x^2+y^2) <= 0, (x, -3, 3), (y, -3, 3)) Here we play with the colors:: sage: region_plot(x^2+y^3 < 2, (x, -2, 2), (y, -2, 2), incol='lightblue', bordercol='gray') An even more complicated plot, with dashed borders:: sage: region_plot(sin(x)*sin(y) >= 1/4, (x,-10,10), (y,-10,10), incol='yellow', bordercol='black', borderstyle='dashed', plot_points=250) A disk centered at the origin:: sage: region_plot(x^2+y^2<1, (x,-1,1), (y,-1,1), aspect_ratio=1) A plot with more than one condition (all conditions must be true for the statement to be true):: sage: region_plot([x^2+y^2<1, x<y], (x,-2,2), (y,-2,2), aspect_ratio=1) Since it doesn't look very good, let's increase plot_points:: sage: region_plot([x^2+y^2<1, x<y], (x,-2,2), (y,-2,2), plot_points=400, aspect_ratio=1) To get plots where only one condition needs to be true, use a function:: sage: region_plot(lambda x,y: x^2+y^2<1 or x<y, (x,-2,2), (y,-2,2), aspect_ratio=1) The first quadrant of the unit circle:: sage: region_plot([y>0, x>0, x^2+y^2<1], (x,-1.1, 1.1), (y,-1.1, 1.1), plot_points = 400, aspect_ratio=1) Here is another plot, with a huge border:: sage: region_plot(x*(x-1)*(x+1)+y^2<0, (x, -3, 2), (y, -3, 3), incol='lightblue', bordercol='gray', borderwidth=10, plot_points=50) If we want to keep only the region where x is positive:: sage: region_plot([x*(x-1)*(x+1)+y^2<0, x>-1], (x, -3, 2), (y, -3, 3), incol='lightblue', plot_points=50) Here we have a cut circle:: sage: region_plot([x^2+y^2<4, x>-1], (x, -2, 2), (y, -2, 2), incol='lightblue', bordercol='gray', plot_points=200, aspect_ratio=1) The first variable range corresponds to the horizontal axis and the second variable range corresponds to the vertical axis:: sage: s,t=var('s,t') sage: region_plot(s>0,(t,-2,2),(s,-2,2)) sage: region_plot(s>0,(s,-2,2),(t,-2,2)) """ from sage.plot.plot import Graphics from sage.plot.misc import setup_for_eval_on_grid import numpy if not isinstance(f, (list, tuple)): f = [f] f = [equify(g) for g in f] g, ranges = setup_for_eval_on_grid(f, [xrange, yrange], plot_points) xrange,yrange=[r[:2] for r in ranges] xy_data_arrays = numpy.asarray([[[func(x, y) for x in xsrange(*ranges[0], include_endpoint=True)] for y in xsrange(*ranges[1], include_endpoint=True)] for func in g],dtype=float) xy_data_array=numpy.abs(xy_data_arrays.prod(axis=0)) # Now we need to set entries to negative iff all # functions were negative at that point. neg_indices = (xy_data_arrays<0).all(axis=0) xy_data_array[neg_indices]=-xy_data_array[neg_indices] from matplotlib.colors import ListedColormap incol = rgbcolor(incol) outcol = rgbcolor(outcol) cmap = ListedColormap([incol, outcol]) cmap.set_over(outcol) cmap.set_under(incol) g = Graphics() g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax'])) g.add_primitive(ContourPlot(xy_data_array, xrange,yrange, dict(contours=[-1e307, 0, 1e307], cmap=cmap, fill=True, labels=False, **options))) if bordercol or borderstyle or borderwidth: cmap = [rgbcolor(bordercol)] if bordercol else ['black'] linestyles = [borderstyle] if borderstyle else None linewidths = [borderwidth] if borderwidth else None g.add_primitive(ContourPlot(xy_data_array, xrange, yrange, dict( linestyles=linestyles, linewidths=linewidths, contours=[0], cmap=[bordercol], fill=False, labels=False, **options))) return g
|
def region_plot(f, xrange, yrange, plot_points, incol, outcol, bordercol, borderstyle, borderwidth,**options): r""" ``region_plot`` takes a boolean function of two variables, `f(x,y)` and plots the region where f is True over the specified ``xrange`` and ``yrange`` as demonstrated below. ``region_plot(f, (xmin, xmax), (ymin, ymax), ...)`` INPUT: - ``f`` -- a boolean function of two variables - ``(xmin, xmax)`` -- 2-tuple, the range of ``x`` values OR 3-tuple ``(x,xmin,xmax)`` - ``(ymin, ymax)`` -- 2-tuple, the range of ``y`` values OR 3-tuple ``(y,ymin,ymax)`` - ``plot_points`` -- integer (default: 100); number of points to plot in each direction of the grid - ``incol`` -- a color (default: ``'blue'``), the color inside the region - ``outcol`` -- a color (default: ``'white'``), the color of the outside of the region If any of these options are specified, the border will be shown as indicated, otherwise it is only implicit (with color ``incol``) as the border of the inside of the region. - ``bordercol`` -- a color (default: ``None``), the color of the border (``'black'`` if ``borderwidth`` or ``borderstyle`` is specified but not ``bordercol``) - ``borderstyle`` -- string (default: 'solid'), one of 'solid', 'dashed', 'dotted', 'dashdot' - ``borderwidth`` -- integer (default: None), the width of the border in pixels EXAMPLES: Here we plot a simple function of two variables:: sage: x,y = var('x,y') sage: region_plot(cos(x^2+y^2) <= 0, (x, -3, 3), (y, -3, 3)) Here we play with the colors:: sage: region_plot(x^2+y^3 < 2, (x, -2, 2), (y, -2, 2), incol='lightblue', bordercol='gray') An even more complicated plot, with dashed borders:: sage: region_plot(sin(x)*sin(y) >= 1/4, (x,-10,10), (y,-10,10), incol='yellow', bordercol='black', borderstyle='dashed', plot_points=250) A disk centered at the origin:: sage: region_plot(x^2+y^2<1, (x,-1,1), (y,-1,1), aspect_ratio=1) A plot with more than one condition (all conditions must be true for the statement to be true):: sage: region_plot([x^2+y^2<1, x<y], (x,-2,2), (y,-2,2), aspect_ratio=1) Since it doesn't look very good, let's increase plot_points:: sage: region_plot([x^2+y^2<1, x<y], (x,-2,2), (y,-2,2), plot_points=400, aspect_ratio=1) To get plots where only one condition needs to be true, use a function:: sage: region_plot(lambda x,y: x^2+y^2<1 or x<y, (x,-2,2), (y,-2,2), aspect_ratio=1) The first quadrant of the unit circle:: sage: region_plot([y>0, x>0, x^2+y^2<1], (x,-1.1, 1.1), (y,-1.1, 1.1), plot_points = 400, aspect_ratio=1) Here is another plot, with a huge border:: sage: region_plot(x*(x-1)*(x+1)+y^2<0, (x, -3, 2), (y, -3, 3), incol='lightblue', bordercol='gray', borderwidth=10, plot_points=50) If we want to keep only the region where x is positive:: sage: region_plot([x*(x-1)*(x+1)+y^2<0, x>-1], (x, -3, 2), (y, -3, 3), incol='lightblue', plot_points=50) Here we have a cut circle:: sage: region_plot([x^2+y^2<4, x>-1], (x, -2, 2), (y, -2, 2), incol='lightblue', bordercol='gray', plot_points=200, aspect_ratio=1) The first variable range corresponds to the horizontal axis and the second variable range corresponds to the vertical axis:: sage: s,t=var('s,t') sage: region_plot(s>0,(t,-2,2),(s,-2,2)) sage: region_plot(s>0,(s,-2,2),(t,-2,2)) """ from sage.plot.plot import Graphics from sage.plot.misc import setup_for_eval_on_grid import numpy if not isinstance(f, (list, tuple)): f = [f] f = [equify(g) for g in f] g, ranges = setup_for_eval_on_grid(f, [xrange, yrange], plot_points) xrange,yrange=[r[:2] for r in ranges] xy_data_arrays = numpy.asarray([[[func(x, y) for x in xsrange(*ranges[0], include_endpoint=True)] for y in xsrange(*ranges[1], include_endpoint=True)] for func in g],dtype=float) xy_data_array=numpy.abs(xy_data_arrays.prod(axis=0)) # Now we need to set entries to negative iff all # functions were negative at that point. neg_indices = (xy_data_arrays<0).all(axis=0) xy_data_array[neg_indices]=-xy_data_array[neg_indices] from matplotlib.colors import ListedColormap incol = rgbcolor(incol) outcol = rgbcolor(outcol) cmap = ListedColormap([incol, outcol]) cmap.set_over(outcol) cmap.set_under(incol) g = Graphics() g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax'])) g.add_primitive(ContourPlot(xy_data_array, xrange,yrange, dict(contours=[-1e307, 0, 1e307], cmap=cmap, fill=True, labels=False, **options))) if bordercol or borderstyle or borderwidth: cmap = [rgbcolor(bordercol)] if bordercol else ['black'] linestyles = [borderstyle] if borderstyle else None linewidths = [borderwidth] if borderwidth else None g.add_primitive(ContourPlot(xy_data_array, xrange, yrange, dict( linestyles=linestyles, linewidths=linewidths, contours=[0], cmap=[bordercol], fill=False, labels=False, **options))) return g
| 473,068
|
def region_plot(f, xrange, yrange, plot_points, incol, outcol, bordercol, borderstyle, borderwidth,**options): r""" ``region_plot`` takes a boolean function of two variables, `f(x,y)` and plots the region where f is True over the specified ``xrange`` and ``yrange`` as demonstrated below. ``region_plot(f, (xmin, xmax), (ymin, ymax), ...)`` INPUT: - ``f`` -- a boolean function of two variables - ``(xmin, xmax)`` -- 2-tuple, the range of ``x`` values OR 3-tuple ``(x,xmin,xmax)`` - ``(ymin, ymax)`` -- 2-tuple, the range of ``y`` values OR 3-tuple ``(y,ymin,ymax)`` - ``plot_points`` -- integer (default: 100); number of points to plot in each direction of the grid - ``incol`` -- a color (default: ``'blue'``), the color inside the region - ``outcol`` -- a color (default: ``'white'``), the color of the outside of the region If any of these options are specified, the border will be shown as indicated, otherwise it is only implicit (with color ``incol``) as the border of the inside of the region. - ``bordercol`` -- a color (default: ``None``), the color of the border (``'black'`` if ``borderwidth`` or ``borderstyle`` is specified but not ``bordercol``) - ``borderstyle`` -- string (default: 'solid'), one of 'solid', 'dashed', 'dotted', 'dashdot' - ``borderwidth`` -- integer (default: None), the width of the border in pixels EXAMPLES: Here we plot a simple function of two variables:: sage: x,y = var('x,y') sage: region_plot(cos(x^2+y^2) <= 0, (x, -3, 3), (y, -3, 3)) Here we play with the colors:: sage: region_plot(x^2+y^3 < 2, (x, -2, 2), (y, -2, 2), incol='lightblue', bordercol='gray') An even more complicated plot, with dashed borders:: sage: region_plot(sin(x)*sin(y) >= 1/4, (x,-10,10), (y,-10,10), incol='yellow', bordercol='black', borderstyle='dashed', plot_points=250) A disk centered at the origin:: sage: region_plot(x^2+y^2<1, (x,-1,1), (y,-1,1), aspect_ratio=1) A plot with more than one condition (all conditions must be true for the statement to be true):: sage: region_plot([x^2+y^2<1, x<y], (x,-2,2), (y,-2,2), aspect_ratio=1) Since it doesn't look very good, let's increase plot_points:: sage: region_plot([x^2+y^2<1, x<y], (x,-2,2), (y,-2,2), plot_points=400, aspect_ratio=1) To get plots where only one condition needs to be true, use a function:: sage: region_plot(lambda x,y: x^2+y^2<1 or x<y, (x,-2,2), (y,-2,2), aspect_ratio=1) The first quadrant of the unit circle:: sage: region_plot([y>0, x>0, x^2+y^2<1], (x,-1.1, 1.1), (y,-1.1, 1.1), plot_points = 400, aspect_ratio=1) Here is another plot, with a huge border:: sage: region_plot(x*(x-1)*(x+1)+y^2<0, (x, -3, 2), (y, -3, 3), incol='lightblue', bordercol='gray', borderwidth=10, plot_points=50) If we want to keep only the region where x is positive:: sage: region_plot([x*(x-1)*(x+1)+y^2<0, x>-1], (x, -3, 2), (y, -3, 3), incol='lightblue', plot_points=50) Here we have a cut circle:: sage: region_plot([x^2+y^2<4, x>-1], (x, -2, 2), (y, -2, 2), incol='lightblue', bordercol='gray', plot_points=200, aspect_ratio=1) The first variable range corresponds to the horizontal axis and the second variable range corresponds to the vertical axis:: sage: s,t=var('s,t') sage: region_plot(s>0,(t,-2,2),(s,-2,2)) sage: region_plot(s>0,(s,-2,2),(t,-2,2)) """ from sage.plot.plot import Graphics from sage.plot.misc import setup_for_eval_on_grid import numpy if not isinstance(f, (list, tuple)): f = [f] f = [equify(g) for g in f] g, ranges = setup_for_eval_on_grid(f, [xrange, yrange], plot_points) xrange,yrange=[r[:2] for r in ranges] xy_data_arrays = numpy.asarray([[[func(x, y) for x in xsrange(*ranges[0], include_endpoint=True)] for y in xsrange(*ranges[1], include_endpoint=True)] for func in g],dtype=float) xy_data_array=numpy.abs(xy_data_arrays.prod(axis=0)) # Now we need to set entries to negative iff all # functions were negative at that point. neg_indices = (xy_data_arrays<0).all(axis=0) xy_data_array[neg_indices]=-xy_data_array[neg_indices] from matplotlib.colors import ListedColormap incol = rgbcolor(incol) outcol = rgbcolor(outcol) cmap = ListedColormap([incol, outcol]) cmap.set_over(outcol) cmap.set_under(incol) g = Graphics() g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax'])) g.add_primitive(ContourPlot(xy_data_array, xrange,yrange, dict(contours=[-1e307, 0, 1e307], cmap=cmap, fill=True, labels=False, **options))) if bordercol or borderstyle or borderwidth: cmap = [rgbcolor(bordercol)] if bordercol else ['black'] linestyles = [borderstyle] if borderstyle else None linewidths = [borderwidth] if borderwidth else None g.add_primitive(ContourPlot(xy_data_array, xrange, yrange, dict( linestyles=linestyles, linewidths=linewidths, contours=[0], cmap=[bordercol], fill=False, labels=False, **options))) return g
|
def region_plot(f, xrange, yrange, plot_points, incol, outcol, bordercol, borderstyle, borderwidth,**options): r""" ``region_plot`` takes a boolean function of two variables, `f(x,y)` and plots the region where f is True over the specified ``xrange`` and ``yrange`` as demonstrated below. ``region_plot(f, (xmin, xmax), (ymin, ymax), ...)`` INPUT: - ``f`` -- a boolean function of two variables - ``(xmin, xmax)`` -- 2-tuple, the range of ``x`` values OR 3-tuple ``(x,xmin,xmax)`` - ``(ymin, ymax)`` -- 2-tuple, the range of ``y`` values OR 3-tuple ``(y,ymin,ymax)`` - ``plot_points`` -- integer (default: 100); number of points to plot in each direction of the grid - ``incol`` -- a color (default: ``'blue'``), the color inside the region - ``outcol`` -- a color (default: ``'white'``), the color of the outside of the region If any of these options are specified, the border will be shown as indicated, otherwise it is only implicit (with color ``incol``) as the border of the inside of the region. - ``bordercol`` -- a color (default: ``None``), the color of the border (``'black'`` if ``borderwidth`` or ``borderstyle`` is specified but not ``bordercol``) - ``borderstyle`` -- string (default: 'solid'), one of 'solid', 'dashed', 'dotted', 'dashdot' - ``borderwidth`` -- integer (default: None), the width of the border in pixels EXAMPLES: Here we plot a simple function of two variables:: sage: x,y = var('x,y') sage: region_plot(cos(x^2+y^2) <= 0, (x, -3, 3), (y, -3, 3)) Here we play with the colors:: sage: region_plot(x^2+y^3 < 2, (x, -2, 2), (y, -2, 2), incol='lightblue', bordercol='gray') An even more complicated plot, with dashed borders:: sage: region_plot(sin(x)*sin(y) >= 1/4, (x,-10,10), (y,-10,10), incol='yellow', bordercol='black', borderstyle='dashed', plot_points=250) A disk centered at the origin:: sage: region_plot(x^2+y^2<1, (x,-1,1), (y,-1,1), aspect_ratio=1) A plot with more than one condition (all conditions must be true for the statement to be true):: sage: region_plot([x^2+y^2<1, x<y], (x,-2,2), (y,-2,2), aspect_ratio=1) Since it doesn't look very good, let's increase plot_points:: sage: region_plot([x^2+y^2<1, x<y], (x,-2,2), (y,-2,2), plot_points=400, aspect_ratio=1) To get plots where only one condition needs to be true, use a function:: sage: region_plot(lambda x,y: x^2+y^2<1 or x<y, (x,-2,2), (y,-2,2), aspect_ratio=1) The first quadrant of the unit circle:: sage: region_plot([y>0, x>0, x^2+y^2<1], (x,-1.1, 1.1), (y,-1.1, 1.1), plot_points = 400, aspect_ratio=1) Here is another plot, with a huge border:: sage: region_plot(x*(x-1)*(x+1)+y^2<0, (x, -3, 2), (y, -3, 3), incol='lightblue', bordercol='gray', borderwidth=10, plot_points=50) If we want to keep only the region where x is positive:: sage: region_plot([x*(x-1)*(x+1)+y^2<0, x>-1], (x, -3, 2), (y, -3, 3), incol='lightblue', plot_points=50) Here we have a cut circle:: sage: region_plot([x^2+y^2<4, x>-1], (x, -2, 2), (y, -2, 2), incol='lightblue', bordercol='gray', plot_points=200, aspect_ratio=1) The first variable range corresponds to the horizontal axis and the second variable range corresponds to the vertical axis:: sage: s,t=var('s,t') sage: region_plot(s>0,(t,-2,2),(s,-2,2)) sage: region_plot(s>0,(s,-2,2),(t,-2,2)) """ from sage.plot.plot import Graphics from sage.plot.misc import setup_for_eval_on_grid import numpy if not isinstance(f, (list, tuple)): f = [f] f = [equify(g) for g in f] g, ranges = setup_for_eval_on_grid(f, [xrange, yrange], plot_points) xrange,yrange=[r[:2] for r in ranges] xy_data_arrays = numpy.asarray([[[func(x, y) for x in xsrange(*ranges[0], include_endpoint=True)] for y in xsrange(*ranges[1], include_endpoint=True)] for func in g],dtype=float) xy_data_array=numpy.abs(xy_data_arrays.prod(axis=0)) # Now we need to set entries to negative iff all # functions were negative at that point. neg_indices = (xy_data_arrays<0).all(axis=0) xy_data_array[neg_indices]=-xy_data_array[neg_indices] from matplotlib.colors import ListedColormap incol = rgbcolor(incol) outcol = rgbcolor(outcol) cmap = ListedColormap([incol, outcol]) cmap.set_over(outcol) cmap.set_under(incol) g = Graphics() g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax'])) g.add_primitive(ContourPlot(xy_data_array, xrange,yrange, dict(contours=[-1e307, 0, 1e307], cmap=cmap, fill=True, labels=False, **options))) if bordercol or borderstyle or borderwidth: cmap = [rgbcolor(bordercol)] if bordercol else ['black'] linestyles = [borderstyle] if borderstyle else None linewidths = [borderwidth] if borderwidth else None g.add_primitive(ContourPlot(xy_data_array, xrange, yrange, dict(linestyles=linestyles, linewidths=linewidths, contours=[0], cmap=[bordercol], fill=False, labels=False, **options))) return g
| 473,069
|
def row_stabilizer(self): """ Return the PermutationGroup corresponding to the row stabilizer of self.
|
def row_stabilizer(self): """ Return the PermutationGroup corresponding to the row stabilizer of self.
| 473,070
|
def replace_parens(x): r""" A map from '(' to open_symbol and ')' to close_symbol and otherwise an error is raised. EXAMPLES:: sage: from sage.combinat.dyck_word import replace_parens sage: replace_parens('(') 1 sage: replace_parens(')') 0 sage: replace_parens(1) Traceback (most recent call last): ... ValueError """ if x == '(': return open_symbol elif x == ')': return close_symbol else: raise ValueError
|
def replace_parens(x): r""" A map from ``'('`` to ``open_symbol`` and ``')'`` to ``close_symbol`` and otherwise an error is raised. The values of the constants ``open_symbol`` and ``close_symbol`` are subject to change. This is the inverse map of :func:`replace_symbols`. INPUT: - ``x`` -- either an opening or closing parenthesis. OUTPUT: - If ``x`` is an opening parenthesis, replace ``x`` with the constant ``open_symbol``. - If ``x`` is a closing parenthesis, replace ``x`` with the constant ``close_symbol``. - Raises a ``ValueError`` if ``x`` is neither an opening nor closing parenthesis. .. SEEALSO:: - :func:`replace_symbols` EXAMPLES:: sage: from sage.combinat.dyck_word import replace_parens sage: replace_parens('(') 1 sage: replace_parens(')') 0 sage: replace_parens(1) Traceback (most recent call last): ... ValueError """ if x == '(': return open_symbol elif x == ')': return close_symbol else: raise ValueError
| 473,071
|
def replace_symbols(x): r""" A map from open_symbol to '(' and close_symbol to ')' and otherwise an error is raised. EXAMPLES:: sage: from sage.combinat.dyck_word import replace_symbols sage: replace_symbols(1) '(' sage: replace_symbols(0) ')' sage: replace_symbols(3) Traceback (most recent call last): ... ValueError """ if x == open_symbol: return '(' elif x == close_symbol: return ')' else: raise ValueError
|
def replace_symbols(x): r""" A map from ``open_symbol`` to ``'('`` and ``close_symbol`` to ``')'`` and otherwise an error is raised. The values of the constants ``open_symbol`` and ``close_symbol`` are subject to change. This is the inverse map of :func:`replace_parens`. INPUT: - ``x`` -- either ``open_symbol`` or ``close_symbol``. OUTPUT: - If ``x`` is ``open_symbol``, replace ``x`` with ``'('``. - If ``x`` is ``close_symbol``, replace ``x`` with ``')'``. - If ``x`` is neither ``open_symbol`` nor ``close_symbol``, a ``ValueError`` is raised. .. SEEALSO:: - :func:`replace_parens` EXAMPLES:: sage: from sage.combinat.dyck_word import replace_symbols sage: replace_symbols(1) '(' sage: replace_symbols(0) ')' sage: replace_symbols(3) Traceback (most recent call last): ... ValueError """ if x == open_symbol: return '(' elif x == close_symbol: return ')' else: raise ValueError
| 473,072
|
def DyckWord(dw=None, noncrossing_partition=None): r""" Returns a Dyck word object or a head of a Dyck word object if the Dyck word is not complete EXAMPLES:: sage: dw = DyckWord([1, 0, 1, 0]); dw [1, 0, 1, 0] sage: print dw ()() sage: print dw.height() 1 sage: dw.to_noncrossing_partition() [[1], [2]] :: sage: DyckWord('()()') [1, 0, 1, 0] sage: DyckWord('(())') [1, 1, 0, 0] sage: DyckWord('((') [1, 1] :: sage: DyckWord(noncrossing_partition=[[1],[2]]) [1, 0, 1, 0] sage: DyckWord(noncrossing_partition=[[1,2]]) [1, 1, 0, 0] TODO: In functions where a Dyck word is necessary, an error should be raised (e.g. a_statistic, b_statistic)? """ if noncrossing_partition is not None: return from_noncrossing_partition(noncrossing_partition) elif isinstance(dw, str): l = map(replace_parens, dw) else: l = dw if isinstance(l, DyckWord_class): return l elif l in DyckWords() or is_a_prefix(l): return DyckWord_class(l) else: raise ValueError, "invalid Dyck word"
|
def DyckWord(dw=None, noncrossing_partition=None): r""" Returns a Dyck word object or a head of a Dyck word object if the Dyck word is not complete. EXAMPLES:: sage: dw = DyckWord([1, 0, 1, 0]); dw [1, 0, 1, 0] sage: print dw ()() sage: print dw.height() 1 sage: dw.to_noncrossing_partition() [[1], [2]] :: sage: DyckWord('()()') [1, 0, 1, 0] sage: DyckWord('(())') [1, 1, 0, 0] sage: DyckWord('((') [1, 1] :: sage: DyckWord(noncrossing_partition=[[1],[2]]) [1, 0, 1, 0] sage: DyckWord(noncrossing_partition=[[1,2]]) [1, 1, 0, 0] TODO: In functions where a Dyck word is necessary, an error should be raised (e.g. a_statistic, b_statistic)? """ if noncrossing_partition is not None: return from_noncrossing_partition(noncrossing_partition) elif isinstance(dw, str): l = map(replace_parens, dw) else: l = dw if isinstance(l, DyckWord_class): return l elif l in DyckWords() or is_a_prefix(l): return DyckWord_class(l) else: raise ValueError, "invalid Dyck word"
| 473,073
|
def DyckWord(dw=None, noncrossing_partition=None): r""" Returns a Dyck word object or a head of a Dyck word object if the Dyck word is not complete EXAMPLES:: sage: dw = DyckWord([1, 0, 1, 0]); dw [1, 0, 1, 0] sage: print dw ()() sage: print dw.height() 1 sage: dw.to_noncrossing_partition() [[1], [2]] :: sage: DyckWord('()()') [1, 0, 1, 0] sage: DyckWord('(())') [1, 1, 0, 0] sage: DyckWord('((') [1, 1] :: sage: DyckWord(noncrossing_partition=[[1],[2]]) [1, 0, 1, 0] sage: DyckWord(noncrossing_partition=[[1,2]]) [1, 1, 0, 0] TODO: In functions where a Dyck word is necessary, an error should be raised (e.g. a_statistic, b_statistic)? """ if noncrossing_partition is not None: return from_noncrossing_partition(noncrossing_partition) elif isinstance(dw, str): l = map(replace_parens, dw) else: l = dw if isinstance(l, DyckWord_class): return l elif l in DyckWords() or is_a_prefix(l): return DyckWord_class(l) else: raise ValueError, "invalid Dyck word"
|
def DyckWord(dw=None, noncrossing_partition=None): r""" Returns a Dyck word object or a head of a Dyck word object if the Dyck word is not complete EXAMPLES:: sage: dw = DyckWord([1, 0, 1, 0]); dw [1, 0, 1, 0] sage: print dw ()() sage: print dw.height() 1 sage: dw.to_noncrossing_partition() [[1], [2]] :: sage: DyckWord('()()') [1, 0, 1, 0] sage: DyckWord('(())') [1, 1, 0, 0] sage: DyckWord('((') [1, 1] :: sage: DyckWord(noncrossing_partition=[[1],[2]]) [1, 0, 1, 0] sage: DyckWord(noncrossing_partition=[[1,2]]) [1, 1, 0, 0] TODO: In functions where a Dyck word is necessary, an error should be raised (e.g. ``a_statistic``, ``b_statistic``)? """ if noncrossing_partition is not None: return from_noncrossing_partition(noncrossing_partition) elif isinstance(dw, str): l = map(replace_parens, dw) else: l = dw if isinstance(l, DyckWord_class): return l elif l in DyckWords() or is_a_prefix(l): return DyckWord_class(l) else: raise ValueError, "invalid Dyck word"
| 473,074
|
def associated_parenthesis(self, pos): r""" report the position for the parenthesis that matches the one at position ``pos``
|
def associated_parenthesis(self, pos): r""" report the position for the parenthesis that matches the one at position ``pos``
| 473,075
|
def associated_parenthesis(self, pos): r""" report the position for the parenthesis that matches the one at position ``pos``
|
def associated_parenthesis(self, pos): r""" report the position for the parenthesis that matches the one at position ``pos``
| 473,076
|
def associated_parenthesis(self, pos): r""" report the position for the parenthesis that matches the one at position ``pos``
|
def associated_parenthesis(self, pos): r""" report the position for the parenthesis that matches the one at position ``pos``
| 473,077
|
def to_noncrossing_partition(self): r""" Bijection of Biane from Dyck words to non crossing partitions Thanks to Mathieu Dutour for describing the bijection.
|
def to_noncrossing_partition(self): r""" Bijection of Biane from Dyck words to non-crossing partitions. Thanks to Mathieu Dutour for describing the bijection.
| 473,078
|
def to_tableau(self): r""" returns a standard tableau of length less than or equal to 2 with the size the same as the length of the list the standard tableau will be rectangular iff ``self`` is a complete Dyck word
|
def to_tableau(self): r""" returns a standard tableau of length less than or equal to 2 with the size the same as the length of the list the standard tableau will be rectangular iff ``self`` is a complete Dyck word
| 473,079
|
def to_tableau(self): r""" returns a standard tableau of length less than or equal to 2 with the size the same as the length of the list the standard tableau will be rectangular iff ``self`` is a complete Dyck word
|
def to_tableau(self): r""" returns a standard tableau of length less than or equal to 2 with the size the same as the length of the list the standard tableau will be rectangular iff ``self`` is a complete Dyck word
| 473,080
|
def a_statistic(self): """ Returns the a-statistic for the Dyck word correspond to the area of the Dyck path.
|
def a_statistic(self): """ Returns the a-statistic for the Dyck word correspond to the area of the Dyck path.
| 473,081
|
def b_statistic(self): r""" Returns the b-statistic for the Dyck word corresponding to the bounce statistic of the Dyck word.
|
def b_statistic(self): r""" Returns the b-statistic for the Dyck word corresponding to the bounce statistic of the Dyck word.
| 473,082
|
def b_statistic(self): r""" Returns the b-statistic for the Dyck word corresponding to the bounce statistic of the Dyck word.
|
def b_statistic(self): r""" Returns the b-statistic for the Dyck word corresponding to the bounce statistic of the Dyck word.
| 473,083
|
def list(self): """ Returns a list of all the Dyck words with ``k1`` opening and ``k2`` closing parentheses.
|
def list(self): """ Returns a list of all the Dyck words with ``k1`` opening and ``k2`` closing parentheses.
| 473,084
|
def __iter__(self): r""" Returns an iterator for Dyck words with ``k1`` opening and ``k2`` closing parentheses.
|
def __iter__(self): r""" Returns an iterator for Dyck words with ``k1`` opening and ``k2`` closing parentheses.
| 473,085
|
def from_noncrossing_partition(ncp): r""" converts a non-crossing partition to a Dyck word TESTS:: sage: DyckWord(noncrossing_partition=[[1,2]]) # indirect doctest [1, 1, 0, 0] sage: DyckWord(noncrossing_partition=[[1],[2]]) [1, 0, 1, 0] :: sage: dws = DyckWords(5).list() sage: ncps = map( lambda x: x.to_noncrossing_partition(), dws) sage: dws2 = map( lambda x: DyckWord(noncrossing_partition=x), ncps) sage: dws == dws2 True """ l = [ 0 ] * int( sum( [ len(v) for v in ncp ] ) ) for v in ncp: l[v[-1]-1] = len(v) res = [] for i in l: res += [ open_symbol ] + [close_symbol]*int(i) return DyckWord(res)
|
def from_noncrossing_partition(ncp): r""" Converts a non-crossing partition to a Dyck word. TESTS:: sage: DyckWord(noncrossing_partition=[[1,2]]) # indirect doctest [1, 1, 0, 0] sage: DyckWord(noncrossing_partition=[[1],[2]]) [1, 0, 1, 0] :: sage: dws = DyckWords(5).list() sage: ncps = map( lambda x: x.to_noncrossing_partition(), dws) sage: dws2 = map( lambda x: DyckWord(noncrossing_partition=x), ncps) sage: dws == dws2 True """ l = [ 0 ] * int( sum( [ len(v) for v in ncp ] ) ) for v in ncp: l[v[-1]-1] = len(v) res = [] for i in l: res += [ open_symbol ] + [close_symbol]*int(i) return DyckWord(res)
| 473,086
|
def eliminate_linear_variables(self, maxlength=3, skip=lambda lm,tail: False): """ Return a new system where "linear variables" are eliminated.
|
def eliminate_linear_variables(self, maxlength=3, skip=lambda lm,tail: False): """ Return a new system where "linear variables" are eliminated.
| 473,087
|
def __mul__(self, other): r""" Calculate the product self * other.
|
def __mul__(self, other): r""" Calculate the product self * other.
| 473,088
|
def order(self, *gens, **kwds): r""" Return the order with given ring generators in the maximal order of this number field.
|
def order(self, *args, **kwds): r""" Return the order with given ring generators in the maximal order of this number field.
| 473,089
|
def order(self, *gens, **kwds): r""" Return the order with given ring generators in the maximal order of this number field.
|
def order(self, *gens, **kwds): r sage: K.<a> = NumberField(x^3 - 2) sage: ZZ[a] Order in Number Field in a0 with defining polynomial x^3 - 2 TESTS: We verify that trac sage: K.<a> = NumberField(x^4 + 4*x^2 + 2) sage: B = K.integral_basis() sage: K.order(*B) Order in Number Field in a with defining polynomial x^4 + 4*x^2 + 2 sage: K.order(B) Order in Number Field in a with defining polynomial x^4 + 4*x^2 + 2 sage: K.order(gens=B) Order in Number Field in a with defining polynomial x^4 + 4*x^2 + 2 """ gens = kwds.pop('gens', args) Return the order with given ring generators in the maximal order of this number field.
| 473,090
|
def __init__(self): r""" The inverse of the hyperbolic secant function.
|
def __init__(self): r""" The inverse of the hyperbolic secant function.
| 473,091
|
def eval(self, Vobj): r""" Evaluates the left hand side `A\vec{x}+b` on the given vertex/ray/line.
|
def eval(self, Vobj): r""" Evaluates the left hand side `A\vec{x}+b` on the given vertex/ray/line.
| 473,092
|
def is_inequality(self): """ Returns True since this is, by construction, an inequality.
|
def is_inequality(self): """ Returns True since this is, by construction, an inequality.
| 473,093
|
def interior_contains(self, Vobj): """ Tests whether the interior of the halfspace (excluding its boundary) defined by the inequality contains the given vertex/ray/line.
|
def interior_contains(self, Vobj): If you pass a vector, it is assumed to be the coordinate vector of a point:: sage: P = Polyhedron(vertices=[[1,1],[1,-1],[-1,1],[-1,-1]]) sage: p = vector(ZZ, [1,0] ) sage: [ ieq.interior_contains(p) for ieq in P.inequality_generator() ] [True, True, True, False] """ try: if Vobj.is_vector(): return self.polyhedron()._is_positive( self.eval(Vobj) ) except AttributeError: pass Tests whether the interior of the halfspace (excluding its boundary) defined by the inequality contains the given vertex/ray/line.
| 473,094
|
def is_equation(self): """ Tests if this object is an equation. By construction, it must be.
|
def is_equation(self): """ Tests if this object is an equation. By construction, it must be.
| 473,095
|
def is_vertex(self): """ Tests if this object is a vertex. By construction it always is.
|
def is_vertex(self): """ Tests if this object is a vertex. By construction it always is.
| 473,096
|
def is_ray(self): """ Tests if this object is a ray. Always True by construction.
|
def is_ray(self): """ Tests if this object is a ray. Always True by construction.
| 473,097
|
def is_line(self): """ Tests if the object is a line. By construction it must be.
|
def is_line(self): """ Tests if the object is a line. By construction it must be.
| 473,098
|
def identity(self): """ Returns the identity projection.
|
def identity(self): """ Returns the identity projection.
| 473,099
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.