Questions tagged [math]

Programming questions that are significantly affected or best defined by the underlying mathematics of the problem.

285 questions
78
votes
67 answers

Do you have to be good at math to be a good programmer?

It seems that conventional wisdom suggests that good programmers are also good at math. Or that the two are somehow intrinsically linked. Many programming books I have read provide many examples that are solutions to math problems, or are somehow…
Charles Roper
  • 1,363
  • 1
  • 13
  • 14
51
votes
11 answers

Is there a canonical book on mathematics for programmers?

I'm a self-taught programmer. I am honestly not good in math. What advice you can give to improve my Mathematical skills so that I will not be so insecure around my fellow programmers? What are the steps or guidelines that you can recommend to…
adietan63
  • 735
14
votes
0 answers

Do we have to learn Mathematics to be a good Programmer?

Do we have to learn Mathematics to be a good Programmer?
Jervis
  • 717
13
votes
5 answers

When comparing floats, what do you call the threshold of difference?

I'm comparing floats in Java right now and the simplest formula is: Math.abs(a - b) < THRESHOLD When naming your variable for the threshold of difference, should you name it delta or epsilon? Specifically, which of the two is the correct term for…
NobleUplift
  • 815
  • 3
  • 7
  • 16
10
votes
8 answers

What is the difference between a floating decimal number and fixed decimal number?

Please explain in layman's terms.
user21186
7
votes
1 answer

Discrete Mathematics Refreshers Course?

I graduated 8 years ago and did a discrete mathematics course in my 2nd year, but I've been told that I'll likely be asked discrete maths questions in an upcoming interview. Is there a simple webpage/document that I can use to refresh my memory? I…
5
votes
4 answers

How do deal with angle wraparounds when comparing them?

Angle A is a degree angle that keeps increasing by increments and Angle B is the stopping point of Angle A (think 'Spin-the-bottle' where Angle A is the current angle of the bottle Angle B is the angle needed to point to your crush and the bottle…
JPtheK9
  • 199
4
votes
3 answers

Why do computer scientists seem to avoid closed-form solutions to mathematical problems?

There are many instances of software developmet where we seem to solve problems differently than from a mathematical perspective. For instance, consider the classical example of calculating Fibonacci numbers. Why do we implement Fibonacci numbers…
coderhk
  • 167
2
votes
1 answer

Find transformation function for point on an image

I am trying to develop an algorithm, but I barely can describe it so I'm not sure what to look for. I have two images img_A and img_B. img_A is the original, while img_B is an image of the same item but slightly different. Let's say one is a photo…
maugch
  • 123
1
vote
2 answers

Can I find the remainder more efficiently?

Here : https://github.com/gnufinder/prime-factor I submitted a contribution with the goal to find a prime factor of the number 2222+3333. The number has 3,638,334,640,025 digits, so ECM will take too long, but pollard-rho might be feasible, if…
Peter
  • 119
  • 5
0
votes
1 answer

Developing basic drawing tool involving lines, curves

I am developing a CAD - drawings to CNC machine code software. These CNC's have sort of a Instruction set which receive parameters,etc to do some blah blah job. I am quite comfortable with the CNC side; but am suddenly being asked to make a software…
ritwik
  • 9
0
votes
1 answer

How a Proof Assistant Proves ∀ or ∃

Wondering how a proof assistant such as Coq proves forall or exists. For example: Three aspects: If you were to give it a huge set of items like a million, wondering if it would actually iterate through it 3x and compare all the values to prove…
Lance
  • 2,587
  • 19
  • 35
0
votes
6 answers

Given a number which is power of 2, check if it is even power or odd power

I am given a number n , which is always a power of 2. I want to check whether n is odd power of 2 or even power of 2. For example: n=4 , ans= even n=8, ans=odd (because 8 is 2^3) n=1024 , ans=even. Can I do it using bitwise operations/ or some…
Rishabh
  • 29
0
votes
2 answers

Fiscal quarter vs calendar quarter

I'm building a Date/Time class with a "configurable quarter" system as follows. User specifies which month the quarter starts at (config) Set of functions to deal with quarters (next quarter, prev quarter, etc) All quarter functions respect the…
0
votes
1 answer

Capture portions of a number using mathematical operations

Is there a mathematical way to get the following: For the the number 777,888,999 so 777 million and etc etc getMillions(777888999) should return 777 only getThousands(777888999) should return 888 only getHundreds(777888999) should return 999…
jakstack
  • 187