Accidentals - sharp or flat
There is one thing I still can't understand - what kind of logic is behind picking up such or such accidental (sharp or flat). For example, in the piece of music below we see a F sharp as well as G flat. Why not to write F sharp or G flat in both cases? The tonality of this part of Mozart's fantasia is C major, I guess.
There is another example (see below Mozart's fantasia) - waltz from 'The Swan Lake' by Tchaikovsky. We see there a F double sharp instead of G natural. I wonder just WHY. The tonality is A major (3 sharps at the treble clef)