~ubuntu-branches/ubuntu/karmic/python-scipy/karmic

« back to all changes in this revision

Viewing changes to Lib/special/cdflib/stvaln.f

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T. Chen (new)
  • Date: 2005-03-16 02:15:29 UTC
  • Revision ID: james.westby@ubuntu.com-20050316021529-xrjlowsejs0cijig
Tags: upstream-0.3.2
ImportĀ upstreamĀ versionĀ 0.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
      DOUBLE PRECISION FUNCTION stvaln(p)
 
2
C
 
3
C**********************************************************************
 
4
C
 
5
C     DOUBLE PRECISION FUNCTION STVALN(P)
 
6
C                    STarting VALue for Neton-Raphon
 
7
C                calculation of Normal distribution Inverse
 
8
C
 
9
C
 
10
C                              Function
 
11
C
 
12
C
 
13
C     Returns X  such that CUMNOR(X)  =   P,  i.e., the  integral from -
 
14
C     infinity to X of (1/SQRT(2*PI)) EXP(-U*U/2) dU is P
 
15
C
 
16
C
 
17
C                              Arguments
 
18
C
 
19
C
 
20
C     P --> The probability whose normal deviate is sought.
 
21
C                    P is DOUBLE PRECISION
 
22
C
 
23
C
 
24
C                              Method
 
25
C
 
26
C
 
27
C     The  rational   function   on  page 95    of Kennedy  and  Gentle,
 
28
C     Statistical Computing, Marcel Dekker, NY , 1980.
 
29
C
 
30
C**********************************************************************
 
31
C
 
32
C     .. Scalar Arguments ..
 
33
      DOUBLE PRECISION p
 
34
C     ..
 
35
C     .. Local Scalars ..
 
36
      DOUBLE PRECISION sign,y,z
 
37
C     ..
 
38
C     .. Local Arrays ..
 
39
      DOUBLE PRECISION xden(5),xnum(5)
 
40
C     ..
 
41
C     .. External Functions ..
 
42
      DOUBLE PRECISION devlpl
 
43
      EXTERNAL devlpl
 
44
C     ..
 
45
C     .. Intrinsic Functions ..
 
46
      INTRINSIC dble,log,sqrt
 
47
C     ..
 
48
C     .. Data statements ..
 
49
      DATA xnum/-0.322232431088D0,-1.000000000000D0,-0.342242088547D0,
 
50
     +     -0.204231210245D-1,-0.453642210148D-4/
 
51
      DATA xden/0.993484626060D-1,0.588581570495D0,0.531103462366D0,
 
52
     +     0.103537752850D0,0.38560700634D-2/
 
53
C     ..
 
54
C     .. Executable Statements ..
 
55
      IF (.NOT. (p.LE.0.5D0)) GO TO 10
 
56
      sign = -1.0D0
 
57
      z = p
 
58
      GO TO 20
 
59
 
 
60
   10 sign = 1.0D0
 
61
      z = 1.0D0 - p
 
62
   20 y = sqrt(-2.0D0*log(z))
 
63
      stvaln = y + devlpl(xnum,5,y)/devlpl(xden,5,y)
 
64
      stvaln = sign*stvaln
 
65
      RETURN
 
66
 
 
67
      END