Browsing Questions About math (1)
What's the difference between Math.Floor() and Math.Truncate() in .NET?
What is the difference between Math.Floor() and Math.Truncate() in C#?
Solving a linear equation
I need to programmatically solve a system of linear equations in C, Objective C, or (if needed) C++.
Here's an example of the equations:
-44.3940 = a * 50.0 + b * 37.0 + tx -45.3049 = a * 43.0 + b * 39.0 + tx -44.9594 = a * 52.0 + b * 41.0 + tx
From this, I'd like to get the best a…
A little diversion into floating point (im)precision, part 1
Most mathematicians agree that e πi + 1 = 0. However, most floating point implementations disagree. How well can we settle this dispute?
I'm keen to hear about different languages and implementations, and various methods to make the result as close to zero as possible. Be creative!
Mapping latitude/longitude to a distorted map
I have a bunch of latitude/longitude pairs that map to known x/y coordinates on a (geographically distorted) map.
Then I have one more latitude/longitude pair. I want to plot it on the map as best is possible. How do I go about doing this?
At first I decided to create a system of linear …
What does the term "BODMAS" mean?
What is BODMAS and why is it useful in programming?
Date arithmetic in Unix shell scripts
I need to do date arithmetic in Unix shell scripts that I use to control the execution of third party programs.
I'm using a function to increment a day and another to decrement:
IncrementaDia(){ echo $1 | awk ' BEGIN { diasDelMes[1] = 31 diasDelMes[2] = 28 diasDelMes[3] = 31 …
Puzzle: Find largest rectangle (maximal rectangle problem)
What's the most efficient algorithm to find the rectangle with the largest area which will fit in the empty space?
Let's say the screen looks like this ('#' represents filled area):
....................
..............######
##..................
.................###
.................###
#####…
Useful math for programmers
In your experience as a practicioner, what's the most useful math knowledge for a programmer? If "it depends", what's your field of expertise and what do you need there most as far as math is concerned?
Can you point to any learning material for a beginner?
How to Round Up The Result Of Integer Division
I'm thinking in particular of how to display pagination controls, when using a language such as C# or Java.
If I have x items which I want to display in chunks of y per page, how many pages will be needed?
Where can I find a "Math topic dependency tree" to assist my self-guided refresher on the subject?
I'm trying to reteach myself some long forgotten math skills. This is part of a much larger project to effectively "teach myself software development" from the ground up (the details are here if you're interested in helping out).
My biggest stumbling block so far has been math - how can I lear…
Prime factors
What is the best approach to calculating the largest prime factor of a number?
I'm thinking the most efficient would be the following:
Find lowest prime number that divides cleanly
Check if result of division is prime
If not, find next lowest
Go to 2.
I'm basing this assumption …
Calculating Distance Between 2 Cities
How do you calculate the distance between 2 cities?
The Google Calculator Glitch, could float vs. double be a possible reason?
I did this Just for kicks (so, not exactly a question, i can see the downmodding happening already) but, in lieu of Google's newfound inability to do math correctly (check it! according to google 500,000,000,000,002 - 500,000,000,000,001 = 0), i figured i'd try the following in C to run a little …
How do I calculate distance between two latitude longitude points?
Here's an easy one for you:
How do I calculate the distance between two points points specified by latitude and longitude?
EDIT: For clarification, I'd like the distance in kilometres, the points use the WGS84 system and I'd like to understand the relative accuracies of the approaches availa…
Popularity algorithm
On SO 18 Joel mentioned an algorithm that would rank items based on their age and popularity and it's based on gravity. Could someone post this? C# would be lovely, but really any language (well, I can't do LISP) would be fine.
Next Page >