In a manner that relates to mathematics or is based on mathematical principles. The problem was solved mathematically, ensuring accuracy and precision.
With regard to mathematical accuracy or exactness. The architect calculated the dimensions mathematically to ensure the building's stability.
From a mathematical standpoint; theoretically according to mathematical reasoning. Mathematically, the spacecraft could reach Mars in six months, but engineering limitations make it impossible.