Latest recipes tagged "multiplication"http://code.activestate.com/recipes/tags/multiplication/new/2013-06-18T15:25:02-07:00ActiveState Code RecipesRussian Multiplication in Python (Python) 2013-06-18T15:25:02-07:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578567-russian-multiplication-in-python/ <p style="color: grey"> Python recipe 578567 by <a href="/recipes/users/4184772/">Captain DeadBones</a> (<a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/multiplication/">multiplication</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>Here is a very simple program in Python to multiply 2 numbers. This version follows the Russian Multiplication Algorithm. I worte for my blog <a href="http://thelivingpearl.com/basic-multiplication-in-python/">Captain DeadBones Chronicles</a></p> Ten's Multiplication Algorithms in Python (Python) 2013-06-18T15:23:36-07:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578566-tens-multiplication-algorithms-in-python/ <p style="color: grey"> Python recipe 578566 by <a href="/recipes/users/4184772/">Captain DeadBones</a> (<a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/multiplication/">multiplication</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>Here is a very simple program in Python to multiply 2 numbers. This is following a Ten's multiplication algorithms. I worte for my blog <a href="http://thelivingpearl.com/basic-multiplication-in-python/">Captain DeadBones Chronicles</a></p> Simple Addition Multiplication in Python (Python) 2013-06-18T15:21:45-07:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578565-simple-addition-multiplication-in-python/ <p style="color: grey"> Python recipe 578565 by <a href="/recipes/users/4184772/">Captain DeadBones</a> (<a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/multiplication/">multiplication</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>Here is a very simple program in Python to multiply 2 numbers. I worte for my blog <a href="http://thelivingpearl.com/basic-multiplication-in-python/">Captain DeadBones Chronicles</a></p> Basic Multiplication in Python (Python) 2013-06-18T15:21:08-07:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578564-basic-multiplication-in-python/ <p style="color: grey"> Python recipe 578564 by <a href="/recipes/users/4184772/">Captain DeadBones</a> (<a href="/recipes/tags/multiplication/">multiplication</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>Here is a very simple program in Python to multiply 2 numbers. I worte for my blog <a href="http://thelivingpearl.com/basic-multiplication-in-python/">Captain DeadBones Chronicles</a></p> Lattice Multiplication (Python) 2011-07-07T07:07:59-07:00Thomas Lehmannhttp://code.activestate.com/recipes/users/4174477/http://code.activestate.com/recipes/577782-lattice-multiplication/ <p style="color: grey"> Python recipe 577782 by <a href="/recipes/users/4174477/">Thomas Lehmann</a> (<a href="/recipes/tags/lattice/">lattice</a>, <a href="/recipes/tags/multiplication/">multiplication</a>). </p> <p>The documentation in the function explains the algorithm but there are additional pages which provide additional visual help:</p> <ul> <li><a href="http://mathforum.org/library/drmath/view/52468.html" rel="nofollow">http://mathforum.org/library/drmath/view/52468.html</a></li> <li><a href="http://en.wikipedia.org/wiki/Multiplication_algorithm" rel="nofollow">http://en.wikipedia.org/wiki/Multiplication_algorithm</a></li> </ul> <p>The function can handle a string as well as a sequence of digits. The test function is just to have a basic verification.</p> Multiplication table (Python) 2011-04-21T09:12:26-07:00Boubakrhttp://code.activestate.com/recipes/users/4176416/http://code.activestate.com/recipes/577672-multiplication-table/ <p style="color: grey"> Python recipe 577672 by <a href="/recipes/users/4176416/">Boubakr</a> (<a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/multiplication/">multiplication</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/table/">table</a>). </p> <p>Multiplication table (Python)</p> Infix operators for numpy arrays (Python) 2010-06-07T05:57:07-07:00John Schulmanhttp://code.activestate.com/recipes/users/4171677/http://code.activestate.com/recipes/577201-infix-operators-for-numpy-arrays/ <p style="color: grey"> Python recipe 577201 by <a href="/recipes/users/4171677/">John Schulman</a> (<a href="/recipes/tags/array/">array</a>, <a href="/recipes/tags/infix/">infix</a>, <a href="/recipes/tags/matrix/">matrix</a>, <a href="/recipes/tags/multiplication/">multiplication</a>, <a href="/recipes/tags/numpy/">numpy</a>). Revision 3. </p> <p>This recipe adapts the infix operator trick from <a href="http://code.activestate.com/recipes/384122-infix-operators/" rel="nofollow">http://code.activestate.com/recipes/384122-infix-operators/</a> to give the appropriate behavior with numpy arrays, so you can write A *dot* B for np.dot(A,B)</p> <p>UPDATE A solution to the dot problem was recently added to the numpy trunk: the dot method was added to the ndarray class so you can write a.dot(b). See <a href="http://projects.scipy.org/numpy/ticket/1456" rel="nofollow">http://projects.scipy.org/numpy/ticket/1456</a></p>