279 G4int k, noReRoots = 0;
281 for( k = 0; k < 4; k++ ) { reRoot[k] =
DBL_MAX; }
285 for( k = 1; k < 5; k++) {
p[k] =
p[k]/
p[0]; }
297 p[3] = 4*a2*a0 - a1*a1 - a3*a3*
a0;
301 for( k = 1; k < 4; k++ )
311 for( k = 1; k < 4; k++ )
313 if ( reRoot[k] < y1 ) { y1 = reRoot[k]; }
316 R2 = 0.25*a3*a3 - a2 + y1;
317 b = 0.25*(4*a3*a2 - 8*a1 - a3*a3*a3);
318 c = 0.75*a3*a3 - 2*a2;
331 r[1][1] = -0.25*a3 + 0.5*R + 0.5*
D;
332 r[1][2] = -0.25*a3 + 0.5*R - 0.5*
D;
339 r[1][1] = -0.25*a3 + 0.5*R;
340 r[1][2] = -0.25*a3 + 0.5*R;
347 r[1][3] = -0.25*a3 - 0.5*R + 0.5*E;
348 r[1][4] = -0.25*a3 - 0.5*R - 0.5*E;
355 r[1][3] = -0.25*a3 - 0.5*R;
356 r[1][4] = -0.25*a3 - 0.5*R;
367 r[1][1] = -0.25*a3 + 0.5*real(CD);
368 r[1][2] = -0.25*a3 - 0.5*real(CD);
369 r[2][1] = 0.5*R + 0.5*imag(CD);
370 r[2][2] = 0.5*R - 0.5*imag(CD);
374 r[1][3] = -0.25*a3 + 0.5*real(CE);
375 r[1][4] = -0.25*a3 - 0.5*real(CE);
376 r[2][3] = -0.5*R + 0.5*imag(CE);
377 r[2][4] = -0.5*R - 0.5*imag(CE);
383 D2 = c + std::sqrt(d);
384 E2 = c - std::sqrt(d);
389 r[1][1] = -0.25*a3 + 0.5*R + 0.5*
D;
390 r[1][2] = -0.25*a3 + 0.5*R - 0.5*
D;
397 r[1][1] = -0.25*a3 + 0.5*R;
398 r[1][2] = -0.25*a3 + 0.5*R;
405 r[1][3] = -0.25*a3 - 0.5*R + 0.5*E;
406 r[1][4] = -0.25*a3 - 0.5*R - 0.5*E;
413 r[1][3] = -0.25*a3 - 0.5*R;
414 r[1][4] = -0.25*a3 - 0.5*R;
425 r[1][1] = -0.25*a3 + 0.5*real(CD);
426 r[1][2] = -0.25*a3 - 0.5*real(CD);
427 r[2][1] = 0.5*R + 0.5*imag(CD);
428 r[2][2] = 0.5*R - 0.5*imag(CD);
433 r[1][3] = -0.25*a3 + 0.5*real(CE);
434 r[1][4] = -0.25*a3 - 0.5*real(CE);
435 r[2][3] = -0.5*R + 0.5*imag(CE);
436 r[2][4] = -0.5*R - 0.5*imag(CE);
std::complex< G4double > G4complex
G4int CubicRoots(G4double p[5], G4double r[3][5])