Programming questions that are significantly affected or best defined by the underlying mathematics of the problem.
1
vote
0answers
107 views
Optimization algorithm, how to develop this problem
I have a situation where I would like your input and think over / solve algorithm.
The specs
There are inventories with a specified amount of capacity. 'X
(width) and Y (time)' creates ...
5
votes
1answer
135 views
What is the difference between a combinator and function chaining?
So from what I've read about combinators I can't quite tell how they're different from simply chaining function calls. I know I must be missing something but I'm not figuring out what I'm missing. I ...
1
vote
1answer
112 views
Pairwise testing, not possible to say which combinations is faulty?
Let's say I have 4 (A,B,C,D) parameters with 3 possible values, also 81 unique combinations. With e.g. orthogonal array, I will end up with 9 test cases, each combining 3 pairs. But that means that if ...
2
votes
4answers
96 views
Find how the data has been processed
Well this has been a question I have puzzled about for a long time:
Suppose I have a dictionary of input:output like:
This
{2: 6,
5: 15,
20: 60,
26: 78,
...
982: 2946,
997: 2991}
where ...
2
votes
2answers
159 views
Transform math formula into code (line-line intersection)
I'm having hard times transforming a math formula to code. I can solve it on the paper easily, but it's hard for me to bring it into code form. Is it generally possible to bring a math formula ...
0
votes
4answers
258 views
Is there such a thing as truly random? [closed]
I saw a video about random numbers and how the programmer in that video was talking about computers generating pseudo random numbers and that they are not really random. I knew about this.
Then he ...
0
votes
3answers
123 views
algorithm to create all possible column vectors of size N containing only ones and zeroes [closed]
I am a mathematics student and am just starting to learn about programming. I am stuck on a particular program I am trying to write for fun. I want to find an algorithm to create all possible column ...
2
votes
2answers
373 views
Closest Point of Approach (CPA) mathematical formula in ship radar
I was recently searching for the mathematical formula to find closest point of approach (CPA) between one ship and another ship. I need to apply the formula in my radar ship program and I can't find ...
4
votes
3answers
275 views
Customer Requirements Contains Equations that Cancel to Nothing
I have a project where the customer requirement specifies a report and contains mathematical equations for the contents of some of the columns on that report. One of the columns on this report is a ...
2
votes
8answers
749 views
Is (1/(1/x)) always a perfect round trip?
Is the following guaranteed to return true for all numerical and non-zero values of x?
bool IsRoundTrip(double x)
{
double y = 1 / (1 / x);
return x == y;
}
What conditions would cause a ...
0
votes
2answers
94 views
Tracking scientific error when working with floating-point numbers
Background
I hate the way .Net/IEEE-754 handles equality of floating-point numbers (FPNs) (i.e. double, float). It requires the programmer to be prescient with respect to the yet-to-be-determined ...
2
votes
3answers
274 views
what is a efficient way to find repeating decimal
I am trying to find a efficient algorithm in Java to find the repeating decimal part of two integers a and b where a/b.
eg. 5/7 = 0.714258 714258....
I currently only know of the long division ...
3
votes
3answers
188 views
strategies for dealing with machine epsilon
Say you have a situation where you divide and then multiply a float, and you need to guarantee that it survives macheps (ie multiplication output equals division input). What are known strategies for ...
-2
votes
2answers
120 views
Best major in conjunction with a computer science major for low level programming and algorithm efficiency [closed]
I am thinking that a math major would aid in the areas of algorithm design and low level programming, however I cannot find any good statistics on income associated with dual majors.
0
votes
1answer
211 views
I'm trying to create a visual representation of something, but I don't know what words to use, so I'll try to describe it
My project team is making a site that will use reddit style voting to track users' opinions on various issues, and use the data to create a "heat map". I say heat map in quotes because I'm not sure ...
3
votes
2answers
113 views
Randomness of wrapped RNG
There are plenty of questions around regarding random number generation, but I couldn't find anything that exactly matched my question. Apologies if I missed one.
Most random number generators in ...
0
votes
1answer
101 views
Algorithm to detect a CLICK within Square range
It might be a simple question but I am looking for optimal solution. I will have numbers printed on a screen and I will be aware of coordinates. Numbers/Symbols will have 4 points(Square) to define ...
0
votes
0answers
147 views
How to self study mathemathics / calculus required for MSc in Computer Science? [closed]
Currently I work for a company as a software engineer. We do embedded sw, application sw, etc... so I would rather categorize myself as a SW engineer, not a computer scientist.
I have an interest in ...
9
votes
5answers
598 views
Interview puzzle on traveling on a line segment
Here's an interesting question I came upon:
Let's just say on a number line of length M, where 0 < M <= 1,000,000,000, you given N (1 < N <= 100,000) integer pairs of points. In each ...
-4
votes
1answer
110 views
Opposite of Collatz Conjecture [closed]
How can I write (in pseudocode) a program that halts only if the Collatz Conjecture is
false ?
Here is pseudocode for the case that it is true:
function collatz(n)
while n > 1
show n
...
1
vote
1answer
104 views
Turning n-dim points into m-dim where m<n and where point-to-point distance deviation is minimized
I want to apply k-means clustering to a (sparse) adjacency graph. For this I need to assign the nodes to a position in an euclidean space. Trivially I can do this by having a space with as many ...
0
votes
1answer
76 views
How to do scalar multiplication and matrix inverse when variables are of size 1000 bits?
I am doing arithmetic operations on really huge numbers.
For example, I am given six variables, a_{11}, a_{12}, a_{21}, a_{22}, x_1, and x_2.
Although the above are math terms, these six variables ...
2
votes
1answer
313 views
Randomly Generate Points in a Spiral Motion using Javascript
So I have a javascript program that currently gets random points, it generates a random x,y,z value around the center point, within the radius r
var maxArms = 3;
var i = 0;
var color = [];
...
-1
votes
1answer
466 views
How to get audio spectrum analysis? [closed]
I need to find or create a tool that analyzes the audio spectrum of a sound file (like a .wav or .mp3). I need to output the "volume" or power of x number of frequency bands and output the data as ...
1
vote
1answer
410 views
Find the new coordinates using a starting point, a distance, and an angle
Okay, say I have a point coordinate.
var coordinate = { x: 10, y: 20 };
Now I also have a distance and an angle.
var distance = 20;
var angle = 72;
The problem I am trying to solve is, if I want ...
3
votes
3answers
344 views
Date calculation algorithm
I'm working on a project to schedule a machine shop, basically I've got everything covered BUT date calculations, I've got a method called schedule (working on PHP here):
public function ...
0
votes
4answers
482 views
Separating merged array of arithmetic and geometric series [closed]
Given an array of positive integers in increasing order. Separate them in two series, an arithmetic sequence and geometric sequence. The given array is such that a solution do exist.
The union of ...
1
vote
3answers
713 views
Calculating 3d rotation around random axis
This is actually a solved problem, but I want to understand why my original method didn't work (hoping someone with more knowledge can explain).
(Keep in mind, I've not very experienced in 3d ...
1
vote
4answers
209 views
LaTeX-like display programming environment
I used to be a hobbyist programmer, but now I'm also a fairly experienced physicist and find myself programming to solve certain problems quite a lot. In physics, we use variables with superscripts, ...
20
votes
9answers
2k views
How to check if 4 points form a square?
Assume I have 4 points (they are 2-dimension), which are different from each other, and I want to know whether they form a square. How to do it? (let the process be as simple as possible.)
8
votes
3answers
325 views
how to programtically build a grid of interlocking but random sized squares
I want to create a two dimensional layout of rectangular shapes, a grid made up of random sized cubes. The cubed should fit together and have equal padding or margin (space between). Kind of like a ...
20
votes
3answers
1k views
Can you use Pi as a crude random number generator?
I recently saw this question over at math.SE. It got me thinking. Could Pi be used as a crude random number generator? I mean the results are well known(how long has pi been computed to now?) but, Pi ...
30
votes
15answers
3k views
Why use other number bases when programming
My coworkers and I have been bending our minds to figuring out why anyone would go out of their way to program numbers in a base other than base 10.
I suggested that perhaps you could optimize longer ...
-3
votes
1answer
242 views
What Precalculus knowledge is required before learning Discrete Math Computer Science topics? [closed]
Below I've listed the chapters from a Precalculus book as well as the author recommended Computer Science chapters from a Discrete Mathematics book.
Although these chapters are from two specific ...
5
votes
4answers
125 views
Should Equality be commutative within a Class Hierachy?
It is easy to define the Equals operation in ways that are not commutative. When providing equality against other types, there are obviously situations (in most languages) were equality not being ...
4
votes
1answer
211 views
What's the normal way machine-learning algorithms are integrated into normal programs?
I'm currently taking a machine learning course for fun, and the course heavily focuses on Matlab/Octave to write the code. One thing mentioned in the course is that, while Matlab/Octave are great for ...
-2
votes
5answers
485 views
Differential and integral calculus for programmer [duplicate]
Possible Duplicate:
Where is the application of Calculus(of continuous quantities) in Computer Science or programming
How can calculus and linear algebra be useful to a system programmer?
...
0
votes
3answers
91 views
Working with vectors and transformations
I am going to write an graphical 2D application that allows user to create polygons and transform them through transformation such as rotation an so on. I was hoping someone can give pro and cons ...
3
votes
3answers
383 views
Algorithm to calculate trajectories from vector field
I have a two-dimensional vector field, i.e., for each point (x, y) I have a vector (u, v), whereas u and v are functions of x and y.
This vector field canonically defines a set of trajectories, i.e. ...
1
vote
1answer
146 views
What resources are there for facial recognition [closed]
I'm interested in learning the theory behind facial recognition software so that I can hopefully implement it in the future. Not just face tracking, but being able to recognize individuals. What ...
7
votes
1answer
629 views
Are there studies on what programming does to the brain? [closed]
Are there studies on what effects have programming languages on the brain or for that matter any other artificial languages in general, like mathematics ?
Speaking from my personal experience I feel ...
2
votes
2answers
170 views
Dealing with units in arithmetic operations (multiplication and division)
I need to design a function to perform the basic arithmetic operations that are addition (+), subtraction (-), multiplication (x), and division (/) between 2 numbers.
That function takes 3 arguments:
...
5
votes
2answers
284 views
Fractional and Cartesian Coordinates
I have a set of fractional coordinates.
I also have a rotation matrix that operates on cartesian coordinates.
Does anyone know how I could convert my rotation matrix so I can operate on the ...
4
votes
3answers
729 views
What Discrete Mathematics topics should the average computer science student know?
I know that Discrete Mathematics is a pretty broad topic that's used in a number of fields but I was just wondering what are some of the topics from it that you would expect an average computer ...
0
votes
2answers
269 views
1 to 1 Comparison and Ranking System
I'm looking to create a comparison and ranking system which allows users to view 2 items, click on the one that they feel is the better one and then get presented with 2 more random items and continue ...
6
votes
1answer
218 views
Can one edit a built-in Python module?
I'm currently learning Python and I'm at the point in the book about using the Math library. I looked on the Python website and noticed the library was a bit scarce and am writing some more useful ...
0
votes
2answers
336 views
why is a naturally ordered set generated at 9 but not 10 digits
code found at: fatal error...Java Runtime Environment: EXCEPTION_ACCESS_VIOLATION
Presuming that the problem indicated above is due to the test app and not due specifically to method ...
6
votes
8answers
1k views
How can calculus and linear algebra be useful to a system programmer?
I found a website saying that calculus and linear algebra are necessary for System Programming.
System Programming, as far as I know, is about osdev, drivers, utilities and so on. I just can't figure ...
3
votes
2answers
193 views
Layout of mathematical views (iOS)
I am trying to figure out the right way to encapsulate graphical information about mathematical objects. It is not simple. For example, a matrix can include square brackets around its entries, or ...
1
vote
3answers
223 views
Compute or Calculate? [closed]
If you were to use one of these verbs to describe some functions, which one would you use?
function1:
Calculates/Computes the distance between 2 points.
function2:
Calculates/Computes the length of ...