# Questions tagged [replacement]

The tag has no usage guidance.

1,370 questions
Filter by
Sorted by
Tagged with
33 views

### Evaluate, NDSolve and ReplaceAll do not work with tables of solutions

Why does the following report an error even though it returns a (seemingly valid) result? It's also weird that it returns a list of lists, whereas I would expect just a list. ...
113 views

### Combining VectorPlot and Graphics3D

I have a simple VectorPlot3D VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}] Can I substitute the default arrows with Graphics3D object like: ...
57 views

### Forcing mathematica not to substitute some terms in an expression

I have an expression c which should be defined before the function and a function f defined as follows: ...
41 views

### Simplifying an equation by factoring the current coefficients in order to substitute a new coefficients

I have an equation in the following form: a*x + b*y + c*z == d I want to substitute the following constants instead of a,b,c,d: ...
89 views

### Patterns are not Sequences are not Lists, or: Global Function Argument Reversal

H[z_] := z /. {F[p__] -> F[Reverse[p]]} F[{x, y}] + F[{x, z}] + F[{}] // H Almost. It gives an annoying "Nonatomic Reverse" error message at the ...
38 views

### Formatting expressions with numeric exponents using pattern matching

Thank you all in advance. Question: I want to change the format of this expression (n + r)^3/n^3 into this (1+r/n)^3using rules ...
46 views

### How to create a simple transformation function on lists using short form of ReplaceAll?

I can easily do this with Map so the real goal of this exercise is to get a better grip on using transformation rules. Please help with this. The outputs should be ...
61 views

### Unable to plot a solution of NDSolve whilst being able to evaluate it

I want to define a function $f_c(x,y)$ as the solution of the PDE $\Delta f_c(x,y) = g_c(x,y)$, where $g_c$ is a given function depending on a constant $c$. I tried the following: ...
73 views

I hope someone can assist me as I am pretty new to Mathematica and understanding the language is a bit of a hurdle. I am trying to rotate a plot of interlaced circles by some angle without rotating ...
99 views

### general replacement

I have 500 terms. and I want replace them with below function ...
78 views

### unexpected StringCases behaviour inside function module

First, Let use see a = {"wx", "wy", "wz"}; AssociationThread[Flatten[StringCases[a, "w" ~~ d_ :> d]] -> a] gives <...
31 views

### Setting rules for Gamma functions

I have some expressions involving lots of Gamma functions. Now the arguments of the functions sometime go to zero, in which case I want to use the factorial instead of the Gamma function (since it ...
57 views

### Denoting the whole in Position/Extract/ReplacePart

Position returns lists of numbers consumed by Extract, ReplacePart and others as "...
142 views

### Replace terms without symbolic term

I have a variety of terms that have coefficients of what I'll call $c_x$ and terms that are without this coefficient. I have a variable $U$, and would like to substitute powers of $U^2 \to d$ but only ...
51 views

### Block Behavior, but for Function Assignment instead of Variable Assignment

We can define a function using a variable b that does not appear as an argument, and then using Block, change the output of the ...
56 views

### Single computation is fast, but 6 computations are extremely slow

I have an expression that involves many Sign functions. I want to expand this in the piecewise format. My function is: ...
34 views

### Trouble using pattern matching with derivatives

I'm going to pre-reference this similar question as its very nearly what I need but my attempt at extending it to my case doesn't seem to quite work: Pattern matching a multivariate derivative In my ...
147 views

### Obtaining inequality between two variables

I have two variables ...
68 views

### What is the difference between using replace all and using the value of a function?

For a project I'm working on, I'm using some functions that have a Chop[] to get rid of small terms that complicate things numerically. My function is ...
68 views

### Cutting of terms on denominators of giant expression

I have an immense expression of the form $$\sum_i \frac{f_i(X,Y,x,y)}{(a_iX^2+b_iY^2+c_ix^2+d_iy^2)(e_iX^2+g_iY^2+h_ix^2+k_iy^2)},$$ where at $a_i$ or $b_i$ AND $e_i$ or $g_i$ is different from zero....
122 views

### How to replace the arguments of a function?

I have the following type of (very long) expression: $$\ldots + X[1,2,3,5] + X[2,4,5,6] + \ldots \tag{1}$$ where $X[a,b,c,d]$ is some undefined function. I would like to replace all the occurrences of ...
89 views

### How to replace either one of the variables?

Here's my code: ...
76 views

### How to act with replacement on an association with syntax most similar to ReplaceAll

Replacements acting on Associations confuse me. I have read Pattern matching to a function evaluation inside an Association and How to use ReplaceAll and RuleDelayed with an Association? and I ...
191 views

### List all substrings of a number

Need some help listing all substrings of a number X=219 The output should be Output= {2,21,219,1,19,9} Order does not matter for this problem Any help is appreciated
90 views

### Rewrite a variable in terms of another variable

I have two variables t = 1/Sqrt (Sqrt[1 + Cos[a]] + Sqrt[1 - Cos[a]] + Sqrt[1 + Cos[b]] + Sqrt[1 - Cos[b]] + Sqrt[1 + Cos[c]] + Sqrt[1 - Cos[c]]) and <...
34 views

### Replace element within a list of lists with MemberQ condition [closed]

I'm trying to replace the second element within a list of ordered pairs depending on whether that ordered pair exists within another set. ...
85 views

### Part specification is longer than the depth of object

I want to solve the function lns50 all the values are Part 1 of an List ...
79 views

### No solution to the equation even though it has one

I was trying out Mathematica with a simple equation. I tried this one out, but it outputted nothing and when I went on WolframAlpha to test it, there was a result (c = 3 btw). Please let me know if ...
25 views

### What subsequences does SequenceReplace consider

Consider SequenceReplace[{a, b, x, x, a, c}, {a, e_} :> e]. What subsequences does SequenceReplace consider? The ...
60 views

### Using :> vs -> in SequenceReplace

The first example on the page for SequenceReplace is the following: SequenceReplace[{a, b, x, x, a, c}, {a, e_} :> e] ...
68 views

### Nonlinear Model Fitting to Numerical Data with automatic elimination

I have an experimental data set {f,x,y,z} as {{300., 2., 4., 6.}, {500., 0., 4., 25.}, {6600., 1., 15., 9.}, {100., 5., 0., 2.}, {1100., 10., 8., 1.}, {1300., 7., 8., 18.}, {300., 23., 5., 0.}, {400....
86 views

### Making a rule that only applies when the expression is NOT an argument?

I know we can make rules of the kind: magic/:f_[x___,magic[a_],y___]:=f[x,arg[a],y] This will replace magic[a] by ...
66 views

### I use the rule, but it cannot work, So I want to know why it can't? [closed]

I make a approximate solution of the differential equations. But when I use the rule for one, and it can work. But when using a list of rules, It cannot. I mean "(Sum[ep^k*Subscript[y, k], {k, 0,...
72 views

### How to change a string-formatted element in an array?

I have an array called Array7 in which a typical element, let's say Array7[], looks like this: ...
68 views

### Tracing my rules

As said in another question, I apply a set of rules to a string (OK, technically written as a function F of several arguments so I can easily apply rules on the fly)...
52 views

### Trouble with variable replacement

I'm having a lot of trouble with functions build from other functions. I'm struggling to understand the nuance of variable replacement. Here is an example: ...
62 views

### Replace with rule

I have an expression, $$test=\left(x_{jv}-y_{jv}\right)b+\left(x_{im}-y_{im}\right)c$$ ...