// Advanced Mathematical Capabilities - Type Definitions
// Part of Phase 4e Implementation
// Systems of Equations
/**
* Represents a system of equations with multiple variables.
*/
export interface SystemOfEquations {
equations: string[];
variables: string[];
}
/**
* Represents the solution to a system of equations.
*/
export interface SystemSolution {
type: 'unique' | 'infinite' | 'none';
solutions?: Map<string, number | string>;
parameterization?: Map<string, string>;
explanation: string;
}
// Inequality Handling
/**
* Represents an inequality with a variable expression, operator, and right side.
*/
export interface Inequality {
expression: string;
operator: '<' | '<=' | '>' | '>=' | '!=';
rightSide: string;
}
/**
* Represents a range of values.
*/
export interface Range {
min: number | '-∞';
max: number | '∞';
includeMin: boolean;
includeMax: boolean;
}
/**
* Represents the solution to an inequality.
*/
export interface InequalitySolution {
variable: string;
ranges: Range[];
boundaryPoints: number[];
explanation: string;
}
// Complex Expression Parsing
/**
* Represents a mathematical expression.
*/
export interface MathExpression {
original: string;
parsed: MathNode;
variables: string[];
}
/**
* Base type for all mathematical nodes.
*/
export interface BaseMathNode {
type: string;
}
/**
* Represents a number in an expression.
*/
export interface NumberNode extends BaseMathNode {
type: 'number';
value: number;
}
/**
* Represents a variable in an expression.
*/
export interface VariableNode extends BaseMathNode {
type: 'variable';
name: string;
}
/**
* Represents an operator node with operands.
*/
export interface OperatorNode extends BaseMathNode {
type: 'operator';
operator: '+' | '-' | '*' | '/' | '^' | '%';
operands: MathNode[];
}
/**
* Represents a function call in an expression.
*/
export interface FunctionNode extends BaseMathNode {
type: 'function';
name: 'sin' | 'cos' | 'tan' | 'log' | 'ln' | 'sqrt' | 'abs';
arguments: MathNode[];
}
/**
* Union type of all possible math nodes.
*/
export type MathNode = NumberNode | VariableNode | OperatorNode | FunctionNode;
// Algebraic Simplification
/**
* Options for algebraic simplification.
*/
export interface SimplificationOptions {
factorize?: boolean;
expandDistributive?: boolean;
combineTerms?: boolean;
rationalizeDenominators?: boolean;
eliminateNesting?: boolean;
}
/**
* Represents a step in the simplification process.
*/
export interface SimplificationStep {
result: string;
rule: string;
explanation: string;
}
/**
* Represents the result of simplifying an expression.
*/
export interface SimplificationResult {
original: string;
simplified: string;
steps: SimplificationStep[];
}
// Advanced Mathematical Capabilities Interface
/**
* Interface for advanced mathematical operations.
*/
export interface AdvancedMathematical {
solveSystem(equations: string[]): SystemSolution;
solveInequality(inequality: string): InequalitySolution;
parseExpression(expression: string): MathExpression;
evaluateExpression(expr: MathExpression, variables?: Record<string, number>): number;
simplifyExpression(expression: string, options?: SimplificationOptions): SimplificationResult;
}
// Extensions to existing types
/**
* Enhanced types for the MathematicalArgument interface.
*/
export interface EnhancedMathematicalArgument {
systems?: SystemOfEquations[];
inequalities?: Inequality[];
complexExpressions?: MathExpression[];
simplificationRequests?: {
expression: string;
options: SimplificationOptions;
}[];
}