I ask myself the same question all of the time... It can either come intrinsically (you actually want to do the problem for some personal gain) or extrinsically (OH CRAP MY TEST IS TOMORROW!!!!!!!!!!!!!!!!!!!!!!!!!!!!), but I would just focus on the fact that it needs to get done. It's not always fun, especially when you haven't even been taught the material or the solution seems to come out of nowhere, but you just gotta force yourself to do it. Have discipline. I majored in math and experience the same thing, but I dread doing things because it's usually confusing, and I know it will take forever, but then I remember, the test is coming up, and I can't fail the class, so I just make myself do it. Sometimes I'll call up a friend, and we'll work on the homework together so that I'm not just sitting there totall frustrated with Laurent series or something painful that the textbook is useless for.