Top "Math" questions

Math involves the manipulation of numbers within a program.

Make a number a percentage

What's the best way to strip the "0."XXX% off a number and make it a percentage? What happens if the …

javascript math
How can I divide two integers to get a double?

How do I divide two integers to get a double?

c# math int double
How do I calculate r-squared using Python and Numpy?

I'm using Python and Numpy to calculate a best fit polynomial of arbitrary degree. I pass a list of x …

python math statistics numpy curve-fitting
Rounding numbers to 2 digits after comma

I have no idea how to do this? I'm adding comma numbers, result is of course always a number with …

javascript math rounding
Positive Number to Negative Number in JavaScript?

Basically, the reverse of abs. If I have: if ($this.find('.pdxslide-activeSlide').index() < slideNum - 1) { slideNum = -slideNum } console.…

javascript jquery math
Convert a number range to another range, maintaining ratio

I'm trying to convert one range of numbers to another, maintaining ratio. Maths is not my strong point. I have …

python math
How to calculate an angle from three points?

Lets say you have this: P1 = (x=2, y=50) P2 = (x=9, y=40) P3 = (x=5, y=20) Assume that P1 is the center …

algorithm math geometry
Fastest way to list all primes below N

This is the best algorithm I could come up. def get_primes(n): numbers = set(range(n, 1, -1)) primes = [] while …

python math optimization primes
The most efficient way to implement an integer based power function pow(int, int)

What is the most efficient way given to raise an integer to the power of another integer in C? // 2^3 pow(2,3) == 8 // 5^5 …

c algorithm math exponentiation
What is "entropy and information gain"?

I am reading this book (NLTK) and it is confusing. Entropy is defined as: Entropy is the sum of the …

math text computer-science nltk text-mining