r/askscience • • Jun 17 '12

Computing How does file compression work?

(like with WinRAR)

I don't really understand how a 4GB file can be compressed down into less than a gigabyte. If it could be compressed that small, why do we bother with large file sizes in the first place? Why isn't compression pushed more often?

414 Upvotes

146 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Jun 17 '12

[deleted]

3

u/ebix Jun 18 '12

honestly; study math.

Information theory, combinatorics, and graph theory are obviously and immediately applicable to a lot of compsci. But even things like group theory, topology and analysis will help you in the strangest places. Moreover they will train your brain, and everything will seem easier.

To quote /r/compsci; "contrary to popular belief, computer science is mostly math"

1

u/[deleted] Jun 18 '12

i wish i had studied math before doing my masters in economics. Stuff like measurement theory, ito calculus ( to a degree) and asymptotics hits you like a brick wall without the proper preparation.

The thing is I understand all these things, kinda, but I want to be as good in them as i'm at stuff like calculus. and an economics bachelor doesn't really prepare you for that :(

stuff like microeconometrics, system econometrics and time series econometrics is pretty hard without a thorugh math background.

2

u/arienh4 Jun 17 '12

Whoa, you're giving me far more credit than I'm due. I'm more of a hobbyist, to be honest. I know some of this stuff from working with compression personally, but I'm not starting CompSci for another year.

What I provided was more of a reworking of Ebix's answer than real original content, to be honest.

They might be able to help you, not I.

2

u/UncleMeat Security | Programming languages Jun 18 '12

Sipser's book is considered by many to be the best introductory text on theory of computation. It covers a lot of things that are needed to understand PL theory, but not PL itself.

There is no "best" text on PL that I am aware of. It depends on if you want more practical ideas like parsers and compilers or more mathematical ideas like algebraic type theory. The "dragon" book is a well known book that covers the first set of materials. Fundamentals of Programming Languages by Mitchell is a pretty good guide to the second set of materials, but it is a little dry.

1

u/errandum Jun 18 '12

No book. But you should read LZW, LZ77 and LZ78, since I'm under the impression that they are the basis for most of the lossless ones used nowadays. Below are the links for the original papers. You should start by LZW

LZW

LZ77 LZ78

EDIT: Sorry, wrong just noticed this was not what you were looking for. I got blinded by the topic. I guess The art of computer programming is not what you want either?