73 double y = x - root[j];
75 dif3[i] = y * dif3[i] + 3.0 * dif2[i];
76 dif2[i] = y * dif2[i] + 2.0 * dif1[i];
77 dif1[i] = y * dif1[i];
145 double alpha,
double beta,
double *dif1,
double *dif2,
146 double *dif3,
double *root)
148 assert (n0 == 0 || n0 == 1);
149 assert (n1 == 0 || n1 == 1);
158 double ab = alpha + beta;
159 double ad = beta - alpha;
160 double ap = beta * alpha;
162 dif1[0] = (ad / (ab + 2.0) + 1.0) / 2.0;
170 double z = ab + 2 * z1;
172 dif1[i] = (ab * ad / z / (z + 2.0) + 1.0) / 2.0;
175 dif2[i] = (ab + ap + z1) / z / z / (z + 1.0);
179 double y = z1 * (ab + z1);
181 dif2[i] = y / z / (z - 1.0);
206 double xp = (dif1[j] -
x) * xn - dif2[j] * xd;
207 double xp1 = (dif1[j] -
x) * xn1 - dif2[j] * xd1 - xn;
221 zc = zc - z / (x - root[j-1]);
230 if (++k > 100 ||
xisnan (z))
233 if (
std::abs (z) <= 100 * std::numeric_limits<double>::epsilon ())
238 x = x + sqrt (std::numeric_limits<double>::epsilon ());
254 dif (nt, root, dif1, dif2, dif3);
308 double *dif2,
double *dif3,
double *root,
double *vect)
310 assert (n0 == 0 || n0 == 1);
311 assert (n1 == 0 || n1 == 1);
317 assert (
id == 1 ||
id == 2 ||
id == 3);
320 assert (i >= 0 && i < nt);
332 vect[i] = dif2[i] / dif1[i] / 2.0;
334 vect[i] = dif3[i] / dif1[i] / 3.0;
338 double y = root[i] - root[j];
340 vect[j] = dif1[i] / dif1[j] / y;
343 vect[j] = vect[j] * (dif2[i] / dif1[i] - 2.0 / y);
355 double ax = x * (1.0 -
x);
361 ax = ax / (1.0 -
x) / (1.0 - x);
363 vect[j] = ax / (dif1[j] * dif1[j]);
369 vect[j] = vect[j] / y;
378 (*current_liboctave_error_handler) (
"fatal CollocWt error: %s", msg);
386 error (
"left bound greater than right bound");
400 error (
"right bound less than left bound");
414 double wid =
rb -
lb;
417 error (
"width less than or equal to zero");
425 error (
"total number of collocation points less than zero");
454 error (
"jcobi: newton iteration failed");
465 dfopr (
n,
inc_left, inc_right, i,
id, pdif1, pdif2, pdif3, pr, pvect);
476 dfopr (
n,
inc_left, inc_right, i,
id, pdif1, pdif2, pdif3, pr, pvect);
486 dfopr (
n,
inc_left, inc_right,
id,
id, pdif1, pdif2, pdif3, pr, pq);
495 os <<
"left boundary is included\n";
497 os <<
"left boundary is not included\n";
500 os <<
"right boundary is included\n";
502 os <<
"right boundary is not included\n";