Error function in Gams (general algebraic modeling system)

265 Views Asked by At

I have a problem, while solving some equations in Gams because there is another expression of so called error function then in my problem..

Error function which I am working with is: $$erf(x)=\frac{2}{\sqrt{\pi}}\int_{0}^{x}e^{-t^{2}}dt$$

And in Gams we have similar function: $$errorf(x)=\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{x}e^{-\frac{1}{2}t^{2}}dt$$

If I want to express one function by the other one I have an expression:

$$errorf(x)=\frac{1+erf(\frac{x}{\sqrt{2 }})}{2}$$

$$erf(\frac{x}{\sqrt{2}})=2\cdot errorf(x)-1$$ Well I need to express $$erf(x)=..??$$

Can anyone give me some advices please how to solve this problem?

I tried the aproximation of function $$erf(x)=tanh(\sqrt\pi \cdot log(2)\cdot x))$$

which is great aproximation but I would like to solve this in another way.

The other problem comes in because I need to use this error function in transcendental equation $$x\cdot e^{x^{2}}\;\cdot erf(x )=konst$$ and in equation: $$T_{l}=T_{0}+({T_{m}-T_{0}})\frac{erf\left [ \frac{y}{2(\alpha _{l}t)^{\frac{1}{2}}} \right ]}{erf(x )}$$

1

There are 1 best solutions below

0
On BEST ANSWER

What Gams is calling errorf is just the cumulative distribution function of the standard normal distribution, often denoted $\Phi(x)$. As you indicated, one can write

$$\text{errorf(x)} = \Phi(x) = \frac{1+\text{erf}(\frac{x}{\sqrt{2}})}{2}$$

You can solve for $\text{erf}(x)$ as a function of $\Phi(x)$ from this expression by defining $y=\frac{x}{\sqrt{2}}$. Then

$$\text{erf}(y) = 2\Phi(y\sqrt{2})-1 = 2\cdot \text{errorf}(y\sqrt{2})-1$$