namespace AIStudio.Tools.Mathematics; /// /// The limits of the Mathematics tools, in one place. /// /// /// AI Studio also runs on a Raspberry Pi, and AngouriMath cannot stop every computation midway. The /// limits keep a single call from taking the device: they bound what is read, what is computed /// exactly, and what goes back to the model. "Mathematics" in documentation/Tools.md lists them. /// public static class MathLimits { /// /// The longest expression read, in characters. /// /// /// It also bounds how deeply an expression can nest: 1,000 levels of parentheses at most, which /// the stack of a computation holds, see MathComputationService. /// public const int MAX_EXPRESSION_LENGTH = 2_000; /// /// The longest result returned, in characters, for each form of it. /// public const int MAX_RESULT_LENGTH = 20_000; /// /// The most digits an exact number may have while it is computed. /// /// /// AngouriMath computes an exact power or factorial in full and checks no cancellation meanwhile, /// so MathGuards refuses one which would grow beyond this, before it starts. /// public const int MAX_EXACT_DIGITS = 20_000; /// /// The largest exponent of a sum which may be expanded. /// /// /// (x + y)^200 expands in a few milliseconds into about 13,000 characters, while (x + y)^500 runs /// on without checking for cancellation. /// public const int MAX_EXPANSION_EXPONENT = 200; /// /// The most significant digits a decimal result may have. /// public const int MAX_DIGITS = 100; }