Opened 4 years ago
Last modified 3 years ago
#25168 needs_review defect
Doctests: Symbolic expression matching bug
Reported by: | rws | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.4 |
Component: | symbolics | Keywords: | |
Cc: | Merged in: | ||
Authors: | Ralf Stephan | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | u/rws/25168-1 (Commits, GitHub, GitLab) | Commit: | 7f17534c420c0f3354fd97747c1a7d67971b2752 |
Dependencies: | #25447, #24838 | Stopgaps: |
Description (last modified by )
This is from GiNaC:
sage: w0=SR.wild(0); w1=SR.wild(1); w2=SR.wild(2) sage: (sqrt(c+x)*x).match(w0 * sqrt(w0+w1)) sage: (sqrt(c+x)*x).match(w1 * sqrt(w0+w1)) {$0: c, $1: x} ssage: (sqrt(c*x)*x).match(w0 * sqrt(w0*w1)) # no output: fail sage: (sqrt(c*x)*x).match(w1 * sqrt(w0*w1)) {$0: c, $1: x}
Matching practically works if wildcards are not repeated. This means it's unusable for serious work.
https://github.com/pynac/pynac/issues/324
This branch adds extensive doctest cases in a file under tests/
Change History (9)
comment:1 Changed 4 years ago by
comment:2 Changed 4 years ago by
- Branch set to u/rws/symbolic_expression_matching_bug
comment:3 Changed 4 years ago by
- Commit set to 2a22ae8b65c543d233b6bf38aefde5050e6d5dff
comment:4 Changed 4 years ago by
- Dependencies set to #25447, pynac-0.7.20
- Milestone changed from sage-8.2 to sage-8.3
comment:5 Changed 4 years ago by
- Branch changed from u/rws/symbolic_expression_matching_bug to u/rws/25168-1
comment:6 Changed 4 years ago by
- Commit changed from 2a22ae8b65c543d233b6bf38aefde5050e6d5dff to 7f17534c420c0f3354fd97747c1a7d67971b2752
- Dependencies changed from #25447, pynac-0.7.20 to #25447, #24868
- Status changed from new to needs_review
comment:7 Changed 4 years ago by
- Dependencies changed from #25447, #24868 to #25447, #24838
comment:8 Changed 4 years ago by
- Description modified (diff)
- Summary changed from Symbolic expression matching bug to Doctests: Symbolic expression matching bug
comment:9 Changed 3 years ago by
- Milestone changed from sage-8.3 to sage-8.4
update milestone 8.3 -> 8.4
Note: See
TracTickets for help on using
tickets.
It should be noted that GiNaC's match() also does not differentiate between regular and sequence variables, they behave as regular in nonassociative functions, but as sequence in sums and products. This means that
(a+b).match(a+b+w0)
will match withw0:0
. This can no longer be changed as it's established by now. It however complicates real commutative matching (if done right) by a great deal.In contrast Mathematica differentiates between
f[a + b + u_] := u
wheref
does not matcha+b
, andf[a + b + u___] := u
withf[a + b] = Sequence[]
.