Nfunc[x_?NumericQ] :=
E^(-x^2/2)/
Sqrt[2*Pi]*(1/
2 Erf[(x - 0.256048)/Sqrt[2*1.6^2 + 0.231313^2]/Sqrt[2]] -
1/2 Erf[-Infinity/Sqrt[2]])
nume = N[NIntegrate[x*Nfunc[x], {x, -Infinity, Infinity},
Method -> {Automatic, "SymbolicProcessing" -> 0},
PrecisionGoal -> 3, AccuracyGoal -> 3], 4]
den = N[Normal[
Integrate[Nfunc[x], {x, -Infinity, Infinity},
GenerateConditions -> False]], 4]
nume/den
I couldn't get numerator nor denominator. It keeps "executing" for hours. Is there a mistake or isn't mathematica able to perform this calculation?
I used functions with NumericQ for speeding up calculation, but no luck.
EDIT: After restarting mathematica
Nfunc
already has a definition before itsSetDelayed
(:=
) definition. Notice that the variable name is black instead of blue. With a fresh kernel all undefined variable names are blue. Two thoughts: First, we usually don't begin a function name with a capital letter, but that is not the problem here. Second, before defining a function we often execute aClear[ Nfunc ]
orClearAll[ Nfunc ]
to eliminate conflicts like the one shown in the error message. $\endgroup$