Tag Info

New answers tagged

2

Perhaps the closest thing to what you want is to use HoldForm to prevent the sorting behavior of Times due to Orderless: str = "one Test String to see"; HoldForm @@ MakeExpression @ str one Test String to see However it is important to realize that the HoldForm head is still present, only that it is not shown in standard formatted output. Also know ...


2

Ditto what Kuba said about details. Another guess: expr /. Thread[Variables[expr] -> 1] (* 6 *) I guess it works for polynomials. It's not really clear to me what the coefficients of Exp[x] are. (It might be 1 Exp[1 x], etc.) Or (x + y)^2 vs. x^2 + 2 x y + y^2. (This answer gives the sum of the coefficients of the latter.) Another ...


1

It is quite possible that details matter. Without those, we can only guess what could be useful: Cases[expr, x_. y___ :> x, {1}] (*{1} is redundant, just wanted to stress it out *) % // Total {1, 2, 3} 6


1

expr = (a + b)/r 1/Denominator[expr]


1

I think you are looking for Replace: p4 - p5 == r45 i45 /. r45 -> 1 (* p4 - p5 == i45 *) % /. lhs_ == rhs__ -> rhs - lhs == 0 (* i45 + p5 - p4 == 0 *)



Top 50 recent answers are included