What is the difference between ‘/’ and ‘//’ when used for division?

In Python 3.x, 5 / 2 will return 2.5 and 5 // 2 will return 2. The former is floating point division, and the latter is floor division, sometimes also called integer division. In Python 2.2 or later in the 2.x line, there is no difference for integers unless you perform a from __future__ import division, which causes Python 2.x to adopt the 3.x behavior. … Read more

log2 in python math module

why doesn’t it exist? >>> [‘log’, ‘log10’, ‘log1p’] I know I can do log(x,2), but log2 is really common, so I’m kind of baffled. Oh, it looks like it’s only defined in C99, not C90, I guess that answers my question. Still seems kind of silly.

What are the most widely used C++ vector/matrix math/linear algebra libraries, and their cost and benefit tradeoffs?

There are quite a few projects that have settled on the Generic Graphics Toolkit for this. The GMTL in there is nice – it’s quite small, very functional, and been used widely enough to be very reliable. OpenSG, VRJuggler, and other projects have all switched to using this instead of their own hand-rolled vertor/matrix math. I’ve found … Read more

Python – how to use the constant e^

The function you’re using is known as the sigmoid function. You can build a function that will calculate every sigmoid of x. In order to use e^(x) you can use the numpy function exp as shown in the example.

What is the fastest factorial function in JavaScript?

You can search for (1…100)! on Wolfram|Alpha to pre-calculate the factorial sequence. The first 100 numbers are: If you still want to calculate the values yourself, you can use memoization: Edit: 21.08.2014 Solution 2 I thought it would be useful to add a working example of lazy iterative factorial function that uses big numbers to get exact result with memoization and cache as comparison I assume you would use some kind … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)