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!"
25
questions
3
votes
5
answers
180
views
Importing Specific Data from a Text File
I am quite new to Mathematica. I have a text file that upon importing has a repetitive structure with characters included. I need to extract only the following in numbers only (no letters, dash lines, ...
3
votes
2
answers
44
views
Trouble with replacement rules for squared variables [duplicate]
I want to do replacement of products (because I am dealing with abstract projectors), but Mathematica seems to fail understanding this toy example replacement :
...
5
votes
1
answer
212
views
How to Replace 'delta t' with 'a' in Mathematica Without Affecting Separate Instances of 'delta' or 't'?
In Mathematica, how can I replace instances of delta t in an expression with a, while keeping instances of ...
0
votes
3
answers
59
views
How to replace polynomials numerically? [duplicate]
We know that the value of this equation is 0
x2 y1 - x1 y2 == 0
For the following equation, there is a correlation between the polynomial parts of the known ...
1
vote
1
answer
109
views
Expression substitution
I konw:
$$
a_0=\frac{4 \pi \epsilon_0 \hbar^2}{m_e e^2}
$$
and
$$
\alpha = \frac{m_{\mathrm{e}}^2 e^4}{18 \pi^3 \epsilon_0^2 \hbar^4}
$$
So we can use $a_0$ for $\alpha$,like this:
$$
\alpha=\frac{m_{\...
0
votes
0
answers
75
views
Neural network: Segmentation of water and not water area
Good morning everyone. I have a large dataset of photographs similar to the one attached. It would be my intention to train a neural network to recognise water and "non-water" zones. How ...
4
votes
4
answers
191
views
How to use replacement rules in a named expression before a sub-expression evaluates?
I have a named expression: expr := a + b. a and b are also named expressions.
Let's say <...
2
votes
1
answer
155
views
How to replace Divide in an expression?
It seems that a/b is always replaced with the form: a * b^-1, Times[a, Power[b, -1]]. I ...
4
votes
3
answers
193
views
Rule can not work? [duplicate]
For example I have this equation,I want to use c->a/b ,but it can not work
$$
\frac{a^2}{b^2}+\frac{b^2}{a^2}+\frac{a}{b}+e^{a/b}+\frac{b}{a}+\log \left(\frac{a}{b}\right)
$$
...
2
votes
2
answers
139
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 ...
5
votes
2
answers
275
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 ...
3
votes
1
answer
190
views
ReplaceAll with Powers [duplicate]
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
228
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 ...
2
votes
2
answers
350
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 ...
5
votes
3
answers
718
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 ...