Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 96078

Questions on expression testing and manipulation through pattern matching and constructing efficient patterns.

2 votes

Taking some terms from a polynomial

You can adapt Yode's method from his answer to: Removing terms of certain degree in multivariable polynomial var={x,y}; Sort@Select[MonomialList[ser], Tr[Exponent[#, var]] < 5 &] $$\left\{1,-\f …
theorist's user avatar
  • 3,643
2 votes

Identify complex expression and replace

You could do it semi-manually: MYoverMOD = (-Sin[ang] mzX + Cos[ang] mzY); MXoverMOD = (Sin[ang] mzY + Cos[ang] mzX); modSquared = (1 - mz^2)/(mzX^2 + mzY^2); deriv = D[mx, t]; deriv /. {modSquared - …
theorist's user avatar
  • 3,643
8 votes
2 answers
316 views

Dividing a list into $n$ non-overlapping pieces?

Is there a function that gives all the ways a list can be divided into a specified number of non-overlapping pieces, where the order is maintained? I can do this with Table. For instance, if the list …
theorist's user avatar
  • 3,643
3 votes
1 answer
289 views

Replacement rule to display negative exponents as denominators

Suppose I have an expression of the form: expr=f[t]^b + f[t]^a g[t]^-a + g[t]^-c And I want to create a rule to convert negative exponents to denominators. In the above example, this could be achi …
theorist's user avatar
  • 3,643
0 votes

Making strict replacements in Mathematica

Considering all of your test cases: Unevaluated[1/n1/n2/n3/n4 + n5/n1/n2/n3/n4] /. {HoldPattern[1/n1/n2/n3/n4] -> a, HoldPattern[n5/n1/n2/n3/n4] -> b} a + b Unevaluated[n2/n3/n4/n5 + n1*n2 …
theorist's user avatar
  • 3,643