Well, robots typically can't do magic. If they could that'd pretty much be the end of life as we know it. So for you... there must be some other explanation. Aha! You're a cyborg. That's gotta be it. Celestia had you implanted with cybernetic technology before leaving Canterlot in order to better spy on the citizens of Ponyville, didn't she? That's why you're so super smart, and you can still do magic because you still have fleshy parts. Ooh, and that's why you went crazy last saturday when you thought you'd be tardy. Because computers can't be tardy, it's against their programming, so your cyborg parts must have been injecting your body with all sorts of chemicals causing you to degenerate into a fit of insanity trying to fulfil your programming.
Eureka! That explains it all! Twilight Sparkle is a cyborg spy for Princess Celestia.
Suddenly I'm scared...