Timeline for Efficient Search for specific Terms in symbolic Expression
Current License: CC BY-SA 3.0
Post Revisions
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Nov 10, 2017 at 12:26 | history | bounty ended | Mario Krenn | ||
| S Nov 10, 2017 at 12:26 | history | notice removed | Mario Krenn | ||
| Nov 10, 2017 at 12:26 | vote | accept | Mario Krenn | ||
| Nov 8, 2017 at 22:56 | answer | added | TimRias | timeline score: 3 | |
| S Nov 2, 2017 at 14:10 | history | bounty started | Mario Krenn | ||
| S Nov 2, 2017 at 14:10 | history | notice added | Mario Krenn | Draw attention | |
| Oct 31, 2017 at 14:55 | answer | added | Carl Woll | timeline score: 4 | |
| Oct 31, 2017 at 14:44 | history | edited | Mario Krenn |
added tags
|
|
| Oct 31, 2017 at 12:06 | comment | added | Mario Krenn |
@aardvark2012 thanks for your solution; unfortunatly it also uses Expand, thus its as fast/slow as my original solution. Also it gives a slightly different result, as it also returns expressions like b c d e f^2 which I do not want.
|
|
| Oct 31, 2017 at 4:05 | comment | added | aardvark2012 |
As you note, all the time seems to be being spent on Expand (Simplify is even worse). Coefficient[func, c d e f] c d e f returns the same as g and is almost order of magnitude faster when they're both passed already Expanded (or Simplifyed) expressions (and marginally faster when the argument isn't pre-Expanded, but there's not a lot to choose between them).
|
|
| Oct 31, 2017 at 3:48 | history | tweeted | twitter.com/StackMma/status/925207763466313728 | ||
| Oct 31, 2017 at 2:53 | comment | added | Nasser |
@aardvark2012 No, the order does not matter when doing /. Mathematica will match a b or b a for the pattern a b. Compare a b c/.a b->x and a b c/.b a->x they give same answer which is c x. Your string solution will not work, since only a b will be matched and not b a as in the case of general pattern
|
|
| Oct 31, 2017 at 2:48 | comment | added | aardvark2012 |
If you're just interested in the literal occurrence of c d e f as a string in the expanded form of expr, and you're not worried about the order depending on Mathematica's canonical ordering, you could use Pick[#, StringContainsQ["c d e f"] /@ ToString /@ #] &@(List @@ Expand@expr).
|
|
| Oct 31, 2017 at 2:37 | comment | added | aardvark2012 |
So in your example expr, a b c d e f counts but a d c d e f doesn't? This will be very dependent on how the terms in the expression are arranged. Would you want it to generalise to, for example, picking out terms involving b d e f?
|
|
| Oct 31, 2017 at 1:30 | history | asked | Mario Krenn | CC BY-SA 3.0 |