Linked Questions

4 votes
2 answers

Replace expression, but only "outside" of a function [duplicate]

I have a horrid expression, which is basically a sum of exponents with coefficients. Here's a taste: What I want to do is to replace ks with another expression, ...
yohbs's user avatar
  • 7,046
1 vote
1 answer

Substituting variables in only certain environments? [duplicate]

I was integrating a function and got something essentially like E^(mu beta) * (1/beta) There beta is defined as ...
Rethliopuks's user avatar
33 votes
5 answers

How to perform a depth-first preorder traversal of an expression?

Mathematica provides functions that perform a depth-first postorder traversal, or which use such a traversal, including: Scan, ...
Mr.Wizard's user avatar
  • 272k
5 votes
5 answers

ReplaceAll is not working correctly

The line of code -E^(-I k) x /. {-x -> -x, -E^(-I k) x -> -E^(I k) x} is not properly replacing the exponential of (-I k) with the exponential of (I k), as ...
tparker's user avatar
  • 1,856
15 votes
2 answers

Pattern to match L, but not L[_]

I have an expression where I want to replace L but not L[_] For example, the following doesn't work and ...
jlperla's user avatar
  • 977
9 votes
2 answers

Why does {2, 9, 3, 16, 81, 0.09} //. {x_Integer -> Sqrt[x]} evaluate infinite times? [closed]

Here is my code. {2, 9, 3, 16, 81, 0.09} //. {x_Integer -> Sqrt[x]} The pop-up message ReplaceRepeated::rrlim suggests ...
kile's user avatar
  • 1,671
9 votes
3 answers

How to define a Rule to match a Head except if it is a Part of another?

I have an expr which has List at various levels and I want to display them nicely as a column inside a frame but my problem is ...
user13892's user avatar
  • 9,483
5 votes
3 answers

Replace x, but not x[a] [duplicate]

I want to replace all occurences of the symbol x with x[a], as long as it is not in the form ...
Martin J.H.'s user avatar
6 votes
1 answer

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....
pdini's user avatar
  • 485
17 votes
1 answer

What is the potential usage of ReplaceAllUnheld in Developer Utilities Package?

There is a function ReplaceAllUnheld metioned in the doc Developer/ref/ReplaceAllUnheld. I am curious about what is the ...
matheorem's user avatar
  • 17.2k
7 votes
1 answer

Using two rules for the same variable

I am a newbie in the field so please not angry. I am reading the tutorial below and having a problem. Link: How to Create and Use Rules From the link: If you give two rules for the same ...
emnha's user avatar
  • 2,111