Popular recipes by Alexander Pletzer http://code.activestate.com/recipes/users/98107/2005-05-01T10:54:00-07:00ActiveState Code RecipesFractal tree (Python)
2005-05-01T10:54:00-07:00Alexander Pletzerhttp://code.activestate.com/recipes/users/98107/http://code.activestate.com/recipes/410158-fractal-tree/
<p style="color: grey">
Python
recipe 410158
by <a href="/recipes/users/98107/">Alexander Pletzer</a>
(<a href="/recipes/tags/graphics/">graphics</a>).
Revision 4.
</p>
<p>This simple program can be used to compute and display a 2D fractal tree.</p>
Matrix vector multiplication (Python)
2002-04-19T07:10:42-07:00Alexander Pletzerhttp://code.activestate.com/recipes/users/98107/http://code.activestate.com/recipes/121574-matrix-vector-multiplication/
<p style="color: grey">
Python
recipe 121574
by <a href="/recipes/users/98107/">Alexander Pletzer</a>
(<a href="/recipes/tags/algorithms/">algorithms</a>).
</p>
<p>Using 'reduce' and 'map', this code shows how a matrix vector multiplication
can be reduced to a single loop.</p>
colormap: Returns an RGB tuple on a 0 to 255 scale for graphical packages (Python)
2005-04-20T12:46:35-07:00Alexander Pletzerhttp://code.activestate.com/recipes/users/98107/http://code.activestate.com/recipes/52273-colormap-returns-an-rgb-tuple-on-a-0-to-255-scale-/
<p style="color: grey">
Python
recipe 52273
by <a href="/recipes/users/98107/">Alexander Pletzer</a>
(<a href="/recipes/tags/graphics/">graphics</a>).
Revision 5.
</p>
<p>These functions, when given a magnitude 'mag' between cmin and cmax, return
a colour tuple (red, green, blue) on a 0 to 255 scale. The tuple can consist of strings
(strRgb) as required in Tk calls, or integers (rgb) as required in Java applications.</p>
Gaussian quadrature with or without Log singularity (Python)
2001-04-05T20:31:05-07:00Alexander Pletzerhttp://code.activestate.com/recipes/users/98107/http://code.activestate.com/recipes/52292-gaussian-quadrature-with-or-without-log-singularit/
<p style="color: grey">
Python
recipe 52292
by <a href="/recipes/users/98107/">Alexander Pletzer</a>
(<a href="/recipes/tags/algorithms/">algorithms</a>).
Revision 2.
</p>
<p>If you have the freedom to choose your abscissas and your integrand is smooth or has
a log singularity, then this script is for you. It computes the definite integral of a user
defined function over the interval [a, b]. The user can specify the number of Gauss
points (1 <= ng <= 12), the default being ng=10.</p>
vector: A list based vector class supporting elementwise operations (Python)
2002-04-15T18:22:16-07:00Alexander Pletzerhttp://code.activestate.com/recipes/users/98107/http://code.activestate.com/recipes/52272-vector-a-list-based-vector-class-supporting-elemen/
<p style="color: grey">
Python
recipe 52272
by <a href="/recipes/users/98107/">Alexander Pletzer</a>
(<a href="/recipes/tags/graphics/">graphics</a>).
Revision 3.
</p>
<p>This vector class stores elements in a list and hence allows the 'vector' to grow
dynamically. Common mathematical functions (sin, cosh, etc) are supported elementwise
and so are a number of 'external' operations (dot for the inner product between vectors,
norm, sum etc.). This class does not rely on NumPy but can be used in conjunction with
a 'sparse' matrix class to solve linear systems. Tested using Python 2.0 and Jython 2.0.</p>
sparse: A dictionary based sparse matrix class (Python)
2005-04-18T00:17:29-07:00Alexander Pletzerhttp://code.activestate.com/recipes/users/98107/http://code.activestate.com/recipes/52275-sparse-a-dictionary-based-sparse-matrix-class/
<p style="color: grey">
Python
recipe 52275
by <a href="/recipes/users/98107/">Alexander Pletzer</a>
(<a href="/recipes/tags/graphics/">graphics</a>).
Revision 6.
</p>
<p>'sparse' is a matrix class based on a dictionary to store data using 2-element tuples (i,j)
as keys (i is the row and j the column index). The common matrix operations such as
'dot' for the inner product, multiplication/division by a scalar, indexing/slicing, etc. are
overloaded for convenience. When used in conjunction with the 'vector' class, 'dot'
products also apply between matrics and vectors. Two methods, 'CGsolve' and
'biCGsolve', are provided to solve linear systems. Tested using Python 2.2.</p>