Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Erf funcion

37 views
Skip to first unread message

Vicent

unread,
Jan 1, 2012, 2:31:50 AM1/1/12
to
Hello.

I have an expression that depends on the Cumulative Distribution
Function (CDF) of a Normal Variable with mean = 0 and standard
deviation = 1.

When I perform operations and/or derivatives with/for that function
with Mathematica, I get expressions involving Erf function, as the CDF
function of a Normal distributed variable and Erf (error function) are
closely related. Concretely,

FiX[x] == (1/2)*(1 + Erf[x/Sqrt[2]])

and thus

Erf[x] == 2*FiX[x*Sqrt[2]] - 1

where FiX stands for the previously mentioned CDF, I mean:

X = NormalDistribution[0, 1]
FiX[x_] := CDF[X, x]


Is there a quick way to ask Mathematica not to use Erf but always
let the results as a function of FI[x]??

The expressions I get as a result of my computations are larger than
this short example:

3 (2^(7/2 - 2 (k + t))) Cp ( E^(-d^2 - (36 Cp^2)/lambda^2))
((Erf[(-d + (6 Cp)/lambda)/Sqrt[2]] + Erf[(6 Cp + d lambda)/(Sqrt[2]
lambda)])^k)

where "Cp", "k", "t", "d" and "lambda" are parameters or arguments
that I want to keep as "generic".

So, how can I "translate" expressions such as the last one into "FiX
mode"? Or, better, how can I prevent Mathematica to reduce everything
to "Erf mode"??

I hope my question is clear enough... :)

Thank you very much in advance for your answers.

And have a good new year!


--
vicent
dooid.com/vicent

Bob Hanlon

unread,
Jan 2, 2012, 2:42:33 AM1/2/12
to
FiX[x_] = (1/2)*(1 + Erf[x/Sqrt[2]]);

expr = 3 (2^(7/2 -
2 (k + t))) Cp (E^(-d^2 - (36 Cp^2)/
lambda^2))*((Erf[(-d + (6 Cp)/lambda)/Sqrt[2]] +
Erf[(6 Cp + d lambda)/(Sqrt[2] lambda)])^k);

expr /. Erf[x_] -> 2*HoldForm[FiX[x*Sqrt[x]]] - 1

3*2^(7/2 - 2*(k + t))*Cp*E^(-d^2 - (36*Cp^2)/lambda^2)*
(-2 + 2*
HoldForm[FiX[((-d + (6*Cp)/lambda)*Sqrt[(-d + (6*Cp)/lambda)/Sqrt[2]])/
Sqrt[2]]] +
2*HoldForm[
FiX[((6*Cp + d*lambda)*
Sqrt[(6*Cp + d*lambda)/(Sqrt[2]*lambda)])/(Sqrt[2]*lambda)]])^k

% // ReleaseHold // Simplify

3*2^(7/2 - 2*k - 2*t)*Cp*E^(-d^2 - (36*Cp^2)/lambda^2)*
(Erf[(-d + (6*Cp)/lambda)^(3/2)/(2*2^(1/4))] +
Erf[(Sqrt[d + (6*Cp)/lambda]*(6*Cp + d*lambda))/
(2*2^(1/4)*lambda)])^k

If you want to simplify the argument to FiX

expr /. Erf[x_] -> ToExpression[
"2*HoldForm[FiX[" <>
ToString[Simplify[x*Sqrt[x]], InputForm] <>
"]]-1"]

3*2^(7/2 - 2*(k + t))*Cp*E^(-d^2 - (36*Cp^2)/lambda^2)*
(-2 + 2*HoldForm[FiX[((-d + (6*Cp)/lambda)/Sqrt[2])^(3/2)]] +
2*HoldForm[FiX[((6*Cp + d*lambda)/(Sqrt[2]*lambda))^(3/2)]])^k

% // ReleaseHold // Simplify

3*2^(7/2 - 2*k - 2*t)*Cp*E^(-d^2 - (36*Cp^2)/lambda^2)*
(Erf[(-d + (6*Cp)/lambda)^(3/2)/(2*2^(1/4))] +
Erf[(d + (6*Cp)/lambda)^(3/2)/(2*2^(1/4))])^k

% == %%% // Simplify

True


Bob Hanlon

Szabolcs Horvát

unread,
Jan 2, 2012, 2:46:08 AM1/2/12
to

I'd like to link to the same question asked earlier here:

http://stackoverflow.com/questions/8523505/using-alternative-special-functions-in-simplify-and-expand

There is one (partial?) answer there.

Vicent mentioned there that he would like to get expressions in terms of
FiX, while keeping the definition FiX[x_] := ... I believe this is not
possible (except perhaps through some formatting tricks with Defer/HoldForm)
Szabolcs Horvát
Mma QA site proposal: http://area51.stackexchange.com/proposals/37304

DrMajorBob

unread,
Jan 2, 2012, 2:48:10 AM1/2/12
to
You can eliminate Erf this way:

Clear[FiX]
rule = Erf[x_] :> 2*FiX[x*Sqrt[2]] - 1;
expr = 3 (2^(7/2 - 2 (k + t))) Cp (E^(-d^2 - (36 Cp^2)/lambda^2))
((Erf[(-d + (6 Cp)/lambda)/Sqrt[2]] +
Erf[(6 Cp + d lambda)/(Sqrt[2] lambda)])^k);
expr /. rule // Simplify

3 2^(7/2 - 2 (k + t)) Cp E^(-d^2 - (36 Cp^2)/lambda^2)

3 2^(7/2 - 2 (k + t)) Cp E^(-d^2 - (36 Cp^2)/lambda^2)

but as you can see, for this expression it makes no difference.

Are you also trying to eliminate the exponential function?

Bobby
> vicent
> dooid.com/vicent
>


--
DrMaj...@yahoo.com

Frank Iannarilli

unread,
Jan 2, 2012, 2:47:39 AM1/2/12
to
expr /. Erf[x_]->F[x]
(* Assuming x_ is not a List [vector] *)

DrMajorBob

unread,
Jan 2, 2012, 2:50:12 AM1/2/12
to
Oops yet again. Gotta stop hitting send so fast!

The rule does make a difference:

Clear[FiX]
rule = Erf[x_] :> 2*FiX[x*Sqrt[2]] - 1;
expr = 3 (2^(7/2 -
2 (k + t))) Cp (E^(-d^2 - (36 Cp^2)/
lambda^2)) ((Erf[(-d + (6 Cp)/lambda)/Sqrt[2]] +
Erf[(6 Cp + d lambda)/(Sqrt[2] lambda)])^k)
expr /. rule // Simplify

3 2^(7/2 - 2 (k + t)) Cp E^(-d^2 - (36 Cp^2)/
lambda^2) (Erf[(-d + (6 Cp)/lambda)/Sqrt[2]] +
Erf[(6 Cp + d lambda)/(Sqrt[2] lambda)])^k

3 2^(7/2 - k - 2 t) Cp E^(-d^2 - (36 Cp^2)/
lambda^2) (-1 + FiX[-d + (6 Cp)/lambda] + FiX[d + (6 Cp)/lambda])^k

I'm not sure that's as simple as you'd like, however.

Bobby

On Sun, 01 Jan 2012 18:30:58 -0600, DrMajorBob <btr...@austin.rr.com>
wrote:
0 new messages