Quantcast
Channel: Equivalent of Nothing for patterns - Mathematica Stack Exchange
Browsing latest articles
Browse All 3 View Live

Answer by kirma for Equivalent of Nothing for patterns

You could use Repeated[..., {0,1}] to match elements which may appear zero or one times, but there's even better option in this case, that is, Optional.Cases[{-x^2 + Log@x + Sin@x, 3.14 x^2 + Log@x,...

View Article


Answer by userrandrand for Equivalent of Nothing for patterns

The comment section got a bit long and as it would be tedious for someone else to read through the comments I moved my last comment, that only solves this specific situation, to an answer.I had never...

View Article


Equivalent of Nothing for patterns

Let's say we want a pattern, that matches, when expression contains some terms but it can optionaly contain some other terms. For example:Cases[{-x^2 + Log@x + Sin@x, 3.14 x^2 + Log@x, x^2, x^2 +...

View Article
Browsing latest articles
Browse All 3 View Live