It’s been a while since I’ve seen the show, but I have the impression that it wasn’t exactly rigorous in its adherence to reality.

But, hey, it’s TV, and of course you already knew that.

So, artistic license aside, I remember that Charlie’s expertise was in mathematics, which gave him *insight* into just about any field of study which involved math, but he didn’t necessarily express any depth of knowledge of these other fields much beyond how whatever neat math trick he was demonstrating applied to the problem to be solved. Thus, while I doubt the show can really be called plausible under a harsh light, it’s not quite as wacky as if he knew everything about everything.

Upon review, I’ll backpedal a little bit and say that the character does also have that superpower all scientists and other brains in just about every TV show have: at least a passing knowledge of absolutely every field of study the writers want to reference on the show. So, mathematical insight, plus the typical all-knowing scientist thing allow Charlie to relate to just about anything that comes up on the show, but he’s not likely to win any major prizes outside of math (or maybe comp sci - I don’t recall how much of his own programming he did).