<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Weirdness with the inverse Erf function</title>
    <link>http://www.mapleprimes.com/questions/35549-Weirdness-With-The-Inverse-Erf-Function</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Thu, 11 Jun 2026 19:32:57 GMT</lastBuildDate>
    <pubDate>Thu, 11 Jun 2026 19:32:57 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Weirdness with the inverse Erf function</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Weirdness with the inverse Erf function</title>
      <link>http://www.mapleprimes.com/questions/35549-Weirdness-With-The-Inverse-Erf-Function</link>
    </image>
    <item>
      <title>Statistics</title>
      <link>http://www.mapleprimes.com/questions/35549-Weirdness-With-The-Inverse-Erf-Function?ref=Feed:MaplePrimes:Weirdness with the inverse Erf function:Comments#answer44242</link>
      <itunes:summary>&lt;p&gt;Maybe you could use the Statistics package, with high working precision.&lt;/p&gt;
&lt;pre&gt;
&amp;gt; restart:with(Statistics):

&amp;gt; X:=RandomVariable('Normal'(0,1)):

&amp;gt; evalf[50](2*CDF(X,1)-1);
             0.68268949213708589717046509126407584495582593345319
 
&amp;gt; evalf[50](Quantile(X,(%+1)/2));
             0.99999999999999999999999999999999999999999999999997

&amp;gt; evalf[50](Quantile(X,CDF(X,1)));
             0.99999999999999999999999999999999999999999999999996
&lt;/pre&gt;
&lt;p&gt;Did I do that right?&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Maybe you could use the Statistics package, with high working precision.&lt;/p&gt;
&lt;pre&gt;
&amp;gt; restart:with(Statistics):

&amp;gt; X:=RandomVariable('Normal'(0,1)):

&amp;gt; evalf[50](2*CDF(X,1)-1);
             0.68268949213708589717046509126407584495582593345319
 
&amp;gt; evalf[50](Quantile(X,(%+1)/2));
             0.99999999999999999999999999999999999999999999999997

&amp;gt; evalf[50](Quantile(X,CDF(X,1)));
             0.99999999999999999999999999999999999999999999999996
&lt;/pre&gt;
&lt;p&gt;Did I do that right?&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>44242</guid>
      <pubDate>Wed, 10 Mar 2010 05:08:26 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
    <item>
      <title>there is some trap</title>
      <link>http://www.mapleprimes.com/questions/35549-Weirdness-With-The-Inverse-Erf-Function?ref=Feed:MaplePrimes:Weirdness with the inverse Erf function:Comments#answer44243</link>
      <itunes:summary>&lt;p&gt;There is some numerical trap for such extreme tasks&lt;/p&gt;
&lt;p&gt;Note that your formula for the cdfN is only correct at the left wing&lt;/p&gt;
&lt;p&gt;Then (as implicitely said by acer) you need high(er) precision&lt;/p&gt;
&lt;p&gt;And finally - since the curve is extremely flat - you may wish to use all possible&lt;br /&gt;
strength of fsolve (look up the parameters in the help)&lt;/p&gt;
&lt;p&gt;And provide a rough guess for a solution&lt;/p&gt;
&lt;p&gt;I do not have Maple at hand now, but take asymptotics, convert to polynom and&lt;br /&gt;
solve to have a start value.&lt;/p&gt;
&lt;p&gt;Or you can try to solve&lt;/p&gt;
&lt;pre&gt;
 ln( erfc(x/sqrt(2)) ) = ln( y )
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Edited to give the example:&lt;/p&gt;
&lt;pre&gt;
&amp;gt; Digits:=18;
&amp;gt; 
&amp;gt; erfc(x/sqrt(2)); asympt(%,x, 2): convert(%, polynom);
&amp;gt; y=simplify(%) assuming 0 &amp;lt; x;
&amp;gt; solve(%, x);
&amp;gt; simplify(%) assuming 0 &amp;lt; y; 
&amp;gt; eval(%, y= 1e-18); 
&amp;gt; x0:=evalf(%);
&amp;gt; 
&amp;gt; fsolve(erfc(x/sqrt(2))= 1e-18, x=x0);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8.83510978817539579

&amp;gt; eval(erfc(x/sqrt(2)), x=%);
&amp;gt; evalf(%);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .999999999999999835e-18

&amp;gt; erfc(x/sqrt(2))= 1e-20; map(ln, %); fsolve(%, x=0 .. 20);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9.33604484923406004

&amp;gt; eval(erfc(x/sqrt(2)), x=%);
&amp;gt; evalf(%);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .999999999999999887e-20
&lt;/pre&gt;</itunes:summary>
      <description>&lt;p&gt;There is some numerical trap for such extreme tasks&lt;/p&gt;
&lt;p&gt;Note that your formula for the cdfN is only correct at the left wing&lt;/p&gt;
&lt;p&gt;Then (as implicitely said by acer) you need high(er) precision&lt;/p&gt;
&lt;p&gt;And finally - since the curve is extremely flat - you may wish to use all possible&lt;br /&gt;
strength of fsolve (look up the parameters in the help)&lt;/p&gt;
&lt;p&gt;And provide a rough guess for a solution&lt;/p&gt;
&lt;p&gt;I do not have Maple at hand now, but take asymptotics, convert to polynom and&lt;br /&gt;
solve to have a start value.&lt;/p&gt;
&lt;p&gt;Or you can try to solve&lt;/p&gt;
&lt;pre&gt;
 ln( erfc(x/sqrt(2)) ) = ln( y )
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Edited to give the example:&lt;/p&gt;
&lt;pre&gt;
&amp;gt; Digits:=18;
&amp;gt; 
&amp;gt; erfc(x/sqrt(2)); asympt(%,x, 2): convert(%, polynom);
&amp;gt; y=simplify(%) assuming 0 &amp;lt; x;
&amp;gt; solve(%, x);
&amp;gt; simplify(%) assuming 0 &amp;lt; y; 
&amp;gt; eval(%, y= 1e-18); 
&amp;gt; x0:=evalf(%);
&amp;gt; 
&amp;gt; fsolve(erfc(x/sqrt(2))= 1e-18, x=x0);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8.83510978817539579

&amp;gt; eval(erfc(x/sqrt(2)), x=%);
&amp;gt; evalf(%);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .999999999999999835e-18

&amp;gt; erfc(x/sqrt(2))= 1e-20; map(ln, %); fsolve(%, x=0 .. 20);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9.33604484923406004

&amp;gt; eval(erfc(x/sqrt(2)), x=%);
&amp;gt; evalf(%);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .999999999999999887e-20
&lt;/pre&gt;</description>
      <guid>44243</guid>
      <pubDate>Wed, 10 Mar 2010 15:34:00 Z</pubDate>
      <itunes:author>Axel Vogt</itunes:author>
      <author>Axel Vogt</author>
    </item>
    <item>
      <title>inverse erf</title>
      <link>http://www.mapleprimes.com/questions/35549-Weirdness-With-The-Inverse-Erf-Function?ref=Feed:MaplePrimes:Weirdness with the inverse Erf function:Comments#answer44245</link>
      <itunes:summary>&lt;p&gt;This seems to work:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Digits:=200;&lt;/p&gt;
&lt;p&gt;inv_erf := x-&amp;gt;fsolve(erf(y/sqrt(2))=x,y,fulldigits);&lt;/p&gt;
&lt;p&gt;inv_erf(1-10^(-20));&lt;/p&gt;
&lt;p&gt;9.336...&lt;/p&gt;
&lt;p&gt;If you take the square root of 2 out of the above defintion of inv_erf, the results are consistent with what WolframAlpa gives with InverseErf.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;This seems to work:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Digits:=200;&lt;/p&gt;
&lt;p&gt;inv_erf := x-&amp;gt;fsolve(erf(y/sqrt(2))=x,y,fulldigits);&lt;/p&gt;
&lt;p&gt;inv_erf(1-10^(-20));&lt;/p&gt;
&lt;p&gt;9.336...&lt;/p&gt;
&lt;p&gt;If you take the square root of 2 out of the above defintion of inv_erf, the results are consistent with what WolframAlpa gives with InverseErf.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <guid>44245</guid>
      <pubDate>Wed, 10 Mar 2010 20:30:00 Z</pubDate>
      <itunes:author>Alex
 Smith
</itunes:author>
      <author>Alex
 Smith
</author>
    </item>
    <item>
      <title>Need more digits, own solver, numerical analysis</title>
      <link>http://www.mapleprimes.com/questions/35549-Weirdness-With-The-Inverse-Erf-Function?ref=Feed:MaplePrimes:Weirdness with the inverse Erf function:Comments#answer251755</link>
      <itunes:summary>&lt;p&gt;The actual value of inv_erf(1-10^-20)=6.60158062235514256151639163241871..., I believe.&amp;nbsp; I used my own solver, a cubic version of Newton iteration called a Schroeder series, but with an extra step that&amp;nbsp; helps convergence go faster.&amp;nbsp; I did 9 iteration steps.&amp;nbsp; Actually, I used Digits:=5000. This tok less than 5 sec on my high-frequency Apple MacBook Air&lt;/p&gt;

&lt;p&gt;However, it took MAPLE&amp;nbsp; a time of .42 sec to evaluate erf(6.60158062235), comiing very close to the desired value &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * &amp;nbsp; * &amp;nbsp; * &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; erf(x)=1-10^-20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * &amp;nbsp; * &amp;nbsp; *&lt;/p&gt;

&lt;p&gt;&amp;nbsp;The actual value found was&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; erf(x)=0.999999999999999999990000000000648...&amp;nbsp; (from 5,000 dits)&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; *&lt;/p&gt;

&lt;p&gt;and the last digit rounded down to &amp;#39;5&amp;#39; was very close.&amp;nbsp;&amp;nbsp; But even then, with Digits:=5000,.MAPLE was not able to calculate erf(x) correctely for the longer value of x above stated to 32 decimals.&amp;nbsp; It did seem to help when I used fewer decismals, like the 11-decimal argument mentioned.&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
</itunes:summary>
      <description>&lt;p&gt;The actual value of inv_erf(1-10^-20)=6.60158062235514256151639163241871..., I believe.&amp;nbsp; I used my own solver, a cubic version of Newton iteration called a Schroeder series, but with an extra step that&amp;nbsp; helps convergence go faster.&amp;nbsp; I did 9 iteration steps.&amp;nbsp; Actually, I used Digits:=5000. This tok less than 5 sec on my high-frequency Apple MacBook Air&lt;/p&gt;

&lt;p&gt;However, it took MAPLE&amp;nbsp; a time of .42 sec to evaluate erf(6.60158062235), comiing very close to the desired value &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * &amp;nbsp; * &amp;nbsp; * &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; erf(x)=1-10^-20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * &amp;nbsp; * &amp;nbsp; *&lt;/p&gt;

&lt;p&gt;&amp;nbsp;The actual value found was&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; erf(x)=0.999999999999999999990000000000648...&amp;nbsp; (from 5,000 dits)&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; *&lt;/p&gt;

&lt;p&gt;and the last digit rounded down to &amp;#39;5&amp;#39; was very close.&amp;nbsp;&amp;nbsp; But even then, with Digits:=5000,.MAPLE was not able to calculate erf(x) correctely for the longer value of x above stated to 32 decimals.&amp;nbsp; It did seem to help when I used fewer decismals, like the 11-decimal argument mentioned.&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
</description>
      <guid>251755</guid>
      <pubDate>Fri, 10 Aug 2018 05:54:04 Z</pubDate>
      <itunes:author>outrider</itunes:author>
      <author>outrider</author>
    </item>
    <item>
      <title>Much easier way</title>
      <link>http://www.mapleprimes.com/questions/35549-Weirdness-With-The-Inverse-Erf-Function?ref=Feed:MaplePrimes:Weirdness with the inverse Erf function:Comments#answer251757</link>
      <itunes:summary>&lt;p&gt;Representing&amp;nbsp; &lt;strong&gt;(1 - 1e-18) &lt;/strong&gt;requires 18 significant digits, whereas representing &lt;strong&gt;1e-18 &lt;/strong&gt;requires only 1 significant digit. So I find the following way much easier than all the others presented in this thread, requiring no increase in &lt;strong&gt;Digits&lt;/strong&gt; from its default. I apply the following obvious identity:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quantile(Normal(mu,sigma), 1-x) = mu - sigma*Quantile(Normal(0,1), x)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Thus&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quantile(Normal(0,1), 1 - 1e-18) = -Statistics:-Quantile(Normal(0,1), 1e-18);&lt;/strong&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 8.75729034878321&lt;/p&gt;
</itunes:summary>
      <description>&lt;p&gt;Representing&amp;nbsp; &lt;strong&gt;(1 - 1e-18) &lt;/strong&gt;requires 18 significant digits, whereas representing &lt;strong&gt;1e-18 &lt;/strong&gt;requires only 1 significant digit. So I find the following way much easier than all the others presented in this thread, requiring no increase in &lt;strong&gt;Digits&lt;/strong&gt; from its default. I apply the following obvious identity:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quantile(Normal(mu,sigma), 1-x) = mu - sigma*Quantile(Normal(0,1), x)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Thus&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quantile(Normal(0,1), 1 - 1e-18) = -Statistics:-Quantile(Normal(0,1), 1e-18);&lt;/strong&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 8.75729034878321&lt;/p&gt;
</description>
      <guid>251757</guid>
      <pubDate>Fri, 10 Aug 2018 09:41:36 Z</pubDate>
      <itunes:author>Carl Love</itunes:author>
      <author>Carl Love</author>
    </item>
    <item>
      <title>fsolve fails</title>
      <link>http://www.mapleprimes.com/questions/35549-Weirdness-With-The-Inverse-Erf-Function?ref=Feed:MaplePrimes:Weirdness with the inverse Erf function:Comments#answer251774</link>
      <itunes:summary>&lt;p&gt;It&amp;#39;s a pity that &lt;strong&gt;fsolve &lt;/strong&gt;fails for the equation &lt;strong&gt;erf(x) = 1 - 10^(-20)&amp;nbsp; &lt;/strong&gt;when&lt;strong&gt; Digits = 5000.&lt;/strong&gt;&lt;br /&gt;
It works when &lt;strong&gt;Digits = 4000&lt;/strong&gt;.&lt;br /&gt;
The equation can be solved via&lt;/p&gt;

&lt;pre class="prettyprint"&gt;
Digits:=5000:
x1:=RootFinding:-Analytic(erf(x) = 1 - 10^(-20), 6-I/10 .. 7+I/10);
&lt;/pre&gt;

&lt;p&gt;or even directly with the good old Newton&amp;#39;s method:&lt;/p&gt;

&lt;pre class="prettyprint"&gt;
restart;
y1:=1-10^(-20):
Digits:=5100:
a:=6.;h:=1. : N:=0:
K:=evalf(sqrt(Pi)/2):
while  abs(h)&amp;gt;1e-5000 do
h:=(erf(a)-y1)*exp(a^2)*K;
a:=a-h:  N:=N+1;
od:  N; a;
&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;
</itunes:summary>
      <description>&lt;p&gt;It&amp;#39;s a pity that &lt;strong&gt;fsolve &lt;/strong&gt;fails for the equation &lt;strong&gt;erf(x) = 1 - 10^(-20)&amp;nbsp; &lt;/strong&gt;when&lt;strong&gt; Digits = 5000.&lt;/strong&gt;&lt;br /&gt;
It works when &lt;strong&gt;Digits = 4000&lt;/strong&gt;.&lt;br /&gt;
The equation can be solved via&lt;/p&gt;

&lt;pre class="prettyprint"&gt;
Digits:=5000:
x1:=RootFinding:-Analytic(erf(x) = 1 - 10^(-20), 6-I/10 .. 7+I/10);
&lt;/pre&gt;

&lt;p&gt;or even directly with the good old Newton&amp;#39;s method:&lt;/p&gt;

&lt;pre class="prettyprint"&gt;
restart;
y1:=1-10^(-20):
Digits:=5100:
a:=6.;h:=1. : N:=0:
K:=evalf(sqrt(Pi)/2):
while  abs(h)&amp;gt;1e-5000 do
h:=(erf(a)-y1)*exp(a^2)*K;
a:=a-h:  N:=N+1;
od:  N; a;
&lt;/pre&gt;

&lt;p&gt;&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;
</description>
      <guid>251774</guid>
      <pubDate>Sat, 11 Aug 2018 06:37:58 Z</pubDate>
      <itunes:author>vv</itunes:author>
      <author>vv</author>
    </item>
  </channel>
</rss>