Intelligent characters, very tricksy bastards to write. Fun times talking with my host about this subject.
As this isn't a place for actual advice, one can find that all over the place, I'll just throw my 2 coins at the question in the forum title because to hell with rhetoric.
Has anyone ever played a TTRPG with munchkins? You know, those little player-gremlins who concoct diabolical evil plans to ruin your game balance and derail the plot so thoroughly as to make the GM cry in tears? Those engineering types who construct a ballista bolt using a bag of holding and a portable hole to create a 10foot AoE nuke-everything-bomb? That tag-team of Sniper who can hit anything in a 1-mile radius and Wizard who can tell said Sniper where and when anything is?
Part of the social convention of TTRPGs is respecting the intended plot, and selecting your character moments to drive the plot forward and connect the player characters together to make everyone feel welcome and included, because otherwise you get what a cast of intelligent characters would actually try to do:
Rip your plot to shreds by picking actions that actually serve THEIR interests rather than YOURS (You being the author). The only real hard counter to this while keeping every character intelligent is meticulous worldbuilding and plot planning to coax your intelligent gremlins characters into acting in a way that benefit the plot. Why is this necessary with intelligent literary characters and not intelligent player characters?
PCs are driven by Players, who see the plot, and social contract in play, and have a vested interest in upholding both. Not so for Literary Characters/NPCs. As far as the characters in a book are concerned, plot doesn't exist. They have their goals and motivations, and have no reason to care about or respect what some mortal nonmagickal human that doesn't even fucking exist (the author) has to say about anything.
(There's also that when writing about characters that know fancy shit, you the author have to know that shit, and preferably know it at least one grade above what your characters present. So if you have a character that, for example, knows that you can find the vertex of a parabola by solving 2ax + b = 0 and plugging that answer in to get y, YOU should know what a derivative is, know several of the less-difficult ones, and ideally be able to derive the one your character used from scratch. For your character to know it works, you need to know why x3)
Okay this is more than 2 cents, but this may be of help to someone?