Tag Info

Hot answers tagged

94

First off: I am a mathematician - a professional one (in that I get paid for doing maths). I am not a programmer. I do do some programming, but very definitely of the Cargo Cult variety (see first comment to http://tex.stackexchange.com/q/451/86 and my response) and nothing of the sort that would normally bring me to this site (indeed, I registered here to ...


82

I think it depends on what type of programming you want to do. As far as being a programmer in the business world goes, I would say that the answer is no. You can become a great programmer without knowing advanced mathematics. When you do end up having to deal with math, the formulas are usually defined in the business requirements so it only becomes a ...


60

If you want a "math-like" language, Haskell is your best friend (for your best friend). You can easily make new functions without hassle. It is the best language recommendation I can give you for you friend. Here are some links: Try Haskell - An online Haskell compiler and tutorial. Learn You A Haskell For Great Good! - This is how I learned Haskell. How ...


54

The usual reason for writing numbers, in code, in other than base 10, is because you're bit-twiddling. To pick an example in C (because if C is good for anything, it's good for bit-twiddling), say some low-level format encodes a 2-bit and a 6-bit number in a byte: xx yyyyyy: main() { unsigned char codevalue = 0x94; // 10 010100 printf("x=%d, ...


53

There are many different fields of programming and many of those don't require a particularly high standard of mathematical knowledge. You will never be able to write a 3D engine, but you will certainly be able to develop business and web applications. Let's face it - the most common mathematical operation in most computer programmes is incrementing a number ...


50

Assuming that your square might be rotated against whatever coordinates system you have in place, you can't rely on there being any repetition of X and Y values in your four points. What you can do is calculate the distances between each of the four points. If you find the following to be true, you have a square: There are two points, say A and C which ...


49

I know this is an old post, but I saw this post being referenced and dislike the chosen answer's tone. So I did a bit of investigation! DirectX is old. It was first released in 1995, when the world had much more than Nvidia and ATI, DirectX vs OpenGL. That's over 15 years, people. 3dfx Interactive's Glide (one of DirectX's competitors back in the day. ...


43

Digging from http://www.befria.nu/elias/pi/binpi.html to get the binary value of pi (so that it was easier to convert into bytes rather than trying to use decimal digits) and then running it through ent I get the following for an analysis of the random distribution of the bytes: Entropy = 7.954093 bits per byte. Optimum compression would reduce the ...


41

There is a math ceiling. If you can't get math, you will never move into the really sophisticated areas in computer science beyond the math ceiling. Most basic business programming is under the math ceiling, however. If someone wants to be all they can be, they will have taken the math courses( Linear, Calc 1, Discrete, and Calc 2). And, as a corollary, ...


41

The main reason I use different bases is when I care about bits. It's much easier to read int mask=0xFF; byte bottom_byte = value & mask; than int mask=255; byte bottom_byte = value & mask; Or image something more complex int mask=0xFF00FF00; int top_bytes_by_word = value & mask; compared to int mask=4278255360; //can you say magic ...


31

I'm a mathematician turned programmer (after a PhD and postdoc in algebra and cryptography respectively). Here are the things that I didn't know before I switched! 1) If you're not straight out of college or university, there aren't many programming jobs for people without experience, so you will probably either need to get experience on say an open-source ...


30

You don't have to be good at math. However, you have to be good at logic, and problem solving. However people who are good at logic and problem solving are usually good at math also. I would say that it really depends on the type of math. You can be terrible at calculus (like me), and still be a good programmer (like me). But if you have trouble with ...


27

The right thing to do in such circumstances is to implement the algorithm, formula or whatever with exactly the same variable names as in the primary real-world source (as far as the programming language allows this), and have a succinct comment above it saying something like "Levenshtein distance computation as described in [Knuth1968]", where the citation ...


26

The simplest solution would be to create a list where each element occurs as many times as its weight, so fruits = [apple, apple, apple, apple, orange, orange, lemon] Then use whatever functions you have at your disposal to pick a random element from that list (e.g. generate a random index within the proper range). This is of course not very memory ...


24

To simplify things by defining a concrete implementation, I will assume (as other answers do) that we're talking about IEEE 754 64-bit floating point. Each floating point number has three parts: a sign, an exponent, and a mantissa. (Technical details about hidden bits are irrelevant to this discussion). Reciprocation doesn't affect the sign 1 / (2**e * m) ...


24

Your argumentation against floating point numbers is very fragile, probably because of naivety. (No offense here, I find your question is actually very interesting, I hope my answer will also be.) A classic argument is that floats provide a greater range, but high precision integers can meet this challenge now. For example: with modern 64-bit ...


23

All programming is related to mathematics. Indeed many universities still place their computer science programs under the purview of the mathematics department. As for learning functional programming, you do not need to have a strong base in mathematics to learn it. I've learnt three different functional languages now to reasonable proficiency (Haskell, ...


23

Hmm, from what you say it seems you want to start very basic. Nothing bad about that, I did the same. My math was mostly high school level and a lot of it forgotten. Start with Khan Academy, go to the practice section and see how far you can get. This will give you a good idea what you can do and where to start learning. Don't bother watching the videos. ...


22

I'm surprised nobody mentioned something: OpenGL works in a left-handed coordinate system too. At least, it does when you're working with shaders and use the default depth range. Once you throw out the fixed-function pipeline, you deal directly with "clip-space". The OpenGL Specification defines clip-space as a 4D homogeneous coordinate system. When you ...


22

I think this StackOverflow question answers it: http://stackoverflow.com/questions/4948780/magic-numbers-in-boosthash-combine Essentially, it is a "golden number" for hash functions, and it being an integer is quicker to calculate. The notation 0x is for a hexadecimal number, or base 16. The benefit of a base 16 number is that each pair of digits ...


21

The demands you have put actually put Fortran at the top of the list, for problems like this: a) number crunching b) paralellable c) it was and still is the de facto language taught outside of cs studies (to engineers who aren't professional programmers). d) has an incredible(!) industry backing, number-of-industry-grade-compilers-wise, with none of the ...


21

They're not that closely related. For programming, it is important to know about mathematics- especially those branches pertaining to, for example, algorithm performance, but the simple fact is that there is no branch of mathematics that will tell you that Singletons are a horrifically bad idea, for example, or when to favour inheritance over composition, or ...


20

Purely functional programming languages, such as Haskell, enforce immutable variables. I like to call them identifiers though, instead of variables.


19

In the end, basic arithmetic operations are done in hardware. More specifically, in the CPU (or actually, a subpart thereof) In other words, it's electronic circuits. Set the appropriate bits as input and you will get the appropriate bits as output. It is a combination of basic logic gates. http://en.wikipedia.org/wiki/Adder_%28electronics%29 ...


19

Read Steve Yegge's post on Math for Programmers. Among his insights: Math is a lot easier to pick up after you know how to program. In fact, if you're a halfway decent programmer, you'll find it's almost a snap. They teach math all wrong in school. Way, WAY wrong. If you teach yourself math the right way, you'll learn faster, remember it longer, ...


19

You don't need to know more than perhaps trigonometry in order to develop web pages. But you should know the following if you want to be optimal: Set Theory: This helps with more things that I can count in programming. You learn how to weed out duplicates more efficiently. Graph Theory: If you want to understand networks at a fundamental level, this is ...


19

I am a poor mathematician - numerical methods (Computer Science 412) was a class I took several times, and please don't ask me to do an integral calculus problem. When I was done with it, I thought I'd never touch such a math problem again. A number of years later, I wanted to make an image of an animated braid in RGB as an avatar. I did that. While the ...


19

Physical characteristics of the universe (like the number of atoms in it) are not useful to determine the boundaries of number sizes, because useful calculations exist using numbers having wider ranges. Floating point numbers are a tradeoff between accuracy and range. They deliberately give up some accuracy to achieve greater range.



Only top voted, non community-wiki answers of a minimum length are eligible