Sizing your swap space (part 1)
The amount of memory that a program needs in order to actually get some
work done is called its Resident Set Size (RSS). The total amount of
virtual memory a program uses is called various things;
ps uses VSZ
(Virtual Size, presumably), for example.
The premise of paging things out to your swap space is that most programs don't need to use all of their memory all of the time; their RSS will be smaller than their VSZ. The difference can be pushed out to swap space in order to free up little-used pages to make room for another program's RSS.
(This is a simplification; not all of the inactive pages have to be pushed out to swap, since some of them are backed by files instead.)
So the simple answer is that your desired swap size is more or less the difference between the total virtual memory size of all of your programs and their total RSS, plus some margin for error. This gives you enough room to push all of the unproductive pages out of RAM to free it up for more productive uses.
(This does assume that your total RSS usage fits into your RAM, but if it doesn't you have bigger problems: you're trying to do too much for your machine and it's going to be thrashing to death.)
Unfortunately, modern operating systems don't really make it very easy to compute useful numbers for the amount of system-wide virtual memory that might need to be swapped out and the total system-wide RSS. While you can mostly get figures for individual processes, summing them all together will overcount shared pages, and these days (with shared libraries and the like) there are a fair amount of them.