Questions tagged [semantic-matching]

Posts about semantic pattern matching rather than syntactic pattern matching (which is the built-in pattern matcher of Mathematica) e.g. "Why x^3 /. x^2->a doesn't work!"

Filter by
Sorted by
Tagged with
2 votes
2 answers
117 views

How can I change variables, if the variables I want to change to are not directly stated in the term?

So I don't mean something like this f[x_] = x^2 f[x] /. x^2 -> y But what I mean is something like this: where the variables I want to change to are defined ...
  • 67
5 votes
2 answers
250 views

What is a nice way to convince Mathematica to use $\tau$ instead of $\pi$ in evaluated formulas?

I have tried like Replace[something, {2*π -> HoldForm[τ]}] Although it works well where a lone 2 π symbol, it fails to ...
2 votes
1 answer
129 views

ReplaceAll with Powers

If I run the following code: a^2/b^2 /. {a/b -> c} I'm getting output: a^2/b^2 How can I obtain ...
2 votes
0 answers
170 views

What is Wolfram's equivalent of Maple's algsubs?

Maple has two primary substitution functions. subs - which is similar to ReplaceAll in WL. algsubs - which does replacement but takes into account the algebraic ...
  • 8,477
2 votes
2 answers
268 views

How do you get substitution to recognize a derivative?

I have a simple expression involving a derivative: x[t_] = Q/T[t]; Simplify[Derivative[1][x][t] /. Q -> x T[t]] That produces:$$-\frac{x T'[t]}{T[t]}$$I have ...
  • 1,521
5 votes
3 answers
583 views

ReplaceAll (/.) not working as expected

I am trying to replace some variables in the form of n*wt with wt. However, I came across some cases where the ...
  • 1,257
4 votes
2 answers
320 views

Definition of a general rule

By defining: rule = Sqrt[expr_^2] :> expr; and writing: Sqrt[x^2] /. rule I get: x which is what is desired (...
  • 4,385
0 votes
1 answer
38 views

Parsing time interval strings as "Uncertain" Time Intervals

Problem: I have strings of form "[d1, d2]" or sometimes just [d1] where d1 and ...
  • 2,995
8 votes
1 answer
1k views

How to find multi-word synonyms?

I’m looking to write a semantic distance function for phrases (5 words or less) that can map multi-word synonyms together. My domain is e-commerce fashion - here are some required examples for a ...
  • 30.9k
0 votes
1 answer
182 views

Using Semantic Import to do an Excel-like VLookUp using Mathematica

I'm following an example provided in the following Stack Exchange Link but, using a different approach. My data is contained in an Excel workbook called "Input Workbook.xlsx" as shown here: I ...
4 votes
2 answers
202 views

"Smart" substitution of subexpressions

I have the following question. An expression, which I want to simplify contains several subexpressions which appear quite frequently all over the place. To optimize simplification I would like to ...
  • 223
3 votes
0 answers
126 views

SemanticImport extremely slow with "Number" format

With the following definition: col = "num\n" <> StringRiffle[Table[i, {i, 1000}], "\n"]; I do not understand why the ...
2 votes
2 answers
169 views

Sets of identical equality/inequalities

So I've used Mathematica for some months, but I never noticed this sort of thing about it, namely: (a > b) == (b < a) which are supposed to be identical ...
  • 183
0 votes
1 answer
185 views

Simplifying expressions

Let's define a function $\Omega(x,y)$ ...
  • 8,368
59 votes
4 answers
10k views

Can I simplify an expression into form which uses my own definitions?

This seems like a simple thing to do, but I couldn't find anything relevant from Mathematica documentation. So suppose I have an expression: a*b/(a + a*Cos[a/b]) ...
  • 961