<br><font size=2 face="sans-serif">Hi,</font>
<br>
<br><font size=2 face="sans-serif">I need to draw the density function
of the Vasicek distribution: This density function has the following structure:</font>
<br>
<br><font size=2 face="sans-serif">a * Exp[ (b * norminv(x) + c)^2 + d
* norminv(x)^2 &nbsp;] where a,b,c and d are constants.</font>
<br>
<br><font size=2 face="sans-serif">Since there exist an Exp-operator in
pstricks, the only thing I need is a norminv operator (an approximation
of the inverse of the standard normal distribution). </font>
<br><font size=2 face="sans-serif">Is there someone who can help me to
build this in pstricks?</font>
<br>
<br><font size=2 face="sans-serif">On</font>
<br><font size=2 face="sans-serif">http://home.online.no/~pjacklam/notes/invnorm/index.html#The_algorithm</font>
<br><font size=2 face="sans-serif">you can find the algorithm in several
programming languages.</font>
<br>
<br><font size=2 face="sans-serif">Here a perl implementation:</font>
<br>
<br><font size=2 face="sans-serif">sub ltqnorm ($) {</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; #</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # Lower tail quantile
for standard normal distribution function.</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; #</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # This function returns
an approximation of the inverse cumulative</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # standard normal distribution
function. &nbsp;I.e., given P, it returns</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # an approximation to
the X satisfying P = Pr{Z &lt;= X} where Z is a</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # random variable from
the standard normal distribution.</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; #</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # The algorithm uses a
minimax approximation by rational functions</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # and the result has a
relative error whose absolute value is less</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # than 1.15e-9.</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; #</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # Author: &nbsp; &nbsp;
&nbsp;Peter John Acklam</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # Time-stamp: &nbsp;2000-07-19
18:26:14</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # E-mail: &nbsp; &nbsp;
&nbsp;pjacklam@online.no</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # WWW URL: &nbsp; &nbsp;
http://home.online.no/~pjacklam</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; my $p = shift;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; die &quot;input argument
must be in (0,1)\n&quot; unless 0 &lt; $p &amp;&amp; $p &lt; 1;</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # Coefficients in rational
approximations.</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; my @a = (-3.969683028665376e+01,
&nbsp;2.209460984245205e+02,</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;-2.759285104469687e+02, &nbsp;1.383577518672690e+02,</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;-3.066479806614716e+01, &nbsp;2.506628277459239e+00);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; my @b = (-5.447609879822406e+01,
&nbsp;1.615858368580409e+02,</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;-1.556989798598866e+02, &nbsp;6.680131188771972e+01,</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;-1.328068155288572e+01 );</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; my @c = (-7.784894002430293e-03,
-3.223964580411365e-01,</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;-2.400758277161838e+00, -2.549732539343734e+00,</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; 4.374664141464968e+00, &nbsp;2.938163982698783e+00);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; my @d = ( 7.784695709041462e-03,
&nbsp;3.224671290700398e-01,</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; 2.445134137142996e+00, &nbsp;3.754408661907416e+00);</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # Define break-points.</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; my $plow &nbsp;= 0.02425;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; my $phigh = 1 - $plow;</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # Rational approximation
for lower region:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; if ( $p &lt; $plow ) {</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp;my $q &nbsp;=
sqrt(-2*log($p));</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp;return ((((($c[0]*$q+$c[1])*$q+$c[2])*$q+$c[3])*$q+$c[4])*$q+$c[5])
/</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;(((($d[0]*$q+$d[1])*$q+$d[2])*$q+$d[3])*$q+1);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; }</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # Rational approximation
for upper region:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; if ( $phigh &lt; $p )
{</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp;my $q &nbsp;=
sqrt(-2*log(1-$p));</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp;return -((((($c[0]*$q+$c[1])*$q+$c[2])*$q+$c[3])*$q+$c[4])*$q+$c[5])
/</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; (((($d[0]*$q+$d[1])*$q+$d[2])*$q+$d[3])*$q+1);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; }</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; # Rational approximation
for central region:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; my $q = $p - 0.5;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; my $r = $q*$q;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; return ((((($a[0]*$r+$a[1])*$r+$a[2])*$r+$a[3])*$r+$a[4])*$r+$a[5])*$q
/</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((((($b[0]*$r+$b[1])*$r+$b[2])*$r+$b[3])*$r+$b[4])*$r+1);</font>
<br><font size=2 face="sans-serif">}</font>
<br>
<br><font size=2 face="sans-serif">Kind regards,<br>
Matt</font>
<br>
<span style="font-family:'Microsoft Sans Serif',sans-serif; font-size:8pt; color:#000000">-- </span><br>
<br>
<span style="font-family:'Microsoft Sans Serif',sans-serif; font-size:8pt; color:#000000">Informationen (einschließlich Pflichtangaben) zu einzelnen, innerhalb der EU tätigen Gesellschaften und Zweigniederlassungen des Konzerns Deutsche Bank finden Sie unter </span><span style="font-family:'Microsoft Sans Serif',sans-serif; font-size:8pt; color:#0000ff"><u>http://www.deutsche-bank.de/de/content/pflichtangaben.htm</u></span><span style="font-family:'Microsoft Sans Serif',sans-serif; font-size:8pt; color:#000000">. Diese E-Mail enthält vertrauliche und/ oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.</span><br>
<br>
<span style="font-family:'Microsoft Sans Serif',sans-serif; font-size:8pt; color:#000000">Please refer to </span><span style="font-family:'Microsoft Sans Serif',sans-serif; font-size:8pt; color:#0000ff"><u>http://www.db.com/en/content/eu_disclosures.htm</u></span><span style="font-family:'Microsoft Sans Serif',sans-serif; font-size:8pt; color:#000000"> for information (including mandatory corporate particulars) on selected Deutsche Bank branches and group companies registered or incorporated in the European Union. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.</span>