math

How to get the base 10 logarithm of a Fixnum in Ruby?

I want to get the base 10 logarithm of a Fixnum using Ruby, but found that n.log or n.log10 are not defined. Math::log is defined but uses a different base than 10. What is the easiest way to get the base 10 logarithm of a Fixnum? ...

What are the core mathematical concepts a good developer should know?

Since Graduating from a very small school in 2006 with a badly shaped & outdated program (I'm a foreigner & didn't know any better school at the time) I've come to realize that I missed a lot of basic concepts from a mathematical & software perspective that are mostly the foundations of other higher concepts. I.e. I tried to listen/watc...

How to test randomness (case in point - Shuffling)

First off, this question is ripped out from this question. I did it because I think this part is bigger than a sub-part of a longer question. If it offends, please pardon me. Assume that you have a algorithm that generates randomness. Now how do you test it? Or to be more direct - Assume you have an algorithm that shuffles a deck of car...

Algorithm to find a common multiplier to convert decimal numbers to whole numbers

I have an array of numbers that potentially have up to 8 decimal places and I need to find the smallest common number I can multiply them by so that they are all whole numbers. I need this so all the original numbers can all be multiplied out to the same scale and be processed by a sealed system that will only deal with whole numbers, th...

What are some good rigid body dynamics references?

I'm not a math guy in the least but I'm interested in learning about rigid body physics (for the purpose of implementing a basic 3d physics engine). In school I only took Maths through Algebra II, but I've done 3d dev for years so I have a fairly decent understanding of vectors, quaternions, matrices, etc. My real problem is reading co...

Creating a Math library using Generics in C#

Is there any feasible way of using generics to create a Math library that does not depend on the base type chosen to store data? In other words, let's assume I want to write a Fraction class. The fraction can be represented by two ints or two doubles or whatnot. The important thing is that the basic four arithmetic operations are well d...

Scalable Moebius strip in WPF

A moebius strip is a surface with one side. How would one define such an object in XAML/WPF? How could such an object be manipulated in 3D, scaled up and down and rotated using C#? ...

Algorithm for finding similar images

I need an algorithm that can determine whether two images are 'similar' and recognizes similar patterns of color, brightness, shape etc.. I might need some pointers as to what parameters the human brain uses to 'categorize' images. .. I have looked at hausdorff based matching but that seems mainly for matching transformed objects and p...

How do I clip a line segment against a frustum?

Given two vectors A and B which form the line segment L = A-B. Furthermore given a view frustum F which is defined by its left, right, bottom, top, near and far planes. How do I clip L against F? That is, test for an intersection and where on L that intersection occurs? (Keep in mind that a line segment can have more than one intersec...

What's the best way to calculate a 3D (or n-D) centroid?

As part of a project at work I have to calculate the centroid of a set of points in 3D space. Right now I'm doing it in a way that seems simple but naive -- by taking the average of each set of points, as in: centroid = average(x), average(y), average(z) where x, y and z are arrays of floating-point numbers. I seem to recall that ther...

A Good 3D mesh library

I'm looking for a good 3D Mesh library Should be able to read popular formats (OFF, OBJ...) Should support both half-edge structure and a triangle soup Should be tolerant to faults and illegal meshes. Basic geometric operations - intersections, normal calculation, etc' Most importantly - Should not be convoluted with endless template a...

Can any database do math?

Can databases (MySQL in particular, any SQL--MS, Oracle, Postgres--in general) do mass updates, and figure out on their own what the new value should be? Say for example I've got a database with information about a bunch of computers, and all of these computers have drives of various sizes--anywhere from 20 to 250 GB. Then one day we upg...

Calculating percentile rankings in MS SQL

What's the best way to calculate percentile rankings (e.g. the 90th percentile or the median score) in MSSQL 2005? I'd like to be able to select the 25th, median, and 75th percentiles for a single column of scores (preferably in a single record so I can combine with average, max, and min). So for example, table output of the results mi...

Algorithm to find which numbers from a list of size n sum to another number

I have a decimal number (let's call it goal) and an array of other decimal numbers (let's call the array elements) and I need to find all the combinations of numbers from elements which sum to goal. I have a preference for a solution in C# (.Net 2.0) but may the best algorithm win irrespective. Your method signature might look somethin...

Is there an efficient algorithm to generate a 2D concave hull?

Having a set of (2D) points from a GIS file (a city map), I need to generate the polygon that defines the 'contour' for that map (its boundary). Its input parameters would be the points set and a 'maximum edge length'. It would then output the corresponding (probably non-convex) polygon. The best solution I found so far was to generate ...

Mathematical analysis of a sound sample (as an array of numbers)

I need to find the frequency of a sample, stored (in vb) as an array of byte. Sample is a sine wave, known frequency, so I can check), but the numbers are a bit odd, and my maths-foo is weak. Full range of values 0-255. 99% of numbers are in range 235 to 245, but there are some outliers down to 0 and 1, and up to 255 in the remaining 1%...

How do you calculate the axis-aligned bounding box of an ellipse?

If the major axis of the ellipse is vertical or horizontal, it's easy to calculate the bounding box, but what about when the ellipse is rotated? The only way I can think of so far is to calculate all the points around the perimeter and find the max/min x and y values. It seems like there should be a simpler way. If there's a function (...

Annuity or Angle Operation Symbol in LaTeX

How do I set the symbol for the angle or annuity operation in LaTeX? Specifically, this is the actuarial a angle s = (1-vs)/i. ...

switch to parallel coding

we all writing code for single processor. i wonder when we all are able to write code on multi processors? what do we need (software tools, logic, algorithms) for this switching? edit: in my view, as we do many task parallely, same way we need to convert those real life solutions(algorithms) to computer lang. just as OOPs coding did fo...

Higher mathematics courses online?

As a college dropout working as a software developer, about the only thing I feel I've missed out on is the lack of higher mathematics ( > Calculus I ). I see loads of online MBA courses, CPA, CS, etc courses. I can't find any pure math courses. I suppose I understand why... these things are geared towards career development, not jus...