Group Abstract Group Abstract

Message Boards Message Boards

How to solve this difficult nonlinear equation involving InverseErf?

Posted 2 years ago

Hello,
I have a difficulty with solving the following nonlinear equation involving InverseErf[] using FindRoot:

FindRoot[Sqrt[p*r]/InverseErf[(2/Sqrt[π])*Sqrt[p]]==1,{r,1},WorkingPrecision->50,PrecisionGoal->16]

The problem is that when the argument of InverseErf[] approaches unity, the value of the function tends to infinity, but I need to obtain accurate values of "r" just close to this limit of the argument of InverseErf[]. Unfortunately, it seems it is not possible to have the parameter "p" greater than about p=78/100, which is still too small for my needs. The function InverseErf[] is supposed to return correct values for any argument between -1 and 1, but apparently it fails already when p=79/100. Is there any way to overcome this difficulty?
Leslaw.

POSTED BY: Leslaw Bieniasz
4 Replies
Posted 2 years ago

As you note, InverseErf[] is defined between -1 and 1

So what is the value of p at that upper bound in your expression?

Solve[2/Sqrt[Pi]*Sqrt[p]==1,p]
(*p->Pi/4 ~= 0.78539816339744830962*)

So you are not going to get anything bigger than p==Pi/4.

Well what happens if you get really really close to but still slightly less than Pi/4?

p=Pi/4-1/1000000;
FindRoot[Sqrt[p*r]/InverseErf[(2/Sqrt[\[Pi]])*Sqrt[p]]==1,{r,1}]
(*{r->15.7869}*)
p=Pi/4-1/1000000000000;
FindRoot[Sqrt[p*r]/InverseErf[(2/Sqrt[\[Pi]])*Sqrt[p]]==1,{r,1}]
(*{r->32.9328}*)
p=Pi/4-1/1000000000000000000;
FindRoot[Sqrt[p*r]/InverseErf[(2/Sqrt[\[Pi]])*Sqrt[p]]==1,{r,1},WorkingPrecision->64]
(*{r->50.26192019294443484109321375586527076626636935870604968790240329}*)
p=Pi/4-1/1000000000000000000000000;
FindRoot[Sqrt[p*r]/InverseErf[(2/Sqrt[\[Pi]])*Sqrt[p]]==1,{r,1},WorkingPrecision->64]
(*{r->67.66701125584564001396349443097703457649792304560596948761452092}*)
p=Pi/4-1/1000000000000000000000000000000000000000000000000;
FindRoot[Sqrt[p*r]/InverseErf[(2/Sqrt[\[Pi]])*Sqrt[p]]==1,{r,1},WorkingPrecision->64]
(*r->137.5829498581858273409042572545363711576114553405980763677426141*)

and those aren't even REALLY pushing the boundaries of precision yet, where you need to start pulling out all the tricks needed to get accurate answers to much more challenging problems.

POSTED BY: Bill Nelson
Posted 2 years ago
POSTED BY: Bill Nelson
POSTED BY: Gianluca Gorni

Sorry for the nonsensical formulation of my post; indeed the equation can be solved analytically when the InverseErf[] function is used, and I also incorrectly evaluated a limit on p. I was mislead by my initial attempts to use Erf[] instead of InverseErf[], and I would be happy to understand why such an approach causes warnings in FindRoot. My code is:

F[p_]:=If[p==0,1,FindRoot[Erf[Sqrt[p*r]]==((2/Sqrt[π])*Sqrt[p]),{r,2},WorkingPrecision->100,PrecisionGoal->16][[1]][[2]]];
Plot[F[p],{p,0,π/4},PlotRange->{0,30},PlotPoints->5000]

This produces a warning:

FindRoot::precw: The precision of the argument function (Erf[0.000396571 Sqrt[r]]==0.000447482) is less than WorkingPrecision (100.`).

Is there any way to get rid of this warning? I cannot figure out why it occurs and how serious it is supposed to be. The online help suggests it can be ignored, but is this true? I need to be sure that the results have a desired precision. The equation is a special case of a more complicated one, for which the approach with InverseErf[] cannot be used, so that the above code appears to be the only method.

Leslaw

POSTED BY: Leslaw Bieniasz
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard