00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, 2008, Andrew W. Steiner 00005 00006 This file is part of O2scl. 00007 00008 O2scl is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 3 of the License, or 00011 (at your option) any later version. 00012 00013 O2scl is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with O2scl. If not, see <http://www.gnu.org/licenses/>. 00020 00021 ------------------------------------------------------------------- 00022 */ 00023 #ifndef O2SCL_POLY_H 00024 #define O2SCL_POLY_H 00025 00026 /** \file poly.h 00027 \brief Classes for solving polynomials 00028 00029 \warning 00030 We should be careful about using pow() in functions using 00031 complex<double> since pow(((complex<double>)0.0),3.0) returns 00032 (nan,nan). Instead, we should use pow(((complex<double>)0.0),3) 00033 which takes an integer for the second argument. The sqrt() function, 00034 always succeeds i.e. sqrt(((complex<double>)0.0))=0.0 00035 00036 \warning 00037 One has to be careful about using e.g. pow(a,1.0/3.0) 00038 for complex a since if Re(a)<0 and Im(a)==0 then the function 00039 returns NaN. 00040 */ 00041 00042 #include <iostream> 00043 #include <complex> 00044 #include <gsl/gsl_math.h> 00045 #include <gsl/gsl_complex_math.h> 00046 #include <gsl/gsl_complex.h> 00047 #include <gsl/gsl_poly.h> 00048 #include <o2scl/constants.h> 00049 #include <o2scl/err_hnd.h> 00050 00051 #ifndef DOXYGENP 00052 namespace o2scl { 00053 #endif 00054 00055 /** 00056 \brief Solve a quadratic polynomial with real coefficients and 00057 real roots [abstract base] 00058 */ 00059 class quadratic_real { 00060 public: 00061 00062 virtual ~quadratic_real() {} 00063 00064 /** \brief Solves the polynomial \f$ a_2 x^2 + b_2 x + c_2 = 0 \f$ 00065 giving the two solutions \f$ x=x_1 \f$ and \f$ x=x_2 \f$ . 00066 */ 00067 virtual int solve_r(const double a2, const double b2, const double c2, 00068 double &x1, double &x2)=0; 00069 00070 /// Return a string denoting the type ("quadratic_real") 00071 const char *type() { return "quadratic_real"; } 00072 }; 00073 00074 /** 00075 \brief Solve a quadratic polynomial with real coefficients and 00076 complex roots [abstract base] 00077 */ 00078 class quadratic_real_coeff : public quadratic_real { 00079 00080 public: 00081 00082 virtual ~quadratic_real_coeff() {} 00083 00084 /** \brief Solves the polynomial \f$ a_2 x^2 + b_2 x + c_2 = 0 \f$ 00085 giving the two solutions \f$ x=x_1 \f$ and \f$ x=x_2 \f$ . 00086 */ 00087 virtual int solve_r(const double a2, const double b2, const double c2, 00088 double &x1, double &x2); 00089 00090 /** \brief Solves the polynomial \f$ a_2 x^2 + b_2 x + c_2 = 0 \f$ 00091 giving the two complex solutions \f$ x=x_1 \f$ and \f$ x=x_2 \f$ 00092 */ 00093 virtual int solve_rc(const double a2, const double b2, const double c2, 00094 std::complex<double> &x1, 00095 std::complex<double> &x2)=0; 00096 00097 /// Return a string denoting the type ("quadratic_real_coeff") 00098 const char *type() { return "quadratic_real_coeff"; } 00099 }; 00100 00101 /** 00102 \brief Solve a quadratic polynomial with complex coefficients and 00103 complex roots [abstract base] 00104 */ 00105 class quadratic_complex : public quadratic_real_coeff { 00106 public: 00107 00108 virtual ~quadratic_complex() {} 00109 00110 /** \brief Solves the polynomial \f$ a_2 x^2 + b_2 x + c_2 = 0 \f$ 00111 giving the two solutions \f$ x=x_1 \f$ and \f$ x=x_2 \f$ . 00112 */ 00113 virtual int solve_r(const double a2, const double b2, const double c2, 00114 double &x1, double &x2); 00115 00116 /** \brief Solves the polynomial \f$ a_2 x^2 + b_2 x + c_2 = 0 \f$ 00117 giving the two complex solutions \f$ x=x_1 \f$ and \f$ x=x_2 \f$ 00118 */ 00119 virtual int solve_rc(const double a2, const double b2, const double c2, 00120 std::complex<double> &x1, std::complex<double> &x2); 00121 00122 /** \brief Solves the complex polynomial \f$ a_2 x^2 + b_2 x + c_2 = 0 \f$ 00123 giving the two complex solutions \f$ x=x_1 \f$ and \f$ x=x_2 \f$ 00124 */ 00125 virtual int solve_c(const std::complex<double> a2, 00126 const std::complex<double> b2, 00127 const std::complex<double> c2, 00128 std::complex<double> &x1, 00129 std::complex<double> &x2)=0; 00130 00131 /// Return a string denoting the type ("quadratic_complex") 00132 const char *type() { return "quadratic_complex"; } 00133 }; 00134 00135 /** 00136 \brief Solve a cubic polynomial with real coefficients and real roots 00137 [abstract base] 00138 */ 00139 class cubic_real { 00140 public: 00141 00142 virtual ~cubic_real() {} 00143 00144 /** \brief Solves the polynomial 00145 \f$ a_3 x^3 + b_3 x^2 + c_3 x + d_3= 0 \f$ giving the three 00146 solutions \f$ x=x_1 \f$ , \f$ x=x_2 \f$ , and \f$ x=x_3 \f$ . 00147 */ 00148 virtual int solve_r(const double a3, const double b3, const double c3, 00149 const double d3, double &x1, double &x2, 00150 double &x3)=0; 00151 00152 /// Return a string denoting the type ("cubic_real") 00153 const char *type() { return "cubic_real"; } 00154 }; 00155 00156 /** 00157 \brief Solve a cubic polynomial with real coefficients and 00158 complex roots [abstract base] 00159 */ 00160 class cubic_real_coeff : public cubic_real { 00161 00162 public: 00163 00164 virtual ~cubic_real_coeff() {} 00165 00166 /** \brief Solves the polynomial 00167 \f$ a_3 x^3 + b_3 x^2 + c_3 x + d_3= 0 \f$ giving the three 00168 solutions \f$ x=x_1 \f$ , \f$ x=x_2 \f$ , and \f$ x=x_3 \f$ . 00169 */ 00170 virtual int solve_r(const double a3, const double b3, const double c3, 00171 const double d3, double &x1, double &x2, double &x3); 00172 00173 /** \brief Solves the polynomial 00174 \f$ a_3 x^3 + b_3 x^2 + c_3 x + d_3= 0 \f$ 00175 giving the real solution \f$ x=x_1 \f$ and two complex solutions 00176 \f$ x=x_1 \f$ , \f$ x=x_2 \f$ , and \f$ x=x_3 \f$ . 00177 */ 00178 virtual int solve_rc(const double a3, const double b3, const double c3, 00179 const double d3, double &x1, std::complex<double> &x2, 00180 std::complex<double> &x3)=0; 00181 00182 /// Return a string denoting the type ("cubic_real_coeff") 00183 const char *type() { return "cubic_real_coeff"; } 00184 }; 00185 00186 /** 00187 \brief Solve a cubic polynomial with complex coefficients and 00188 complex roots [abstract base] 00189 */ 00190 class cubic_complex : public cubic_real_coeff { 00191 00192 public: 00193 00194 virtual ~cubic_complex() {} 00195 00196 /** \brief Solves the polynomial 00197 \f$ a_3 x^3 + b_3 x^2 + c_3 x + d_3= 0 \f$ giving the three 00198 solutions \f$ x=x_1 \f$ , \f$ x=x_2 \f$ , and \f$ x=x_3 \f$ . 00199 */ 00200 virtual int solve_r(const double a3, const double b3, const double c3, 00201 const double d3, double &x1, double &x2, double &x3); 00202 00203 /** \brief Solves the polynomial 00204 \f$ a_3 x^3 + b_3 x^2 + c_3 x + d_3= 0 \f$ giving the real 00205 solution \f$ x=x_1 \f$ and two complex solutions 00206 \f$ x=x_1 \f$ , \f$ x=x_2 \f$ , and \f$ x=x_3 \f$ . 00207 */ 00208 virtual int solve_rc(const double a3, const double b3, const double c3, 00209 const double d3, double &x1, std::complex<double> &x2, 00210 std::complex<double> &x3); 00211 00212 /** \brief Solves the complex polynomial 00213 \f$ a_3 x^3 + b_3 x^2 + c_3 x + d_3= 0 \f$ 00214 giving the three complex solutions \f$ x=x_1 \f$ , \f$ x=x_2 \f$ , and 00215 \f$ x=x_3 \f$ . 00216 */ 00217 virtual int solve_c(const std::complex<double> a3, 00218 const std::complex<double> b3, 00219 const std::complex<double> c3, 00220 const std::complex<double> d3, 00221 std::complex<double> &x1, std::complex<double> &x2, 00222 std::complex<double> &x3)=0; 00223 00224 /// Return a string denoting the type ("cubic_complex") 00225 const char *type() { return "cubic_complex"; } 00226 }; 00227 00228 /** 00229 \brief Solve a quartic polynomial with real coefficients and 00230 real roots [abstract base] 00231 */ 00232 class quartic_real { 00233 00234 public: 00235 00236 virtual ~quartic_real() {} 00237 00238 /** \brief Solves the polynomial 00239 \f$ a_4 x^4 + b_4 x^3 + c_4 x^2 + d_4 x + e_4 = 0 \f$ 00240 giving the four solutions \f$ x=x_1 \f$ , \f$ x=x_2 \f$ , 00241 \f$ x=x_3 \f$ , and \f$ x=x_4 \f$ . 00242 */ 00243 virtual int solve_r(const double a4, const double b4, const double c4, 00244 const double d4, const double e4, 00245 double &x1, double &x2, 00246 double &x3, double &x4)=0; 00247 00248 /// Return a string denoting the type ("quartic_real") 00249 const char *type() { return "quartic_real"; } 00250 }; 00251 00252 /** 00253 \brief Solve a quartic polynomial with real coefficients and 00254 complex roots [abstract base] 00255 */ 00256 class quartic_real_coeff : public quartic_real { 00257 00258 public: 00259 00260 virtual ~quartic_real_coeff() {} 00261 00262 /** \brief Solves the polynomial 00263 \f$ a_4 x^4 + b_4 x^3 + c_4 x^2 + d_4 x + e_4 = 0 \f$ 00264 giving the four solutions \f$ x=x_1 \f$ , \f$ x=x_2 \f$ , 00265 \f$ x=x_3 \f$ , and \f$ x=x_4 \f$ . 00266 */ 00267 virtual int solve_r(const double a4, const double b4, const double c4, 00268 const double d4, const double e4, double &x1, 00269 double &x2, double &x3, double &x4); 00270 00271 /** \brief Solves the polynomial 00272 \f$ a_4 x^4 + b_4 x^3 + c_4 x^2 + d_4 x + e_4 = 0 \f$ 00273 giving the four complex solutions \f$ x=x_1 \f$ , \f$ x=x_2 \f$ , 00274 \f$ x=x_3 \f$ , and \f$ x=x_4 \f$ . 00275 */ 00276 virtual int solve_rc(const double a4, const double b4, const double c4, 00277 const double d4, const double e4, 00278 std::complex<double> &x1, std::complex<double> &x2, 00279 std::complex<double> &x3, 00280 std::complex<double> &x4)=0; 00281 00282 /// Return a string denoting the type ("quartic_real_coeff") 00283 const char *type() { return "quartic_real_coeff"; } 00284 }; 00285 00286 /** 00287 \brief Solve a quartic polynomial with complex coefficients and 00288 complex roots [abstract base] 00289 */ 00290 class quartic_complex : public quartic_real_coeff { 00291 00292 public: 00293 00294 virtual ~quartic_complex() {} 00295 00296 /** \brief Solves the polynomial 00297 \f$ a_4 x^4 + b_4 x^3 + c_4 x^2 + d_4 x + e_4 = 0 \f$ 00298 giving the four solutions \f$ x=x_1 \f$ , \f$ x=x_2 \f$ , 00299 \f$ x=x_3 \f$ , and \f$ x=x_4 \f$ . 00300 */ 00301 virtual int solve_r(const double a4, const double b4, const double c4, 00302 const double d4, const double e4, double &x1, 00303 double &x2, 00304 double &x3, double &x4); 00305 00306 /** \brief Solves the polynomial 00307 \f$ a_4 x^4 + b_4 x^3 + c_4 x^2 + d_4 x + e_4 = 0 \f$ 00308 giving the four complex solutions \f$ x=x_1 \f$ , \f$ x=x_2 \f$ , 00309 \f$ x=x_3 \f$ , and \f$ x=x_4 \f$ . 00310 */ 00311 virtual int solve_rc(const double a4, const double b4, const double c4, 00312 const double d4, const double e4, 00313 std::complex<double> &x1, std::complex<double> &x2, 00314 std::complex<double> &x3, std::complex<double> &x4); 00315 00316 /** \brief Solves the complex polynomial 00317 \f$ a_4 x^4 + b_4 x^3 + c_4 x^2 + d_4 x + e_4 = 0 \f$ 00318 giving the four complex solutions \f$ x=x_1 \f$ , \f$ x=x_2 \f$ , 00319 \f$ x=x_3 \f$ , and \f$ x=x_4 \f$ . 00320 */ 00321 virtual int solve_c(const std::complex<double> a4, 00322 const std::complex<double> b4, 00323 const std::complex<double> c4, 00324 const std::complex<double> d4, 00325 const std::complex<double> e4, 00326 std::complex<double> &x1, 00327 std::complex<double> &x2, std::complex<double> &x3, 00328 std::complex<double> &x4)=0; 00329 00330 /// Return a string denoting the type ("quartic_complex") 00331 const char *type() { return "quartic_complex"; } 00332 }; 00333 00334 /** \brief Solve a general polynomial with real 00335 coefficients and complex roots [abstract base] 00336 */ 00337 class poly_real_coeff : public quadratic_real_coeff, 00338 public cubic_real_coeff, public quartic_real_coeff { 00339 00340 public: 00341 00342 virtual ~poly_real_coeff() {} 00343 00344 /** 00345 \brief Solve the n-th order polynomial 00346 00347 The coefficients are stored in co[], with the leading coefficient 00348 as co[0] and the constant term as co[n]. The roots are returned 00349 in ro[0],...,ro[n-1]. 00350 */ 00351 virtual int solve_rc(int n, const double co[], 00352 std::complex<double> ro[])=0; 00353 00354 /// Return a string denoting the type ("poly_real_coeff") 00355 const char *type() { return "poly_real_coeff"; } 00356 }; 00357 00358 /** \brief Solve a general polynomial with complex 00359 coefficients [abstract base] 00360 */ 00361 class poly_complex : public quadratic_complex, 00362 public cubic_complex, public quartic_complex { 00363 00364 public: 00365 00366 virtual ~poly_complex() {} 00367 00368 /** 00369 \brief Solve the n-th order polynomial 00370 00371 The coefficients are stored in co[], with the leading coefficient 00372 as co[0] and the constant term as co[n]. The roots are returned 00373 in ro[0],...,ro[n-1]. 00374 */ 00375 virtual int solve_c(int n, const std::complex<double> co[], 00376 std::complex<double> ro[])=0; 00377 00378 /// Polish the roots 00379 virtual int polish_c(int n, const std::complex<double> co[], 00380 std::complex<double> *ro)=0; 00381 00382 /// Return a string denoting the type ("poly_complex") 00383 const char *type() { return "poly_complex"; } 00384 }; 00385 00386 /** 00387 \brief Solve a cubic with real coefficients and complex roots (CERNLIB) 00388 */ 00389 class cern_cubic_real_coeff : public cubic_real_coeff { 00390 00391 public: 00392 00393 virtual ~cern_cubic_real_coeff() {} 00394 00395 virtual int solve_rc(const double a3, const double b3, const double c3, 00396 const double d3, double &x1, 00397 std::complex<double> &x2, std::complex<double> &x3); 00398 00399 /// The original CERNLIB interface 00400 virtual int rrteq3(double r, double s, double t, double x[], double &d); 00401 00402 /// Return a string denoting the type ("cern_cubic_real_coeff") 00403 const char *type() { return "cern_cubic_real_coeff"; } 00404 }; 00405 00406 /** 00407 \brief Solve a quartic with real coefficients and complex roots (CERNLIB) 00408 */ 00409 class cern_quartic_real_coeff : public quartic_real_coeff { 00410 00411 public: 00412 00413 virtual ~cern_quartic_real_coeff() {} 00414 00415 virtual int solve_rc(const double a4, const double b4, const double c4, 00416 const double d4, const double e4, 00417 std::complex<double> &x1, std::complex<double> &x2, 00418 std::complex<double> &x3, std::complex<double> &x4); 00419 00420 /// The original CERNLIB interface 00421 virtual int rrteq4(double a, double b, double c, double d, 00422 std::complex<double> z[], double &dc, 00423 int &mt); 00424 00425 /// Return a string denoting the type ("cern_quartic_real_coeff") 00426 const char *type() { return "cern_quartic_real_coeff"; } 00427 00428 #ifndef DOXYGEN_INTERNAL 00429 00430 protected: 00431 00432 /// The object to solve for the associated cubic 00433 cern_cubic_real_coeff cub_obj; 00434 00435 #endif 00436 00437 }; 00438 00439 /** 00440 \brief Solve a quadratic with real coefficients and complex roots (GSL) 00441 */ 00442 class gsl_quadratic_real_coeff : public quadratic_real_coeff { 00443 00444 public: 00445 00446 virtual ~gsl_quadratic_real_coeff() {} 00447 00448 virtual int solve_rc(const double a2, const double b2, const double c2, 00449 std::complex<double> &x1, std::complex<double> &x2); 00450 00451 /// Return a string denoting the type ("gsl_quadratic_real_coeff") 00452 const char *type() { return "gsl_quadratic_real_coeff"; } 00453 00454 }; 00455 00456 /** 00457 \brief Solve a cubic with real coefficients and complex roots (GSL) 00458 */ 00459 class gsl_cubic_real_coeff : public cubic_real_coeff { 00460 00461 public: 00462 00463 virtual ~gsl_cubic_real_coeff() {} 00464 00465 virtual int solve_rc(const double a3, const double b3, const double c3, 00466 const double d3, double &x1, 00467 std::complex<double> &x2, 00468 std::complex<double> &x3); 00469 00470 /// Return a string denoting the type ("gsl_cubic_real_coeff") 00471 const char *type() { return "gsl_cubic_real_coeff"; } 00472 00473 /** 00474 \brief An alternative to \c gsl_poly_complex_solve_cubic() 00475 00476 This is an alternative to the function 00477 <tt>gsl_poly_complex_solve_cubic()</tt> with some small 00478 corrections to ensure finite values for some cubics. See 00479 <tt>src/other/poly_ts.cpp</tt> for more. 00480 */ 00481 int gsl_poly_complex_solve_cubic2(double a, double b, double c, 00482 gsl_complex *z0, gsl_complex *z1, 00483 gsl_complex *z2); 00484 00485 }; 00486 00487 /** 00488 \brief Solve a quartic with real coefficients and real roots (GSL) 00489 */ 00490 class gsl_quartic_real : public quartic_real { 00491 00492 public: 00493 00494 virtual ~gsl_quartic_real() {} 00495 00496 virtual int solve_r(const double a4, const double b4, const double c4, 00497 const double d4, const double e4, double &x1, 00498 double &x2, 00499 double &x3, double &x4); 00500 00501 /// Return a string denoting the type ("gsl_quartic_real") 00502 const char *type() { return "gsl_quartic_real"; } 00503 00504 }; 00505 00506 /** 00507 \brief Solve a quartic with real coefficients and real roots (GSL) 00508 00509 \todo Document the distinction between this class and 00510 \ref gsl_quartic_real 00511 */ 00512 class gsl_quartic_real2 : public quartic_real { 00513 00514 public: 00515 00516 virtual ~gsl_quartic_real2() {} 00517 00518 virtual int solve_r(const double a4, const double b4, const double c4, 00519 const double d4, const double e4, double &x1, 00520 double &x2, 00521 double &x3, double &x4); 00522 00523 /// Return a string denoting the type ("gsl_quartic_real2") 00524 const char *type() { return "gsl_quartic_real2"; } 00525 }; 00526 00527 /** 00528 \brief Solve a general polynomial with real coefficients (GSL) 00529 */ 00530 class gsl_poly_real_coeff : public poly_real_coeff { 00531 00532 public: 00533 00534 gsl_poly_real_coeff(); 00535 00536 virtual ~gsl_poly_real_coeff(); 00537 00538 virtual int solve_rc(int n, const double co[], 00539 std::complex<double> ro[]); 00540 00541 virtual int solve_rc(const double a3, const double b3, const double c3, 00542 const double d3, double &x1, 00543 std::complex<double> &x2, 00544 std::complex<double> &x3); 00545 00546 virtual int solve_rc(const double a2, const double b2, const double c2, 00547 std::complex<double> &x1, 00548 std::complex<double> &x2); 00549 00550 virtual int solve_rc(const double a4, const double b4, const double c4, 00551 const double d4, const double e4, 00552 std::complex<double> &x1, std::complex<double> &x2, 00553 std::complex<double> &x3, std::complex<double> &x4); 00554 00555 /// Return a string denoting the type ("gsl_poly_real_coeff") 00556 const char *type() { return "gsl_poly_real_coeff"; } 00557 00558 protected: 00559 00560 #ifndef DOXYGEN_INTERNAL 00561 00562 /// Workspace for quadratic polynomials 00563 gsl_poly_complex_workspace *w2; 00564 00565 /// Workspace for cubic polynomials 00566 gsl_poly_complex_workspace *w3; 00567 00568 /// Workspace for quartic polynomials 00569 gsl_poly_complex_workspace *w4; 00570 00571 /// Workspace for general polynomials 00572 gsl_poly_complex_workspace *wgen; 00573 00574 /// The size of the workspace \ref wgen 00575 int gen_size; 00576 00577 #endif 00578 00579 }; 00580 00581 /** 00582 \brief Solve a quadratic with complex coefficients and complex roots 00583 */ 00584 class quadratic_std_complex : public quadratic_complex { 00585 00586 public: 00587 00588 virtual ~quadratic_std_complex() {} 00589 00590 virtual int solve_c(const std::complex<double> a2, 00591 const std::complex<double> b2, 00592 const std::complex<double> c2, 00593 std::complex<double> &x1, std::complex<double> &x2); 00594 00595 /// Return a string denoting the type ("quadratic_std_complex") 00596 const char *type() { return "quadratic_std_complex"; } 00597 }; 00598 00599 /** 00600 \brief Solve a cubic with complex coefficients and complex roots 00601 */ 00602 class cubic_std_complex : public cubic_complex { 00603 00604 public: 00605 00606 virtual ~cubic_std_complex() {} 00607 00608 virtual int solve_c(const std::complex<double> a3, 00609 const std::complex<double> b3, 00610 const std::complex<double> c3, 00611 const std::complex<double> d3, 00612 std::complex<double> &x1, std::complex<double> &x2, 00613 std::complex<double> &x3); 00614 00615 /// Return a string denoting the type ("cubic_std_complex") 00616 const char *type() { return "cubic_std_complex"; } 00617 }; 00618 00619 /** 00620 \brief Solve a quartic with real coefficients and real roots 00621 00622 \todo 3/8/07 - Compilation at the NSCL produced non-finite values 00623 in solve_r() for some values of the coefficients. This should 00624 be checked. 00625 \todo It looks like this code is tested only for a4=1, and if 00626 so, the tests should be generalized. 00627 \todo Also, there is a hard-coded number in here (\f$ 10^{-6} \f$), 00628 which might be moved to a data member? 00629 */ 00630 class simple_quartic_real : public quartic_real { 00631 00632 public: 00633 00634 virtual ~simple_quartic_real() {} 00635 00636 virtual int solve_r(const double a4, const double b4, const double c4, 00637 const double d4, const double e4, double &x1, 00638 double &x2, double &x3, double &x4); 00639 00640 /// Return a string denoting the type ("simple_quartic_real") 00641 const char *type() { return "simple_quartic_real"; } 00642 }; 00643 00644 /** 00645 \brief Solve a quartic with complex coefficients and complex roots 00646 */ 00647 class simple_quartic_complex : public quartic_complex { 00648 00649 public: 00650 00651 virtual ~simple_quartic_complex() {} 00652 00653 virtual int solve_c(const std::complex<double> a4, 00654 const std::complex<double> b4, 00655 const std::complex<double> c4, 00656 const std::complex<double> d4, 00657 const std::complex<double> e4, 00658 std::complex<double> &x1, 00659 std::complex<double> &x2, std::complex<double> &x3, 00660 std::complex<double> &x4); 00661 00662 /// Return a string denoting the type ("simple_quartic_complex") 00663 const char *type() { return "simple_quartic_complex"; } 00664 00665 #ifndef DOXYGENP 00666 00667 protected: 00668 00669 /// The object to solve for the associated cubic 00670 cubic_std_complex cub_obj; 00671 00672 #endif 00673 00674 }; 00675 00676 #ifndef DOXYGENP 00677 } 00678 #endif 00679 00680 #endif
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page