All Questions
Tagged with replacement expression-manipulation
17
questions
106
votes
5
answers
6k
views
Replacement inside held expression
I wish to make a replacement inside a held expression:
f[x_Real] := x^2;
Hold[{2., 3.}] /. n_Real :> f[n]
The desired output is ...
18
votes
1
answer
607
views
Why is ReplaceAll behaving like this?
I'm learning to use the ReplaceAll function and I found the behavior of which is quite confusing.
For
Sqrt[f[x, y]] /. f[___] -> u
Mathematica returns
<...
17
votes
2
answers
952
views
Transform an expression into a graph that can be plotted with TreeGraph (not TreeForm)
I would like to plot an expression (like TreeForm does), but using the new TreeGraph functionality.
...
6
votes
1
answer
681
views
Embedding StreamPlot in Graphics3D
I am trying to visualise the action of the infinitesimal generator of a Lie group on the solution of a 2-ODE system drawn in the 3D space (t,y1,y2): t is time and y1,y2 are the two dependent variables....
17
votes
1
answer
324
views
When is the righthand side of a RuleDelayed evaluated?
The documentation on RuleDelayed states that lhs :> rhs represents a rule that transforms lhs to rhs, evaluating rhs only after the rule is used.
Consider the ...
10
votes
2
answers
1k
views
What is the Difference Between Rule (->) and RuleDelayed (:>)?
I am new to Mathematica so this question may seem rudimentary. Sorry for that! :)
I want to implement the well-known property of Kronecker's Delta
$$\Sigma_{i=1}^{n} a_i \delta_{ij}=a_j,\quad 1 \le ...
5
votes
4
answers
1k
views
Replace every Minus to Plus in Expression
Thought this is a rather simple thing, but I was not able to find a solution.
I have a polynomial expression like:
...
7
votes
2
answers
231
views
Efficient Search for specific Terms in symbolic Expression
I have a large symbolic expression with six variables a,b,c,d,e,f per term, roughly like this:
...
5
votes
5
answers
442
views
How to subtract these two equations?
There are two equations:
eq1 = x1^2/a^2 + y1^2/b^2 == 1;
eq2 = x2^2/a^2 + y2^2/b^2 == 1;
How to get this result by subtracting two equations?
the result
...
5
votes
1
answer
87
views
Substituting elements of lists into an expression
Suppose I have the following lists,
as = {1, 2, 3, 4};
bs = {10, 20, 30, 40};
and the following expression:
...
5
votes
2
answers
306
views
Replace a randomly chosen part of an expression
Given an arbitrary Mathematica expression, how can I choose a random part of the expression and replace it with another symbol of my choosing?
For example, given $a x^3 +2y\cos(x)- \tanh(x^{y+3})/(x^...
3
votes
6
answers
301
views
Making strict replacements in Mathematica
My question is quite a simple one, but I have not been able to find a solution yet. Say I have terms of the form e.g
1/n1/n2/n3/n4
and
...
2
votes
0
answers
93
views
Don't simplify integer square roots
How can I rewrite an expression like $\frac{1}{2\sqrt{3}}$ as $\frac{1}{\sqrt{12}}$?
This works in principle, but gets immediately simplified back to the original expression
...
2
votes
2
answers
1k
views
Replace doesn't replace the denominator [duplicate]
I have the following expression in Mathematica
-((E^(2 - 2 Sqrt[(x[1] - x[2])^2]) (x[1] - x[2]))/Sqrt[(x[1] -
x[2])^2])
I want to replace anything of the ...
1
vote
2
answers
106
views
Symbolic derivative of transposition
I have an expression:
expr = Transpose[x]+Transpose[f[x]]+Transpose[x+f[x]]
I want to differentiate this expression and desired result looks like this:
...