The 7805 is a good, cheap wonderful old dinosaur.
The usual requirements are an input bypass capacitor with good high frequency charactersistics to ensure stability.
The example circuit is a resonable general purpose arrangement using cheap electrolytics and (probably) a 100nF ceramic (?) in parallel. Cheapo electrolytics have a pretty poor high frequency response.
In some cases you don't need an output capacitor, but they are good for catching transients and this will vary with application. In addition, you should really have caps close (locally) to logic/switching ICs. Sometimes it is suck-it-and-see.
There are a zillion variants of the ancient 7805. Forget your calculator, for detailed information READ THE PRODUCT DATA SHEET.
So get the DATA SHEET for the one in your hand and READ IT.
Specific component recommendations vary between manufacturers, though there is a common theme.
No single calculation/suggestion will cover all apps.
There is little point giving a long reply here,
(though no doubt some will), when the answers are in the ..... yeah, you've got it... DATA SHEET
To save long an tedious arguments, this is from an ST DATA SHEET:-
"The L78xxA Series of fixed voltage regulators are designed with Thermal Overload
Protection that shuts down the circuit when subjected to an excessive power overload
condition, internal short-circuit protection that limits the maximum current the circuit will
pass, and output transistor safe-area compensation that reduces the output short-circuit
current as the voltage across the pass transistor is increased. In many low current
applications, compensation capacitors are not required. However, it is recommended that
the regulator input be bypassed with capacitor if the regulator is connected to the power
supply filter with long lengths, or if the output load capacitance is large. An input bypass
capacitor should be selected to provide good high frequency characteristics to insure stable
operation under all load conditions. A 0.33 μF or larger tantalum, mylar or other capacitor
having low internal impedance at high frequencies should be chosen. The bypass capacitor
should be mounted with the shortest possible leads directly across the regulators input
terminals. Normally good construction techniques should be used to minimize ground loops
and lead resistance drops since the regulator has no external sense lead."
I have found that the cap values, within reason, are not critical for gp circuits.