Latest recipes tagged "numeric"http://code.activestate.com/recipes/tags/numeric/new/2011-05-16T12:11:24-07:00ActiveState Code RecipesSimple numeric database (Python) 2011-05-16T12:11:24-07:00Hamidreza Joshaghanihttp://code.activestate.com/recipes/users/4177804/http://code.activestate.com/recipes/577698-simple-numeric-database/ <p style="color: grey"> Python recipe 577698 by <a href="/recipes/users/4177804/">Hamidreza Joshaghani</a> (<a href="/recipes/tags/array/">array</a>, <a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/numeric/">numeric</a>). </p> <p>A simple in-memory numeric database for Python. Arrays are used to minimise memory consumption.</p> Simple numeric database (Python) 2011-05-16T08:41:46-07:00Mike Sweeneyhttp://code.activestate.com/recipes/users/4177990/http://code.activestate.com/recipes/577697-simple-numeric-database/ <p style="color: grey"> Python recipe 577697 by <a href="/recipes/users/4177990/">Mike Sweeney</a> (<a href="/recipes/tags/array/">array</a>, <a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/numeric/">numeric</a>). Revision 2. </p> <p>A simple in-memory numeric database for Python. Arrays are used to minimise memory consumption.</p> Approximately Equal (Python) 2010-03-17T17:05:51-07:00Steven D'Apranohttp://code.activestate.com/recipes/users/4172944/http://code.activestate.com/recipes/577124-approximately-equal/ <p style="color: grey"> Python recipe 577124 by <a href="/recipes/users/4172944/">Steven D'Aprano</a> (<a href="/recipes/tags/comparisons/">comparisons</a>, <a href="/recipes/tags/distance/">distance</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/maths/">maths</a>, <a href="/recipes/tags/numeric/">numeric</a>, <a href="/recipes/tags/string/">string</a>). </p> <p>Generic "approximately equal" function for any object type, with customisable error tolerance.</p> <p>When called with float arguments, approx_equal(x, y[, tol[, rel]) compares x and y numerically, and returns True if y is within either absolute error tol or relative error rel of x, otherwise return False. The function defaults to sensible default values for tol and rel.</p> <p>For any other pair of objects, approx_equal() looks for a method __approx_equal__ and, if found, calls it with arbitrary optional arguments. This allows types to define their own concept of "close enough".</p>