# Tag Info

6

As always with a replacement issue, look at the FullForm of your expressions. Here is your expression: expr = (2-2 NormCDF[((-2 e+s^2) t-2 Log[A]+2 Log[K])/(2 s Sqrt[t])]); expr //FullForm Plus[2,Times[-2,NormCDF[Times[Rational[1,2],Power[s,-1],Power[t,Rational[-1,2]],Plus[Times[Plus[Times[-2,e],Power[s,2]],t],Times[-2,Log[A]],Times[2,Log[K]]]]]]] And ...

5

Update. The bug is confirmed by the tech support: [CASE:4352435]. For ReplaceList[{2, 3}, {u_, Except[1 | u_] ..} :> True] Mathematica 8.0.4 prints error: Except::named: Named pattern variables are not allowed in the first argument of Except[1|u_]. and returns {}, but versions 11.3 and 12.0 both return {True} without any messages. What seems to ...

4

It's because Head[f[x] R[r]] is Times. You should rewrite your rule as rule = f_[x__] /; ! MatchQ[f, Times] :> f Now f[x] R[r] /. rule f R I would like to define a rule that suppress any arguments of a function for visibility. I think my shortInputForm function can be of interest for you. It doesn't completely suppress arguments but rather ...

4

A quick idiomatic approach is to do Unevaluated[explicitExpression] /. OwnValues[variableWithSetDelayedDefinition] You can find it in 76917 together with alternatives. See linked topics as well. So here: variables := {a = 2, b = 3}; With[variables, a^b] // Unevaluated // ReplaceAll @ OwnValues @ variables 8

2

As often with replacements in mathematical expressions, the problem is that the FullForm of an expression is not what we might think it is. In this case, consider the second term of VR: VR[]//FullForm (* Times[ Mn, R, Power[Plus[Power[R,2],Power[z,2]],Rational[-1,2]], Power[Plus[Times[-1,rs],Power[Plus[Power[R,2],Power[z,2]],Rational[1,2]]...

2

I think you can create a wrapper that modifies the box generation code so that it never generates brackets: MakeBoxes[SuppressBracketArguments[expr_], StandardForm] ^:= ReplaceAll[ MakeBoxes[expr,StandardForm], RowBox[{h_, "[",___,"]"}]->h ] A couple examples: f[g[x]] //SuppressBracketArguments f[x] g[y] //SuppressBracketArguments f f g

1

Another approach: sub[poly_, x_] := Module[{cc, reduced, d}, cc = Abs@Rest@CoefficientList[poly, x]; reduced = DeleteCases[Except[_Integer]] /@ (cc^(1/Range[Length@cc])); d = GCD @@ reduced; x -> x/d ]; Examples: pol /. sub[pol, x] (* 80 - 8 x - 3 x^2 *) pol2 = 145 + 5556600 x + 28991671632 x^2 + 57456600591796875000000 x^3 + ...

1

This seems to work correctly: subsimp[pol_] := Module[{co, pr, ex, d}, co = Abs[CoefficientList[pol, x][[2 ;; -1]]]; pr = Intersection @@ (FactorInteger[#][[All, 1]] & /@ co); ex = Min /@ Transpose[ Quotient[IntegerExponent[Coefficient[pol, x, #], pr], #] & /@ Range[Length[co]]]; d = Times @@ (Power @@@ Transpose[{pr, ex}]); ...

1

Probably this should work: ClearAll[f] f[expr_ /; Cases[expr, F[x_] -> x, ∞, Heads -> True] == -Cases[expr, G[x_] -> x, ∞, Heads -> True]] := 0 f[expr_] := expr Some testing: f[kk[X]@F[X]@rr[X]@G[-X]] = 0 f[kk[X]@F[X]@rr[X]@G[-Z]] = kk[X][F[X][rr[X][G[-Z]]]] f[F[X]@rr[X]@G[-Z]@zz[w]] = F[X][rr[X][G[-Z][zz[w]]]] f[F[X]@rr[X]@G[-X]@zz[w]] = 0 f[...

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