23 mfunname(
"Parabola::Parabola(double x[3], double y[3])");
25 check_econd12a(x[0], ==, x[1],
"x[2]=" << x[2] <<
" y[0]=" << y[0] <<
" y[1]="
26 << y[1] <<
" y[2]=" << y[2] <<
'\n',
28 check_econd12a(x[0], ==, x[2],
"x[1]=" << x[1] <<
" y[0]=" << y[0] <<
" y[1]="
29 << y[1] <<
" y[2]=" << y[2] <<
'\n',
31 check_econd12a(x[1], ==, x[2],
"x[0]=" << x[0] <<
" y[0]=" << y[0] <<
" y[1]="
32 << y[1] <<
" y[2]=" << y[2] <<
'\n',
37 for (
int i = 0; i < 3; ++i) {
41 mat.
ac(i, 0) = x[i] * x[i];
66 mat.
ac(1, 1) = mat.
ac(0, 1);
67 mat.
ac(1, 2) = mat.
ac(0, 2);
74 "should never happen\nmat=" << mat <<
"\ns_var=" << s_var
75 <<
"\nmat_inv=" << mat_inv,
86 : s_det(0), s_dxzero(0) {
87 mfunname(
"Parabola::Parabola(double x[3], double y[3])");
89 check_econd12a(x1, ==, x2,
"x3=" << x3 <<
" y1=" << y1 <<
" y2=" << y2
90 <<
" y3=" << y3 <<
'\n',
92 check_econd12a(x1, ==, x3,
"x2=" << x2 <<
" y1=" << y1 <<
" y2=" << y2
93 <<
" y3=" << y3 <<
'\n',
95 check_econd12a(x2, ==, x3,
"x1=" << x1 <<
" y1=" << y1 <<
" y2=" << y2
96 <<
" y3=" << y3 <<
'\n',
104 mat.
ac(0, 0) = x1 * x1;
108 mat.
ac(1, 0) = x2 * x2;
112 mat.
ac(2, 0) = x3 * x3;
137 mat.
ac(1, 1) = mat.
ac(0, 1);
138 mat.
ac(1, 2) = mat.
ac(0, 2);
145 "should never happen\nmat=" << mat <<
"\ns_var=" << s_var
146 <<
"\nmat_inv=" << mat_inv,
156 mfunname(
"Parabola::Parabola(double x[3], double y[3], int)");
165 for (
int i = 0; i < 3; ++i) f[i] = y[i];
166 for (
int i = 0; i < 2; ++i) {
169 mat.
ac(i, 0) = x[i] * x[i];
173 mat.
ac(2, 0) = 2.0 * x[2];
180 if (
fabs(par[0]) == 0.0) {
190 mfunnamep(
"int Parabola::find_zero(double xzero[2]) const");
198 mcerr <<
"can not find zero\n";
202 t.dxzero[0] = -dc / db;
211 t.dxzero[0] = -db / (2.0 * da);
216 t.dxzero[0] = (-db - sq) / (2.0 * da);
217 t.dxzero[1] = (-db + sq) / (2.0 * da);
219 t.dxzero[1] = (-db - sq) / (2.0 * da);
220 t.dxzero[0] = (-db + sq) / (2.0 * da);
229 xzero[0] = dxzero[0];
230 xzero[1] = dxzero[1];
235 mfunname(
"double Parabola::find_maxmin(void)");
237 return -db / (2.0 * da);
243 Ifile <<
"Parabola: a=" << f.
a() <<
" b=" << f.
b() <<
" c=" << f.
c()
245 if (q > 0) file <<
" xzero=" << xz[0];
246 if (q > 1) file <<
' ' << xz[1];
#define check_econd11(a, signb, stream)
#define check_econd11a(a, signb, add, stream)
#define check_econd12a(a, sign, b, add, stream)
#define mfunnamep(string)
#define check_econd12(a, sign, b, stream)
Solution of a quadratic equation.
int find_zero(double xzero[2]) const
double determinant() const
Parabola()=default
Default constructor.
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
void inverse_DynArr_prot(const DynArr< DoubleAc > &mi, DynArr< DoubleAc > &mr, int &szero, int &serr, int s_stop)
DoubleAc fabs(const DoubleAc &f)
DoubleAc sqrt(const DoubleAc &f)