Assignments Assignments

poly34.h
Go to the documentation of this file.
1// poly34.h : solution of cubic and quartic equation
2// (c) Khashin S.I. http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html
3// khash2 (at) gmail.com
4
5#ifndef POLY34_INCLUDED
6#define POLY34_INCLUDED
7
8 namespace poly34
9{
10 // x - array of size 2
11 // return 2: 2 real roots x[0], x[1]
12 // return 0: pair of complex roots: x[0]±i*x[1]
13 int SolveP2(double *x, double a, double b); // solve equation x^2 + a*x + b = 0
14
15 // x - array of size 3
16 // return 3: 3 real roots x[0], x[1], x[2]
17 // return 1: 1 real root x[0] and pair of complex roots: x[1]±i*x[2]
18 int SolveP3(double *x, double a, double b, double c); // solve cubic equation x^3 + a*x^2 + b*x + c = 0
19
20 // x - array of size 4
21 // return 4: 4 real roots x[0], x[1], x[2], x[3], possible multiple roots
22 // return 2: 2 real roots x[0], x[1] and complex x[2]±i*x[3],
23 // return 0: two pair of complex roots: x[0]±i*x[1], x[2]±i*x[3],
24 int SolveP4(double *x,double a,double b,double c,double d); // solve equation x^4 + a*x^3 + b*x^2 + c*x + d = 0 by Dekart-Euler method
25
26 // x - array of size 5
27 // return 5: 5 real roots x[0], x[1], x[2], x[3], x[4], possible multiple roots
28 // return 3: 3 real roots x[0], x[1], x[2] and complex x[3]±i*x[4],
29 // return 1: 1 real root x[0] and two pair of complex roots: x[1]±i*x[2], x[3]±i*x[4],
30 int SolveP5(double *x, double a, double b, double c, double d, double e); // solve equation x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0
31
32 //-----------------------------------------------------------------------------
33 // And some additional functions for internal use.
34 // Your may remove this definitions from here
35 int SolveP4Bi(double *x, double b, double d); // solve equation x^4 + b*x^2 + d = 0
36 int SolveP4De(double *x, double b, double c, double d); // solve equation x^4 + b*x^2 + c*x + d = 0
37 void CSqrt( double x, double y, double &a, double &b); // returns as a+i*s, sqrt(x+i*y)
38 double N4Step(double x, double a,double b,double c,double d);// one Newton step for x^4 + a*x^3 + b*x^2 + c *x + d
39 double SolveP5_1(double a,double b,double c,double d,double e); // return real root of x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0
40}
41#endif // POLY34_INCLUDED
b
long b
Definition jpegint.h:371
poly34
Definition poly34.cpp:11
poly34::SolveP4
int SolveP4(double *x, double a, double b, double c, double d)
Definition poly34.cpp:275
poly34::SolveP5_1
double SolveP5_1(double a, double b, double c, double d, double e)
Definition poly34.cpp:304
poly34::SolveP4De
int SolveP4De(double *x, double b, double c, double d)
Definition poly34.cpp:185
poly34::N4Step
double N4Step(double x, double a, double b, double c, double d)
Definition poly34.cpp:263
poly34::SolveP3
int SolveP3(double *x, double a, double b, double c)
Definition poly34.cpp:73
poly34::CSqrt
void CSqrt(double x, double y, double &a, double &b)
Definition poly34.cpp:109
poly34::SolveP4Bi
int SolveP4Bi(double *x, double b, double d)
Definition poly34.cpp:122
poly34::SolveP2
int SolveP2(double *x, double a, double b)
Definition poly34.cpp:53
poly34::SolveP5
int SolveP5(double *x, double a, double b, double c, double d, double e)
Definition poly34.cpp:359