6 votes
Accepted

How to force Mathematica to simplify in terms of half angles?

Clear["Global`*"] expr = Sinh[x]/(Sqrt[2] Sqrt[1 + Cosh[x]]) (expr /. x -> 2 θ // TrigExpand // Simplify) /. θ -> (x/2) // PowerExpand Sinh[x/...
Syed's user avatar
  • 41.7k
5 votes
Accepted

How to make ReplaceAll recognize what to be replaced in a situation like this?

Instead of x + y -> 1 replace only one of the variables x->1-y or y->1-x, it does ...
azerbajdzan's user avatar
  • 9,868
5 votes
Accepted

How to Replace 'delta t' with 'a' in Mathematica Without Affecting Separate Instances of 'delta' or 't'?

...
Bob Hanlon's user avatar
  • 152k
5 votes
Accepted

With function replace rule does not work in

try this: sumT = TA + TE; With[ {TA = 0.1, TE = 0.2}, Evaluate@{TA + TE, sumT} ]
AsukaMinato's user avatar
  • 8,815
4 votes
Accepted

ReplaceAll causing infinite recursion

$Version (* "13.3.1 for Mac OS X ARM (64-bit) (July 24, 2023)" *) Clear["Global`*"] You can never Set a ...
Bob Hanlon's user avatar
  • 152k
4 votes

How to make ReplaceAll recognize what to be replaced in a situation like this?

ReplaceAll operates on the parts of the expression. ...
Bob Hanlon's user avatar
  • 152k
4 votes
Accepted

Different answers when attempting replacement of function argument

The /. infix form is just syntactic sugar. The expression that gets evaluated here is ...
lericr's user avatar
  • 24.5k
4 votes

Different answers when attempting replacement of function argument

fib1 should be limited not to evaluate unless $n$ is an explicit integer number, so let's redefine it as such (in the following I've also used a version with ...
MarcoB's user avatar
  • 65.8k
3 votes

Different answers when attempting replacement of function argument

Look at: fib1[n] -1 + n fib1[n] /. n->10 9 And for fib2: fib2[n] 2 Here the ReplaceAll does nothing.
Daniel Huber's user avatar
  • 47.2k
3 votes

With function replace rule does not work in

In answer to Could you give some explanation ? Just follow the evaluation process With[ {TA = 0.1, TE = 0.2}, {TA + TE, sumT} ] ...
lericr's user avatar
  • 24.5k
3 votes

With function replace rule does not work in

Replace With with Block: sumT = TA + TE; Block[{TA = 0.1, TE = 0.2}, {TA + TE, sumT}] {0.3,...
eldo's user avatar
  • 48.3k
3 votes

How to make ReplaceAll recognize what to be replaced in a situation like this?

New answer based upon your revised question: rep[f_] := Expand[f] /. Plus[Times[a_, _Symbol], Times[b_, _Symbol]] :> a 2 x + 2 y // rep 2 ...
eldo's user avatar
  • 48.3k
2 votes
Accepted

Why is replacement so slow for long sums?

I believe the code is slow because Integrate will try to evaluate the intermediate expressions before they are fully resolved. You may try using ...
Domen's user avatar
  • 18.9k
2 votes

How to make ReplaceAll recognize what to be replaced in a situation like this?

Another way to do this is as follows: rep = # /. s_Symbol /; Attributes[s] === {} -> 1 &; rep@(2 x + 2 y) (*4*) rep@Exp[I Pi (2 a + 2 b + 5)] (*-1*)
E. Chan-López's user avatar
1 vote

How to make ReplaceAll recognize what to be replaced in a situation like this?

ReplaceAll simply replaces pattern, not the value. And you have no x+y pattern in that expression. Try ...
Theoristos's user avatar
1 vote
Accepted

ReplaceAll that works inside Rational?

...
azerbajdzan's user avatar
  • 9,868

Only top scored, non community-wiki answers of a minimum length are eligible