-
Notifications
You must be signed in to change notification settings - Fork 0
Add u-substitution rule (f'(x) * g(f(x))) #7
Copy link
Copy link
Open
Description
Goal
Implement a basic u-substitution integrator rule to handle patterns like:
- ∫ 2xcos(x^2) dx = sin(x^2)
- ∫ 3exp(3x) dx = exp(3*x)
- ∫ (2*x)/(x^2+1) dx = ln(x^2+1)
Scope (v0.4)
- Only handle multiplication forms: f'(x) * g(f(x))
- Support g(u) as:
- sin(u), cos(u), exp(u)
- 1/u (to produce ln(u))
- No full general Risch algorithm, no integration by parts yet.
Approach
- Use existing diff() + simplify() as a checker:
Try candidates u inside factors and verify if one factor equals diff(u). - Extend integrate.py with a new rule before raising IntegrateError.
Acceptance Criteria
- New tests in tests/test_integrate_subst.py (or extend test_integrate.py) pass:
- roundtrip: simplify(diff(integrate(f))) == simplify(f)
- for the listed examples above
- Existing tests remain green.
Notes
- Keep implementation conservative: better to reject unknown forms than return wrong answers.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels