-
Notifications
You must be signed in to change notification settings - Fork 1
Add user-defined constraint system (Perp, Para) #2
Copy link
Copy link
Open
Description
Summary
Implement a general constraint system where users can declare geometric relationships between vectors, and have them applied during simplification. Based on the original Scala implementation in symbolic_lhdynamics.ast.ConstraintRules.
Desired API
from geomech import Perp, Para, UserConstraints
q = S2('q')
omega = q.get_tangent_vector()
xi = q.get_variation_vector()
# Declare constraints
UserConstraints.append([
Perp(omega, q), # Dot(ω, q) → 0
Perp(xi, q), # Dot(ξ, q) → 0
# Para(a, b), # Cross(a, b) → 0
])
# Constraints applied during simplification
result = simplify(expr) # or UserConstraints.apply(expr)Constraint types
Perp(a, b)— substitutesDot(a, b) → 0(andDot(b, a) → 0by commutativity)Para(a, b)— substitutesCross(a, b) → 0
Reference
Original Scala implementation: /home/prasanth/Workspace/git/vkotaru/symbolic_lhdynamics in symbolic_lhdynamics/ast/ConstraintRules.scala
Key design from old package:
UserConstraintsis a global mutable list of active constraintsConstraintRules.apply(expr, rule)usesexpr.subs(Dot(u,v), Number(0))for Perp- Constraints are applied as a post-processing step
Notes
- This is more general than hardcoding S2/SO3 orthogonality rules in
vector_rules.py - Should support
reset()to clear constraints between different systems - Consider whether to integrate into
simplify()pipeline or keep as a separateapplystep - The commented-out code in the Scala version shows plans for vector/matrix substitution rules (
applyConstraintsV,applyConstraintsM) — consider this for future extension
🤖 Generated with Claude Code
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels