Overview
TheInterpretation enum captures the semantic meaning of a calculated price value, not just its numeric result. The same mathematical function can represent different economic concepts depending on its interpretation.
Why Interpretation Matters
Key Insight: A calculator returning
PLN 100.00 could mean:- TOTAL: Total cost for all units
- UNIT: Average price per single unit
- MARGINAL: Price of the n-th specific unit
Enum Definition
Interpretation Types
TOTAL
Total price for the entire quantity or time period.Description:
"Total price for entire quantity/period"Mathematical Relations:Total(q) = Σ[i=1→q] Marginal(i)- Sum of all marginal pricesTotal(q) = UnitAverage(q) × q- Average unit price times quantity
- ✅ Always applicable
- ✅ Works for 1D functions (quantity, time)
- ✅ Works for multi-dimensional functions (GB × hours × region)
- “Total cost for 15 items: PLN 140.00”
- “Total invoice amount: EUR 1500.00”
- “Complete project cost: PLN 50,000.00”
- Order totals
- Invoice amounts
- Project budgets
- Subscription fees
UNIT
Average price per single unit.Description:
"Average price per single unit"Mathematical Relations:UnitAverage(q) = Total(q) / q- Total divided by quantity
- ⚠️ Only for 1-dimensional functions (quantity, time, weight, etc.)
- ❌ Ambiguous for multi-dimensional functions
- “PLN 10.00 per kilogram”
- “PLN 150.00 per hour”
- “Average price per item: PLN 9.33”
- “EUR 0.05 per kWh”
- Unit pricing labels
- Rate cards
- Comparative shopping
- Per-item costs
MARGINAL
Price of the n-th specific unit (incremental cost/benefit).Description:
"Price of n-th specific unit"Mathematical Relations (Discrete):Marginal(n) = Total(n) - Total(n-1)- Difference between consecutive totals
Marginal(x) = dTotal/dx- Derivative of total price
- ⚠️ Only for 1-dimensional functions
- ❌ Not applicable for multi-dimensional functions
- “15th item costs PLN 8.00” (bulk discount)
- “11th hour costs PLN 120.00” (overtime premium)
- “Next GB costs EUR 0.10”
- Marginal analysis (“Should I buy one more?”)
- Break-even calculations
- Optimization decisions
- Progressive pricing
Interpretation Methods
describe()
String- Description text
Practical Examples
Example 1: Step Function - Different Interpretations
The same step function calculator can have different meanings:Example 2: Converting Between Interpretations
UNIT → TOTALExample 3: Business Scenario - Conference Pricing
Composite Calculators and Interpretation
Valid Composite:Default Interpretation
Most calculators default toInterpretation.TOTAL when not specified:
Interpretation vs. Calculator Type
Interpretation and CalculatorType are orthogonal concepts:
- CalculatorType: How the price is calculated (algorithm)
- Interpretation: What the calculated price means (semantics)
Mathematical Relationships
Discrete Functions
For 1-dimensional discrete functions (quantity = 1, 2, 3, …):Continuous Functions
For 1-dimensional continuous functions:Best Practices
Choose Interpretation Carefully
Select the interpretation that matches your business domain:
- Invoices →
TOTAL - Price tags →
UNIT - Marginal analysis →
MARGINAL
Document Interpretation
Always document which interpretation your calculators use, especially when building composite pricing models.
Use Adapters for Conversion
Don’t manually convert between interpretations. Use the built-in adapter classes:
UnitToTotalAdapterTotalToMarginalAdapter- etc.
Validate Composite Components
The framework automatically validates that composite calculators have uniform interpretations. Don’t try to mix them.
Related Documentation
- Calculator Interface - Using interpretation in calculators
- Calculator Types - Calculator type system
- Parameters - Input parameters for calculations
