55 b = -p[1] / p[0] / 2.;
93 for(k = 1; k < 4; k++)
101 b = 0.5 * (x * (t / 1.5 - p[2]) + p[3]);
102 t = (t - p[2]) / 3.0;
108 d = std::pow((std::sqrt(d) + std::fabs(b)), 1.0 / 3.0);
122 d = std::sqrt(0.75) * (b - c);
128 if((b > 0. && x <= 0.) || (b < 0. && x > 0.))
147 d = std::atan(1.0) / 1.5;
151 d = std::atan(std::sqrt(-d) / std::fabs(b)) / 3.0;
156 b = std::sqrt(t) * 2.0;
160 b = -2.0 * std::sqrt(t);
164 t = -std::sqrt(0.75) * std::sin(d) * b - 0.5 * c;
169 if(std::fabs(c) > std::fabs(t))
178 if(std::fabs(d) > std::fabs(t))
189 for(k = 1; k < 4; k++)
210 for(k = 1; k < 5; k++)
220 b = p[3] + b * (c - p[2]);
222 c = p[4] + e * (e * a - p[3]);
226 p[2] = (p[1] * p[1] - c) * 0.25;
227 p[3] = b * b / (-64.0);
233 for(k = 1; k < 4; k++)
235 if(r[2][k] == 0. && r[1][k] > 0)
240 if(a >= 0. && b >= 0.)
244 else if(a <= 0. && b <= 0.)
250 p[1] = -std::sqrt(d);
253 b = 0.5 * (a + b / p[1]);
258 for(i = 1; i < 3; i++)
260 for(j = 1; j < 3; j++)
262 r[j][i + 2] = r[j][i];
269 for(i = 1; i < 5; i++)
271 r[1][i] = r[1][i] - e;
293 b = std::sqrt(p[2]) * 2.0 + p[1];
297 b = -std::sqrt(p[2]) * 2.0 + p[1];
306 for(k = 1; k < 5; k++)
318 for(k = 1; k < 3; k++)
320 for(j = 1; j < 3; j++)
322 r[j][k + 2] = r[j][k];
329 for(k = 1; k < 5; k++)
331 r[1][k] = r[1][k] - e;
348 for(k = 0; k < 4; k++)
355 for(k = 1; k < 5; k++)
369 p[2] = a1 * a3 - 4 *
a0;
370 p[3] = 4 * a2 *
a0 - a1 * a1 - a3 * a3 *
a0;
374 for(k = 1; k < 4; k++)
386 for(k = 1; k < 4; k++)
394 R2 = 0.25 * a3 * a3 - a2 + y1;
395 b = 0.25 * (4 * a3 * a2 - 8 * a1 - a3 * a3 * a3);
396 c = 0.75 * a3 * a3 - 2 * a2;
398 d = 4 * y1 * y1 - 16 *
a0;
409 r[1][1] = -0.25 * a3 + 0.5 * R + 0.5 *
D;
410 r[1][2] = -0.25 * a3 + 0.5 * R - 0.5 *
D;
417 r[1][1] = -0.25 * a3 + 0.5 * R;
418 r[1][2] = -0.25 * a3 + 0.5 * R;
425 r[1][3] = -0.25 * a3 - 0.5 * R + 0.5 * E;
426 r[1][4] = -0.25 * a3 - 0.5 * R - 0.5 * E;
433 r[1][3] = -0.25 * a3 - 0.5 * R;
434 r[1][4] = -0.25 * a3 - 0.5 * R;
445 r[1][1] = -0.25 * a3 + 0.5 * real(CD);
446 r[1][2] = -0.25 * a3 - 0.5 * real(CD);
447 r[2][1] = 0.5 * R + 0.5 * imag(CD);
448 r[2][2] = 0.5 * R - 0.5 * imag(CD);
452 r[1][3] = -0.25 * a3 + 0.5 * real(CE);
453 r[1][4] = -0.25 * a3 - 0.5 * real(CE);
454 r[2][3] = -0.5 * R + 0.5 * imag(CE);
455 r[2][4] = -0.5 * R - 0.5 * imag(CE);
461 D2 = c + std::sqrt(d);
462 E2 = c - std::sqrt(d);
467 r[1][1] = -0.25 * a3 + 0.5 * R + 0.5 *
D;
468 r[1][2] = -0.25 * a3 + 0.5 * R - 0.5 *
D;
475 r[1][1] = -0.25 * a3 + 0.5 * R;
476 r[1][2] = -0.25 * a3 + 0.5 * R;
483 r[1][3] = -0.25 * a3 - 0.5 * R + 0.5 * E;
484 r[1][4] = -0.25 * a3 - 0.5 * R - 0.5 * E;
491 r[1][3] = -0.25 * a3 - 0.5 * R;
492 r[1][4] = -0.25 * a3 - 0.5 * R;
503 r[1][1] = -0.25 * a3 + 0.5 * real(CD);
504 r[1][2] = -0.25 * a3 - 0.5 * real(CD);
505 r[2][1] = 0.5 * R + 0.5 * imag(CD);
506 r[2][2] = 0.5 * R - 0.5 * imag(CD);
511 r[1][3] = -0.25 * a3 + 0.5 * real(CE);
512 r[1][4] = -0.25 * a3 - 0.5 * real(CE);
513 r[2][3] = -0.5 * R + 0.5 * imag(CE);
514 r[2][4] = -0.5 * R - 0.5 * imag(CE);
G4double D(G4double temp)
std::complex< G4double > G4complex
G4int CubicRoots(G4double p[5], G4double r[3][5])
G4int QuarticRoots(G4double p[5], G4double r[3][5])
G4int QuadRoots(G4double p[5], G4double r[3][5])
G4int BiquadRoots(G4double p[5], G4double r[3][5])