1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
program odeiv2te;
uses
typ,
ode;
const
n1 = 3;
n2 = 4;
n3 = 6;
n = n2 - n1 + 1;
n4 = n3 + n - 1;
var
ex, nv, i, j, k, h, term: ArbInt;
a, b, d, ae: ArbFloat;
ya: array[n1..n2] of ArbFloat;
yb: array[n3..n4] of ArbFloat;
procedure f(x: ArbFloat; var y, y1: ArbFloat);
var
yloc: array[1..n] of ArbFloat absolute y;
y1loc: array[1..n] of ArbFloat absolute y1;
begin
y1loc[1] := 2 * x * yloc[1] + yloc[2];
y1loc[2] := -yloc[1] + 2 * x * yloc[2];
end; {f}
function phi1(x: ArbFloat): ArbFloat;
begin
phi1 := exp(x * x) * sin(x);
end; {phi1}
function phi2(x: ArbFloat): ArbFloat;
begin
phi2 := exp(x * x) * cos(x);
end; {phi2}
begin
Write(' program results odeiv2te');
case sizeof(ArbFloat) of
4: writeln('(single)');
6: writeln('(real)');
8: writeln('(double)');
end;
Read(nv);
writeln;
writeln(' number of examples: ', nv: 2);
k := numdig;
h := k div 2;
for ex := 1 to nv do
begin
writeln;
writeln(' example number :', ex: 2);
Read(a, b);
for j := n1 to n2 do
Read(ya[j]);
Read(ae);
d := b - a;
writeln;
writeln(' ae =', ae: 10);
writeln;
writeln('b': 3, 'yb1': h + 4, 'yb2': k, 'phi1(x)': k + 3, 'phi2(x)': k - 2, 'term': h + 2);
for i := 1 to 5 do
begin
odeiv2(@f, a, ya[n1], b, yb[n3], n, ae, term);
writeln(b: 5: 2, yb[n3]: k, yb[n3 + 1]: k, phi1(b): k, phi2(b): k, term: 3);
a := b;
for j := n1 to n2 do
ya[j] := yb[n3 - n1 + j];
b := b + d;
end; {i}
writeln(' -------------------------------------------------');
end; {ex}
Close(input);
Close(output);
end.
program odeiv2te;
uses
typ,
ode;
const
n1 = 3;
n2 = 4;
n3 = 6;
n = n2 - n1 + 1;
n4 = n3 + n - 1;
var
ex, nv, i, j, k, h, term: ArbInt;
a, b, d, ae: ArbFloat;
ya: array[n1..n2] of ArbFloat;
yb: array[n3..n4] of ArbFloat;
procedure f(x: ArbFloat; var y, y1: ArbFloat);
var
yloc: array[1..n] of ArbFloat absolute y;
y1loc: array[1..n] of ArbFloat absolute y1;
begin
y1loc[1] := 2 * x * yloc[1] + yloc[2];
y1loc[2] := -yloc[1] + 2 * x * yloc[2];
end; {f}
function phi1(x: ArbFloat): ArbFloat;
begin
phi1 := exp(x * x) * sin(x);
end; {phi1}
function phi2(x: ArbFloat): ArbFloat;
begin
phi2 := exp(x * x) * cos(x);
end; {phi2}
begin
Write(' program results odeiv2te');
case sizeof(ArbFloat) of
4: writeln('(single)');
6: writeln('(real)');
8: writeln('(double)');
end;
Read(nv);
writeln;
writeln(' number of examples: ', nv: 2);
k := numdig;
h := k div 2;
for ex := 1 to nv do
begin
writeln;
writeln(' example number :', ex: 2);
Read(a, b);
for j := n1 to n2 do
Read(ya[j]);
Read(ae);
d := b - a;
writeln;
writeln(' ae =', ae: 10);
writeln;
writeln('b': 3, 'yb1': h + 4, 'yb2': k, 'phi1(x)': k + 3, 'phi2(x)': k - 2, 'term': h + 2);
for i := 1 to 5 do
begin
odeiv2(@f, a, ya[n1], b, yb[n3], n, ae, term);
writeln(b: 5: 2, yb[n3]: k, yb[n3 + 1]: k, phi1(b): k, phi2(b): k, term: 3);
a := b;
for j := n1 to n2 do
ya[j] := yb[n3 - n1 + j];
b := b + d;
end; {i}
writeln(' -------------------------------------------------');
end; {ex}
Close(input);
Close(output);
end.
|