Arch shapes (in which the melody rises and then falls) are easy to find in many melodies. A particular genre or composer might have his own personal rising action and denouement , and we tend to think in multiples of four. but I think there are to many variables... Rhythm: (beat, meter, tempo, syncopation) , and Dynamics: (forte, piano, etc.) and, of course the actual Melody: (pitch, theme). You can look into the basic chord progressions (e.g. I - IV - V - I) and expand. The more complex the harmonies, the more complex the mathematics would be. Music needs to being out a statement, think about it, and resolve.