Please send questions to st10@humboldt.edu .
true.

?- ['density.pl'].
% density.pl compiled 0.00 sec, 24 bytes
true.

?- trace.
true.

[trace]  ?- density(Where, What).
   Call: (6) density(_G368, _G369) ? ccreep
   Call: (7) pop(_G368, _G451) ? ccreep
   Exit: (7) pop(united_states, 301139947) ? ccreep
   Call: (7) area(united_states, _G451) ? ccreep
   Exit: (7) area(united_states, 9826630) ? ccreep
^  Call: (7) _G369 is 301139947/9826630 ? ccreep
^  Exit: (7) 30.6453 is 301139947/9826630 ? ccreep
   Exit: (6) density(united_states, 30.6453) ? ccreep
Where = united_states,
What = 30.6453 ;;
   Redo: (7) pop(_G368, _G451) ? ccreep
   Exit: (7) pop(argentina, 40301927) ? ccreep
   Call: (7) area(argentina, _G451) ? ccreep
   Exit: (7) area(argentina, 2766890) ? ccreep
^  Call: (7) _G369 is 40301927/2766890 ? ccreep
^  Exit: (7) 14.5658 is 40301927/2766890 ? ccreep
   Exit: (6) density(argentina, 14.5658) ? ccreep
Where = argentina,
What = 14.5658 ..

[trace]  ?- notrace.
true.

[debug]  ?- nodebug.
true.

?- % summary: can use trace/0 to turn on tracing of SWI-Prolog's steps;
|    %   it actually has many possible commands, but type c (creep) to
|    %   proceed just one additional step (that's what I did above).
|    %
|    %   IMPORTANT: as shown above, can do:
|    %   notrace.
|    %   ...followed by
|    %   nodebug.
|    %   ...to turn OFF tracing without just killing your swipl session
|    %      in frustration... 8-)
|    halt.