Ticket #1938: trac-1938-fix_some_docstrings.patch

File trac-1938-fix_some_docstrings.patch, 4.0 KB (added by was, 14 years ago)

do apply this

  • sage/ext/fast_eval.pyx

    # HG changeset patch
    # User William Stein <wstein@gmail.com>
    # Date 1201661946 18000
    # Node ID ab8fdb660b75ce9a6ae01b1615057791f8b76539
    # Parent  fe21f8649644487fba13b834bb706690b9d113f4
    trac #1938 -- fix some typos and bad writing.
    
    diff -r fe21f8649644 -r ab8fdb660b75 sage/ext/fast_eval.pyx
    a b r""" 
    11r"""
    2 For many applications such as numerical integration, differential equation
    3 approximation, plotting a 3d surface, optimization problems, monte-carlo
    4 simulations, etc. one wishes to pass around and evaluate a single algebraic
    5 many, many times at various floating point values. Doing this via recursive
    6 calls over a python representation of the object (even if maxima or other
    7 outside packages are not involved) is extremely inefficient.
     2Fast Numerical Evaluation.
    83
    9 Up until now the solution has been to use lambda expressions, but this is neither
    10 intuitive, Sage-like, nor efficient (compared to operating on raw c doubles).
    11 This module provides a representation of algebraic expression in Reverse
    12 Polish Notation, and provides an efficient interpreter on c double values
    13 as a callable python object. It does what it can in C, and will call out
    14 to Python if necessary.
     4For many applications such as numerical integration, differential
     5equation approximation, plotting a 3d surface, optimization problems,
     6monte-carlo simulations, etc., one wishes to pass around and evaluate
     7a single algebraic expression many, many times at various floating
     8point values. Doing this via recursive calls over a python
     9representation of the object (even if maxima or other outside packages
     10are not involved) is extremely inefficient.
    1511
    16 Essential to the understanding of this class is the distinction between
    17 symbolic expressions and callable symbolic expressions (where the later
    18 binds argument names to argument positions). The \code{*vars} parameter
    19 passed around encapsulates this information.
     12Up until now the solution has been to use lambda expressions, but this
     13is neither intuitive, Sage-like, nor efficient (compared to operating
     14on raw C doubles).  This module provides a representation of algebraic
     15expression in Reverse Polish Notation, and provides an efficient
     16interpreter on C double values as a callable python object. It does
     17what it can in C, and will call out to Python if necessary.
     18
     19Essential to the understanding of this class is the distinction
     20between symbolic expressions and callable symbolic expressions (where
     21the later binds argument names to argument positions). The
     22\code{*vars} parameter passed around encapsulates this information.
    2023
    2124See the function \code{fast_float(f, *vars)} to create a fast-callable
    2225version of f.
    2326
    24 To provide this interface for a class, implement \code{_fast_float_(self, *vars)}.
    25 The basic building blocks are provided by the functions \code{fast_float_constant}
    26 (returns a constant function), \code{fast_float_arg} (selects the $n$-th
    27 value when called with $\ge n$ arguments), and \code{fast_float_func} which
    28 wraps a callable Python function. These may be combined with the standard
    29 Python arithmatic operators, and support many of the basic math functions
    30 such sqrt, exp, and trig functions.
     27To provide this interface for a class, implement
     28\code{_fast_float_(self, *vars)}.  The basic building blocks are
     29provided by the functions \code{fast_float_constant} (returns a
     30constant function), \code{fast_float_arg} (selects the $n$-th value
     31when called with $\ge n$ arguments), and \code{fast_float_func} which
     32wraps a callable Python function. These may be combined with the
     33standard Python arithmetic operators, and support many of the basic
     34math functions such sqrt, exp, and trig functions.
    3135
    3236EXAMPLES:
    3337    sage: from sage.ext.fast_eval import fast_float
    def fast_float(f, *vars): 
    12141218    return f
    12151219
    12161220def is_fast_float(x):
    1217     return PY_TYPE_CHECK(x, FastDoubleFunc)
    1218  No newline at end of file
     1221    return PY_TYPE_CHECK(x, FastDoubleFunc)