The old Windows Game Programming for Dummies came with a demo disk. On it was a 2d game with planets where you'd fire things and they had gravity behaving the way you're describing. Unfortunately, the game was named something that's also a popular name for other games. Of which I forgot the exact name of. I believe it was "Deadlock", even though that's also a 4x game that I happen to have played as well.
If anyone can find that game, you might have a lead on the type of math you need. Of course, it's just math, and if you can recreate a gravity equation, which I believe is the same as the magnet equation, (Force in relation to distance, something squared, blah) or just fake it by creating a fall-off distance where the force is greatly reduced after N units or something, you should be good.
Long story short, your problem is a math problem and you may be forced to dive into trig at the easiest, calc otherwise, and there's no getting around. Find someone who can do the equations if you can't, or go watch the tuts on game math throughout the internet. I admittedly only have surface knowledge of linear alg and whatever calc from HS.