gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
difequ.f
Go to the documentation of this file.
1  subroutine difequ ( mode, xx, v )
2 
3 c*********************************************************************72
4 c
5 cc DIFEQU returns information about a differential equation.
6 c
7 c from * a practical guide to splines * by c. de boor
8 calls ppvalu(interv)
9 c to be called by c o l l o c , p u t i t
10 c information about the differential equation is dispensed from here
11 c
12 c****** i n p u t ******
13 c mode an integer indicating the task to be performed.
14 c = 1 initialization
15 c = 2 evaluate de at xx
16 c = 3 specify the next side condition
17 c = 4 analyze the approximation
18 c xx a point at which information is wanted
19 c
20 c****** o u t p u t ******
21 c v depends on the mode . see comments below
22 c
23  implicit none
24 
25  integer mode, i,iside,itermx,k,kmax,kpm,l,m,ncoef,npiece
26  parameter(npiece=100, kmax=20, ncoef=npiece*kmax)
27  double precision v(kmax),xx,
28  & break,coef,eps,ep1,ep2,error,factor,ppvalu,rho,solutn
29  & ,s2ovep,un,x,xside
30  common /approx/ break(npiece),coef(ncoef),l,kpm
31  common /side/ m,iside,xside(10)
32  common /other/ itermx,k,rho(kmax-1)
33  save eps,factor,s2ovep
34 c
35 c this sample of difequ is for the example in chapter xv. it is a
36 c nonlinear second order two point boundary value problem.
37 c
38  go to (10,20,30,40),mode
39 c initialize everything
40 c i.e. set the order m of the dif.equ., the nondecreasing sequence
41 c xside(i),i=1,...,m, of points at which side cond.s are given and
42 c anything else necessary.
43  10 m = 2
44  xside(1) = 0.0d+00
45  xside(2) = 1.0d+00
46 c *** print out heading
47  print 499
48  499 format(' carrier,s nonlinear perturb. problem')
49  eps = 0.5d-02
50  print 610, eps
51  610 format(' eps ',e20.10)
52 c *** set constants used in formula for solution below.
53  factor = (dsqrt(2.0d+00) + dsqrt(3.0d+00))**2
54  s2ovep = dsqrt(2.0d+00/eps)
55 c *** initial guess for newton iteration. un(x) = x*x - 1.
56  l = 1
57  break(1) = 0.0d+00
58  do 16 i=1,kpm
59  16 coef(i) = 0.0d+00
60  coef(1) = -1.0d+00
61  coef(3) = 2.0d+00
62  itermx = 10
63  return
64 c
65 c provide value of left side coeff.s and right side at xx .
66 c specifically, at xx the dif.equ. reads
67 c v(m+1)d**m + v(m)d**(m-1) + ... + v(1)d**0 = v(m+2)
68 c in terms of the quantities v(i),i=1,...,m+2, to be computed here.
69  20 continue
70  v(3) = eps
71  v(2) = 0.0d+00
72  un = ppvalu(break,coef,l,kpm,xx,0)
73  v(1) = 2.0d+00*un
74  v(4) = un**2 + 1.0d+00
75  return
76 c
77 c provide the m side conditions. these conditions are of the form
78 c v(m+1)d**m + v(m)d**(m-1) + ... + v(1)d**0 = v(m+2)
79 c in terms of the quantities v(i),i=1,...,m+2, to be specified here.
80 c note that v(m+1) = 0 for customary side conditions.
81  30 v(m+1) = 0.0d+00
82  go to (31,32,39),iside
83  31 v(2) = 1.0d+00
84  v(1) = 0.0d+00
85  v(4) = 0.0d+00
86  go to 38
87  32 v(2) = 0.0d+00
88  v(1) = 1.0d+00
89  v(4) = 0.0d+00
90  38 iside = iside + 1
91  39 return
92 c
93 c calculate the error near the boundary layer at 1.
94  40 continue
95  print 640
96  640 format(' x, g(x) and g(x)-f(x) at selected points')
97  x = .75
98  do 41 i=1,9
99  ep1 = exp(s2ovep*(1.0d+00-x))*factor
100  ep2 = exp(s2ovep*(1.0d+00+x))*factor
101  solutn = 12.0d+00/(1.0d+00+ep1)**2*ep1
102  & + 12.0d+00/(1.0d+00+ep2)**2*ep2 - 1.0d+00
103  error = solutn - ppvalu(break,coef,l,kpm,x,0)
104  print 641,x,solutn,error
105  641 format(3e20.10)
106  41 x = x + 0.03125d+00
107  return
108  end
float * x
double precision function ppvalu(break, coef, l, k, x, jderiv)
Definition: ppvalu.f:2
subroutine difequ(mode, xx, v)
Definition: difequ.f:2
gtkIOStream: /tmp/gtkiostream/src/deBoor/difequ.f Source File
GTK+ IOStream  Beta