# I don't want Erf[x]

I would much rather have the expression remain as an integral rather than have Mathematica convert it into $\mathrm{erf}$. Is this possible? I always end up differentiating the $\mathrm{erf}$ expression to understand what I am looking at.

Examples:

Erf[x]
Sqrt[π]Erf[x] + Exp[-x^2] - Sqrt[π] Erf[x + a]
Integrate[ChebyshevT[4, x] Exp[-x^2], x]

• See if this can be of some help: mathematica.stackexchange.com/questions/34589/… . You could use it as a starting point. – Peltio Apr 30 '15 at 17:50
• Try HoldForm. – bbgodfrey Apr 30 '15 at 18:03
• Try Inactivate[expr, Integrate]. – Chip Hurst Apr 30 '15 at 18:22
• You could use Format to show Erf's integral def., but keep Erf in the internal code. (Should be more efficient to calculate with.) E.g.: Unprotect[Erf]; Erf /: Format[Erf[z_]] := HoldForm[2/Sqrt[Pi] Integrate[E^-K^2, {K, 0, z}]]; Protect[Erf];. You might do similarly with Erfi and Erfc, although you might want to add parentheses. – Michael E2 Aug 5 '17 at 11:21

Expanding on my comment above,

expr = Inactivate[x Integrate[Exp[-t^2], {t, 0, x}], Integrate];

D[expr, x] You can also convert existing Erf's to Integrate:

ErfToIntegrate[e_] := e /. {
Erf[z_] :> 2/Sqrt[π] Inactive[Integrate][Exp[-t^2], {t, 0, z}]
}

ErfToIntegrate[Sqrt[π]Erf[x] + Exp[-x^2] - Sqrt[π] Erf[x + a]] You could use Format or MakeBoxes to show the integral definition of Erf, but keep Erf in the internal code. This should be more efficient to calculate with. One issue is the constant in front of the integral won't be combined with any coefficients of Erf[].

Unprotect[Erf];
(*Erf/:MakeBoxes[Erf[z_],form_]=.;*) (* will undo next definition *)
Erf /: Format[Erf[z_]] := 2/Sqrt[Pi] HoldForm[Integrate[E^-K^2, {K, 0, z}]];
Protect[Erf];

Erf[z]
Sqrt[π] Erf[x] + Exp[-x^2] - Sqrt[π] Erf[x + a]
Integrate[ChebyshevT[4, x] Exp[-x^2], x] Here, we'll put the fraction in front of the integral sign:

Unprotect[Erf];
Format[Erf[z_]] =.;
Erf /: MakeBoxes[Erf[z_], form_] :=
RowBox[{FractionBox[2, MakeBoxes[Sqrt[Pi], form]],
MakeBoxes[HoldForm[Integrate[E^-K^2, {K, 0, z}]], form]}];
Protect[Erf]; Here's a modification of J.M.'s method in a comment. The advantage J.M. points out is that copied output is interpreted as Erf[z] as input. The difference in the modification is that Erf[z] is parenthesized as in the second way above. At this moment, I prefer having the rewritten Erf[z] displayed this way.

Unprotect[Erf];
Erf /: MakeBoxes[Erf[z_], form_] := MakeBoxes[
Interpretation[
DisplayForm@FractionBox["2", SqrtBox["π"]]*
HoldForm[Integrate[E^-K^2, {K, 0, z}]], Erf[z]],
form
];
Protect[Erf];

• Maybe this can be combined with Chip's approach for versions that have Inactive[]. – J. M. is in limbo Aug 5 '17 at 14:33
• @J.M. Sure, but I'm not seeing a good reason one would want to. I'd rather put Tooltip[..., "Erf"[z]], or highlight the whole expression with Style instead of just the integral sign. (My answer basically treats the problem as an output-formatting issue, as such that's all that comes to mind.) – Michael E2 Aug 5 '17 at 14:43
• You got me thinking... it might even be nicer to use InterpretationBox[], so I modified your code: Unprotect[Erf]; Erf /: MakeBoxes[Erf[z_], StandardForm | TraditionalForm] := With[{xx = ToBoxes[z]}, InterpretationBox[RowBox[{FractionBox["2", SqrtBox["\[Pi]"]], SubsuperscriptBox["\[Integral]", "0", xx], RowBox[{SuperscriptBox["\[ExponentialE]", RowBox[{"-", SuperscriptBox[RowBox[{"K", "[", "1", "]"}], "2"]}]], RowBox[{"\[DifferentialD]", RowBox[{"K", "[", "1", "]"}]}]}]}], Erf[z]]]; Protect[Erf]; If you copy the output of those evaluations, you'll still see Erf[] in the InputForm[]. – J. M. is in limbo Aug 5 '17 at 15:00