Project 19: The Function Analysis Workbench
Build a diagnostic engine for domain/range, piecewise boundaries, invertibility windows, and asymptotic behavior.
Quick Reference
| Attribute | Value |
|---|---|
| Difficulty | Advanced (Level 3) |
| Time Estimate | 12-24 hours |
| Main Programming Language | Python |
| Alternative Programming Languages | Julia, JavaScript, R |
| Key Topics | Domain analysis, inverse/composition, piecewise continuity |
| Input Mode | CLI function expressions |
| Output Mode | Structured analysis + diagnostic plots |
1) Learning Objectives
- Determine valid domains for common function families.
- Analyze piecewise continuity and boundary behavior.
- Identify intervals where inverse functions are valid.
- Diagnose asymptotic trends and singularities.
- Convert analysis into reusable model-safety checks.
2) All Theory Needed (Per-Concept Breakdown)
Concept A: Function Structure Over Point Evaluation
A function is more than value substitution. Structural properties (domain, monotonicity, invertibility, discontinuities) determine whether downstream conclusions are legitimate.
Concept B: Piecewise and Boundary Logic
Piecewise functions model regime changes. Boundary handling (< vs <=) is mathematically and computationally critical.
Concept C: Inverse and Composition Constraints
Inverse existence depends on one-to-one behavior within chosen intervals. Composition requires output domain of one function to be valid input domain of the next.
3) Project Specification
3.1 What You Will Build
A CLI tool that:
- Parses function expressions (including piecewise definitions).
- Reports domain restrictions and critical points.
- Estimates monotonic intervals and invertibility windows.
- Produces asymptote and continuity diagnostics.
3.2 Functional Requirements
- Handle polynomial, rational, root, logarithmic, and piecewise forms.
- Emit domain constraints in interval notation.
- Detect likely asymptotes/singular points.
- Run boundary continuity checks for piecewise functions.
- Save analysis summary to markdown.
3.3 Non-Functional Requirements
- Deterministic sample grids and report format.
- Explainable warnings (not only raw numeric flags).
- Configurable tolerance near singular regions.
3.4 Real World Outcome
$ python function_workbench.py --f "(x+1)/(x-2)" --analyze
[domain] (-inf,2) U (2,inf)
[vertical_asymptote] x=2
[horizontal_asymptote] y=1
[invertible_intervals] (-inf,2), (2,inf)
[output] saved report: outputs/function_analysis_rational_001.md
$ python function_workbench.py --f "piecewise: x<0 -> x^2; x>=0 -> x+1" --analyze
[boundary] x=0
[left_limit] 0
[right_value] 1
[continuity] false
4) Solution Architecture
4.1 High-Level Design
Expression Parser -> Domain Rule Engine -> Behavior Analyzer -> Plot/Report Generator
4.2 Key Components
| Component | Responsibility |
|---|---|
| Parser | Interpret function and piecewise syntax |
| Domain Rule Engine | Track forbidden values and interval constraints |
| Analyzer | Continuity/asymptote/monotonicity diagnostics |
| Reporter | Structured markdown and image output |
5) Implementation Guide
Phase 1: Domain Engine
- Implement domain rules for common operators.
- Emit interval notation consistently.
- Add fixtures for known restrictions.
Phase 2: Boundary and Piecewise Analysis
- Parse piecewise condition-value branches.
- Evaluate one-sided behavior near boundaries.
- Report continuity classification.
Phase 3: Invertibility and Composition
- Add monotonic interval detection.
- Flag where inverse may be valid.
- Validate composition domain compatibility.
6) Validation Checklist
- Domain constraints match hand analysis for reference functions.
- Piecewise continuity decisions match left/right checks.
- Asymptote detection behaves correctly on rational examples.
- Invertibility intervals are clearly communicated.
7) Extension Ideas
- Add symbolic derivative-based monotonicity checks.
- Add automatic piecewise simplification mode.
- Add export to interactive dashboards.
8) Books and References
- Precalculus function-analysis chapters.
- Introduction to Computation and Programming Using Python - modeling and diagnostics.
- Matplotlib documentation for annotation around singular points.