UPDATED because of replies from Tone and TimBentley!
it is calculated like this:
Yield per tile =
natural terrain yield +
(bonus) resource +
river bonus +
road +
government bonus (republic, democracy)+
golden age +
collosus +
commercial dock. (water tiles only)
- government penalty (despotism, anarchy)
Total yield from tiles = the yield collected by every citizen in the city working a tile + city center.
Base commerce= Total yield from tiles + total tourist income from all wonders.
Net commerce = Base commerce - corruption. (corruption is always 100% under anarchy)
------------ This block isn't 100% accurate, see quote by TimBentley below...------------
Base tax = net commerce * tax slider %
Base science = net commerce * sci slider %
Base lux = net commerce * lux slider %
--------------------------------------------------------------------------------------------------
Net tax = base tax * sum city-improvements multipliers + (tax collector specialists * 2) + wealth
Net science = base science * sum city-improvements and wonder multipliers + (scientist specialist * 3)
Net lux = base lux (no city improvements or wonders multiply this in the epic game, but it is possible in some scenarios)
The multipliers work like this:
Base tax + (Base tax * multiplier structure 1) + (Base tax * multiplier structure 2) + etc... Same for science. And then the result is rounded.
So if you have both a market and a bank then the total multiplier is 100%
Example: a city size 24, in republic, no rivers, no bonuses on the terrain, 12 sea tiles, and 8 land tiles with road, 20% corruption, sliders are 6/2/2 (sci/lux/tax) 3 scientist and 1 taxman.
The city has the commercial dock, a marked a bank, a library, a university, newtons university (4 tourist money)
The total yield from tiles is: 24 from sea 8 from roads 12 from commercial dock, 1 city center. 21 government bonus = 66
Base commerce = 66+4 = 70
Net commerce = 70*0.8 = 56
Base tax = 56*0.2 = 11.2 --> 11
Base sci = 56*0.6 = 33.6 --> 34
Base lux = 56*0.2 = 11.2 --> 11
Net tax = 11.2 +5.6(market) +5.6(bank) +2 (taxman) = 24.4 --> 24
Net sci = 33.6 +16.8(lib) +16.8(uni) +16.8(newtons wonder) +9 (scientist) =93 --> 93
Net lux = 11.2 --> 11
Or even more accurate: (but I didn't want to rewrite my whole story)
More accurate would be to say
if sci+lux<100%
Base science = net commerce * sci slider %
Base lux = net commerce * lux slider %
Base tax = net commerce - base science - base lux
if sci+lux=100%
Base science = net commerce * sci slider %
Base lux = net commerce - base science
Base tax = 0 (obviously)
This is usually the same as my own formula, but it explains why sometimes, your happiness is effected when you move the SCI slider.