e = -42 * x * pow(y, sin(y*Catalan)) * dirac_ONE()
* epsilon_tensor(idx(fail(), 3), idx(0, 3), idx(y/2, 3))
+ lorentz_g(
- varidx(lst(x, -11*y, acos(2*x).series(x==3-5*I, 3)) * color_ONE()
+ varidx(lst{x, -11*y, acos(2*x).series(x==3-5*I, 3)} * color_ONE()
* metric_tensor(varidx(log(cos(128.0/(x*y))), 5), varidx(2, 5)), zeta(3)),
- varidx(diag_matrix(lst(-1, Euler, atan(x/y==-15*I/17)))
+ varidx(diag_matrix(lst{-1, Euler, atan(x/y==-15*I/17)})
* delta_tensor(idx(x, 2), idx(wild(7), 3)), zeta(3), true),
true
)
std::ifstream fin("exam.gar", std::ios_base::binary);
fin >> ar;
}
- f = ar.unarchive_ex(lst(x, y, mu, dim), "expr 1");
+ f = ar.unarchive_ex(lst{x, y, mu, dim}, "expr 1");
ex difference = (f - e).expand();
if (!difference.is_zero()) {
for (int j=0; j<4; j++) {
ex esub = e.subs(
is_a<varidx>(mu)
- ? lst (
+ ? lst {
mu == idx(j, mu.get_dim()),
ex_to<varidx>(mu).toggle_variance() == idx(j, mu.get_dim())
- )
- : lst(mu == idx(j, mu.get_dim()))
+ }
+ : lst{mu == idx(j, mu.get_dim())}
);
if (!(canonicalize_clifford(esub).is_zero())) {
clog << "simplify_indexed(" << e1 << ") - (" << e2 << ") erroneously returned "
result += check_equal(dirac_trace(e, 0), dirac_ONE(1) / 4);
result += check_equal(dirac_trace(e, 1), dirac_ONE(0) / 4);
result += check_equal(dirac_trace(e, 2), e);
- result += check_equal(dirac_trace(e, lst(0, 1)), 1);
+ result += check_equal(dirac_trace(e, lst{0, 1}), 1);
e = dirac_gamma(mu, 0) * dirac_gamma(mu.toggle_variance(), 1) * dirac_gamma(nu, 0) * dirac_gamma(nu.toggle_variance(), 1);
result += check_equal_simplify(dirac_trace(e, 0), 4 * dim * dirac_ONE(1));
// Fails with new tinfo mechanism because the order of gamma matrices with different rl depends on luck.
// TODO: better check.
//result += check_equal_simplify(dirac_trace(e, 2), canonicalize_clifford(e)); // e will be canonicalized by the calculation of the trace
- result += check_equal_simplify(dirac_trace(e, lst(0, 1)), 16 * dim);
+ result += check_equal_simplify(dirac_trace(e, lst{0, 1}), 16 * dim);
return result;
}
realsymbol s("s"), t("t"), x("x"), y("y"), z("z");
ex c = clifford_unit(nu, A, 1);
- e = lst_to_clifford(lst(t, x, y, z), mu, A, 1) * lst_to_clifford(lst(1, 2, 3, 4), c);
+ e = lst_to_clifford(lst{t, x, y, z}, mu, A, 1) * lst_to_clifford(lst{1, 2, 3, 4}, c);
e1 = clifford_inverse(e);
result += check_equal_simplify_term2((e*e1).simplify_indexed(), dirac_ONE(1));
/* lst_to_clifford() and clifford_to_lst() check for vectors*/
- e = lst(t, x, y, z);
+ e = lst{t, x, y, z};
result += check_equal_lst(clifford_to_lst(lst_to_clifford(e, c), c, false), e);
result += check_equal_lst(clifford_to_lst(lst_to_clifford(e, c), c, true), e);
/* lst_to_clifford() and clifford_to_lst() check for pseudovectors*/
- e = lst(s, t, x, y, z);
+ e = lst{s, t, x, y, z};
result += check_equal_lst(clifford_to_lst(lst_to_clifford(e, c), c, false), e);
result += check_equal_lst(clifford_to_lst(lst_to_clifford(e, c), c, true), e);
c = clifford_unit(nu, A);
e = clifford_moebius_map(0, dirac_ONE(),
- dirac_ONE(), 0, lst(t, x, y, z), A);
+ dirac_ONE(), 0, lst{t, x, y, z}, A);
/* this is just the inversion*/
M1 = 0, dirac_ONE(),
dirac_ONE(), 0;
- e1 = clifford_moebius_map(M1, lst(t, x, y, z), A);
+ e1 = clifford_moebius_map(M1, lst{t, x, y, z}, A);
/* the inversion again*/
result += check_equal_lst(e, e1);
- e1 = clifford_to_lst(clifford_inverse(lst_to_clifford(lst(t, x, y, z), mu, A)), c);
+ e1 = clifford_to_lst(clifford_inverse(lst_to_clifford(lst{t, x, y, z}, mu, A)), c);
result += check_equal_lst(e, e1);
- e = clifford_moebius_map(dirac_ONE(), lst_to_clifford(lst(1, 2, 3, 4), nu, A),
- 0, dirac_ONE(), lst(t, x, y, z), A);
+ e = clifford_moebius_map(dirac_ONE(), lst_to_clifford(lst{1, 2, 3, 4}, nu, A),
+ 0, dirac_ONE(), lst{t, x, y, z}, A);
/*this is just a shift*/
- M2 = dirac_ONE(), lst_to_clifford(lst(1, 2, 3, 4), c),
+ M2 = dirac_ONE(), lst_to_clifford(lst{1, 2, 3, 4}, c),
0, dirac_ONE();
- e1 = clifford_moebius_map(M2, lst(t, x, y, z), c);
+ e1 = clifford_moebius_map(M2, lst{t, x, y, z}, c);
/* the same shift*/
result += check_equal_lst(e, e1);
- result += check_equal(e, lst(t+1, x+2, y+3, z+4));
+ result += check_equal(e, lst{t+1, x+2, y+3, z+4});
/* Check the group law for Moebius maps */
e = clifford_moebius_map(M1, ex_to<lst>(e1), c);
/*composition of M1 and M2*/
- e1 = clifford_moebius_map(M1.mul(M2), lst(t, x, y, z), c);
+ e1 = clifford_moebius_map(M1.mul(M2), lst{t, x, y, z}, c);
/* the product M1*M2*/
result += check_equal_lst(e, e1);
return result;
realsymbol a("a");
varidx mu(symbol("mu", "\\mu"), 1);
- ex e = clifford_unit(mu, diag_matrix(lst(-1))), e0 = e.subs(mu==0);
+ ex e = clifford_unit(mu, diag_matrix(lst{-1})), e0 = e.subs(mu==0);
result += ( exp(a*e0)*e0*e0 == -exp(e0*a) ) ? 0 : 1;
return result;
result += clifford_check5(); cout << '.' << flush;
// anticommuting, symmetric examples
- result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst(-1, 1, 1, 1))));
- result += clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst(-1, 1, 1, 1))));; cout << '.' << flush;
- result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst(-1, -1, -1, -1))))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst(-1, -1, -1, -1))));; cout << '.' << flush;
- result += clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst(-1, 1, 1, -1))))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst(-1, 1, 1, -1))));; cout << '.' << flush;
- result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst(-1, 0, 1, -1))))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst(-1, 0, 1, -1))));; cout << '.' << flush;
- result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst(-3, 0, 2, -1))))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst(-3, 0, 2, -1))));; cout << '.' << flush;
+ result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst{-1, 1, 1, 1})));
+ result += clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst{-1, 1, 1, 1})));; cout << '.' << flush;
+ result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst{-1, -1, -1, -1})))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst{-1, -1, -1, -1})));; cout << '.' << flush;
+ result += clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst{-1, 1, 1, -1})))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst{-1, 1, 1, -1})));; cout << '.' << flush;
+ result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst{-1, 0, 1, -1})))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst{-1, 0, 1, -1})));; cout << '.' << flush;
+ result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst{-3, 0, 2, -1})))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst{-3, 0, 2, -1})));; cout << '.' << flush;
realsymbol s("s"), t("t"); // symbolic entries in matric
- result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst(-1, 1, s, t))))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst(-1, 1, s, t))));; cout << '.' << flush;
+ result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst{-1, 1, s, t})))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst{-1, 1, s, t})));; cout << '.' << flush;
matrix A(4, 4);
A = 1, 0, 0, 0, // anticommuting, not symmetric, Tr=0
for (int i=1; i<9; i++)
for (int j=1; j<9; j++)
for (int k=1; k<9; k++)
- sum += e.subs(lst(a == i, b == j, c == k));
+ sum += e.subs(lst{a == i, b == j, c == k});
if (!sum.is_equal(numeric(-32,3))) {
clog << "numeric contraction of " << e << " erroneously returned "
<< sum << " instead of -32/3" << endl;
result += check_equal(color_trace(e, 0), color_ONE(1) / 3);
result += check_equal(color_trace(e, 1), color_ONE(0) / 3);
result += check_equal(color_trace(e, 2), e);
- result += check_equal(color_trace(e, lst(0, 1)), 1);
+ result += check_equal(color_trace(e, lst{0, 1}), 1);
e = color_T(a, 0) * color_T(a, 1) * color_T(b, 0) * color_T(b, 1);
result += check_equal_simplify(color_trace(e, 0), 2 * color_ONE(1) / 3);
result += check_equal_simplify(color_trace(e, 1), 2 * color_ONE(0) / 3);
result += check_equal_simplify(color_trace(e, 2), e);
- result += check_equal_simplify(color_trace(e, lst(0, 1)), 2);
+ result += check_equal_simplify(color_trace(e, lst{0, 1}), 2);
return result;
}
e = (e1 * e2).expand();
// d e / dx:
- d = ex("121-55/x^2-66/x^3-30/x^3/y^2-42/x^3/y-78/x^3*y-102/x^3*y^2-25/x^2/y^2-35/x^2/y-65/x^2*y-85/x^2*y^2+77/y+143*y+187*y^2+130*x/y^2+182/y*x+338*x*y+442*x*y^2+55/y^2+286*x",lst(x,y));
+ d = ex("121-55/x^2-66/x^3-30/x^3/y^2-42/x^3/y-78/x^3*y-102/x^3*y^2-25/x^2/y^2-35/x^2/y-65/x^2*y-85/x^2*y^2+77/y+143*y+187*y^2+130*x/y^2+182/y*x+338*x*y+442*x*y^2+55/y^2+286*x",lst{x,y});
result += check_diff(e, x, d);
// d e / dy:
- d = ex("91-30/x^2/y^3-21/x^2/y^2+39/x^2+102/x^2*y-50/x/y^3-35/x/y^2+65/x+170/x*y-77*x/y^2+143*x+374*x*y-130/y^3*x^2-91/y^2*x^2+169*x^2+442*x^2*y-110/y^3*x-70/y^3+238*y-49/y^2",lst(x,y));
+ d = ex("91-30/x^2/y^3-21/x^2/y^2+39/x^2+102/x^2*y-50/x/y^3-35/x/y^2+65/x+170/x*y-77*x/y^2+143*x+374*x*y-130/y^3*x^2-91/y^2*x^2+169*x^2+442*x^2*y-110/y^3*x-70/y^3+238*y-49/y^2",lst{x,y});
result += check_diff(e, y, d);
// d^2 e / dx^2:
- d = ex("286+90/x^4/y^2+126/x^4/y+234/x^4*y+306/x^4*y^2+50/x^3/y^2+70/x^3/y+130/x^3*y+170/x^3*y^2+130/y^2+182/y+338*y+442*y^2+198/x^4+110/x^3",lst(x,y));
+ d = ex("286+90/x^4/y^2+126/x^4/y+234/x^4*y+306/x^4*y^2+50/x^3/y^2+70/x^3/y+130/x^3*y+170/x^3*y^2+130/y^2+182/y+338*y+442*y^2+198/x^4+110/x^3",lst{x,y});
result += check_diff(e, x, d, 2);
// d^2 e / dy^2:
- d = ex("238+90/x^2/y^4+42/x^2/y^3+102/x^2+150/x/y^4+70/x/y^3+170/x+330*x/y^4+154*x/y^3+374*x+390*x^2/y^4+182*x^2/y^3+442*x^2+210/y^4+98/y^3",lst(x,y));
+ d = ex("238+90/x^2/y^4+42/x^2/y^3+102/x^2+150/x/y^4+70/x/y^3+170/x+330*x/y^4+154*x/y^3+374*x+390*x^2/y^4+182*x^2/y^3+442*x^2+210/y^4+98/y^3",lst{x,y});
result += check_diff(e, y, d, 2);
return result;
unsigned result = 0;
ex e;
symbol x("x"), y("y"), z("z");
- lst syms;
- syms = x, y, z;
+ lst syms = {x, y, z};
e = ex("x+y", syms);
result += check_factor(e);
unsigned result = 0;
ex e;
symbol k("k"), n("n");
- lst syms;
- syms = k, n;
+ lst syms = {k, n};
e = ex("1/2*(-3+3*k-n)*(-2+3*k-n)*(-1+3*k-n)", syms);
result += check_factor(e);
* indexed(F, rho, sigma)).simplify_indexed();
// Extract transformed electric and magnetic fields
- ex Ex_p = e.subs(lst(mu == 1, nu == 0)).normal();
- ex Ey_p = e.subs(lst(mu == 2, nu == 0)).normal();
- ex Ez_p = e.subs(lst(mu == 3, nu == 0)).normal();
- ex Bx_p = e.subs(lst(mu == 3, nu == 2)).normal();
- ex By_p = e.subs(lst(mu == 1, nu == 3)).normal();
- ex Bz_p = e.subs(lst(mu == 2, nu == 1)).normal();
+ ex Ex_p = e.subs(lst{mu == 1, nu == 0}).normal();
+ ex Ey_p = e.subs(lst{mu == 2, nu == 0}).normal();
+ ex Ez_p = e.subs(lst{mu == 3, nu == 0}).normal();
+ ex Bx_p = e.subs(lst{mu == 3, nu == 2}).normal();
+ ex By_p = e.subs(lst{mu == 1, nu == 3}).normal();
+ ex Bz_p = e.subs(lst{mu == 2, nu == 1}).normal();
// Check results
result += check_equal(Ex_p, Ex);
// Test 2: check energy density and Poynting vector of electromagnetic field
// Minkowski metric
- ex eta = diag_matrix(lst(1, -1, -1, -1));
+ ex eta = diag_matrix(lst{1, -1, -1, -1});
// Covariant field tensor
ex F_mu_nu = (indexed(eta, mu.toggle_variance(), rho.toggle_variance())
// Energy-momentum tensor
ex T = (-indexed(eta, rho, sigma) * F_mu_nu.subs(s_nu == s_rho)
- * F_mu_nu.subs(lst(s_mu == s_nu, s_nu == s_sigma))
+ * F_mu_nu.subs(lst{s_mu == s_nu, s_nu == s_sigma})
+ indexed(eta, mu.toggle_variance(), nu.toggle_variance())
- * F_mu_nu.subs(lst(s_mu == s_rho, s_nu == s_sigma))
+ * F_mu_nu.subs(lst{s_mu == s_rho, s_nu == s_sigma})
* indexed(F, rho, sigma) / 4).simplify_indexed() / (4 * Pi);
// Extract energy density and Poynting vector
- ex E = T.subs(lst(s_mu == 0, s_nu == 0)).normal();
- ex Px = T.subs(lst(s_mu == 0, s_nu == 1));
- ex Py = T.subs(lst(s_mu == 0, s_nu == 2));
- ex Pz = T.subs(lst(s_mu == 0, s_nu == 3));
+ ex E = T.subs(lst{s_mu == 0, s_nu == 0}).normal();
+ ex Px = T.subs(lst{s_mu == 0, s_nu == 1});
+ ex Py = T.subs(lst{s_mu == 0, s_nu == 2});
+ ex Pz = T.subs(lst{s_mu == 0, s_nu == 3});
// Check results
result += check_equal(E, (Ex*Ex+Ey*Ey+Ez*Ez+Bx*Bx+By*By+Bz*Bz) / (8 * Pi));
// GiNaC 1.2.1 had a bug here because p.i*p.i -> (p.i)^2
e = indexed(p, i) * indexed(p, i) * indexed(p, j) + indexed(p, j);
ex fi = exprseq(e.get_free_indices());
- if (!fi.is_equal(exprseq(j))) {
+ if (!fi.is_equal(exprseq{j})) {
clog << "get_free_indices(" << e << ") erroneously returned "
<< fi << " instead of (.j)" << endl;
++result;
lst res;
- res.append(H(lst(2,1),numeric(1)/2).hold() - (zeta(3)/8 - pow(log(2),3)/6));
- res.append(H(lst(2,1,3),numeric(1)/3).hold() - Li(lst(2,1,3),lst(numeric(1)/3,1,1)).hold());
- res.append(H(lst(2,1,3),numeric(98)/100).hold() - Li(lst(2,1,3),lst(numeric(98)/100,1,1)).hold());
- res.append(H(lst(2,1,3),numeric(245)/100).hold() - Li(lst(2,1,3),lst(numeric(245)/100,1,1)).hold());
- res.append(H(lst(4,1,1,1),numeric(1)/3).hold() - S(3,4,numeric(1)/3).hold());
- res.append(H(lst(4,1,1,1),numeric(98)/100).hold() - S(3,4,numeric(98)/100).hold());
- res.append(H(lst(4,1,1,1),numeric(245)/100).hold() - S(3,4,numeric(245)/100).hold());
- res.append(H(lst(2,2,3),almostone).hold() - zeta(lst(2,2,3)));
- res.append(H(lst(-3,-1,2,1),almostone).hold() - zeta(lst(3,1,2,1),lst(-1,1,-1,1)));
- res.append(H(lst(-2,1,3),numeric(1)/3).hold() - -Li(lst(2,1,3),lst(-numeric(1)/3,-1,1)).hold());
- res.append(H(lst(-2,1,3),numeric(98)/100).hold() - -Li(lst(2,1,3),lst(-numeric(98)/100,-1,1)).hold());
- res.append(H(lst(-2,1,3),numeric(245)/100).hold() - -Li(lst(2,1,3),lst(-numeric(245)/100,-1,1)).hold());
- res.append(H(lst(-3,1,-2,0,0),numeric(3)/10).hold() - convert_H_to_Li(lst(-3,1,-2,0,0),numeric(3)/10).eval());
+ res.append(H(lst{2,1},numeric(1)/2).hold() - (zeta(3)/8 - pow(log(2),3)/6));
+ res.append(H(lst{2,1,3},numeric(1)/3).hold() - Li(lst{2,1,3},lst{numeric(1)/3,1,1}).hold());
+ res.append(H(lst{2,1,3},numeric(98)/100).hold() - Li(lst{2,1,3},lst{numeric(98)/100,1,1}).hold());
+ res.append(H(lst{2,1,3},numeric(245)/100).hold() - Li(lst{2,1,3},lst{numeric(245)/100,1,1}).hold());
+ res.append(H(lst{4,1,1,1},numeric(1)/3).hold() - S(3,4,numeric(1)/3).hold());
+ res.append(H(lst{4,1,1,1},numeric(98)/100).hold() - S(3,4,numeric(98)/100).hold());
+ res.append(H(lst{4,1,1,1},numeric(245)/100).hold() - S(3,4,numeric(245)/100).hold());
+ res.append(H(lst{2,2,3},almostone).hold() - zeta(lst{2,2,3}));
+ res.append(H(lst{-3,-1,2,1},almostone).hold() - zeta(lst{3,1,2,1},lst{-1,1,-1,1}));
+ res.append(H(lst{-2,1,3},numeric(1)/3).hold() - -Li(lst{2,1,3},lst{-numeric(1)/3,-1,1}).hold());
+ res.append(H(lst{-2,1,3},numeric(98)/100).hold() - -Li(lst{2,1,3},lst{-numeric(98)/100,-1,1}).hold());
+ res.append(H(lst{-2,1,3},numeric(245)/100).hold() - -Li(lst{2,1,3},lst{-numeric(245)/100,-1,1}).hold());
+ res.append(H(lst{-3,1,-2,0,0},numeric(3)/10).hold() - convert_H_to_Li(lst{-3,1,-2,0,0},numeric(3)/10).eval());
for (lst::const_iterator it = res.begin(); it != res.end(); it++) {
ex diff = abs((*it).evalf());
Digits = digitsbuf;
// conjugate test
- numeric cdif = ex_to<numeric>(H(lst(2,2,1),5.0-5.0*I) - H(lst(2,2,1),5.0+5.0*I));
- numeric cadd = ex_to<numeric>(H(lst(2,2,1),5.0-5.0*I) + H(lst(2,2,1),5.0+5.0*I));
+ numeric cdif = ex_to<numeric>(H(lst{2,2,1},5.0-5.0*I) - H(lst{2,2,1},5.0+5.0*I));
+ numeric cadd = ex_to<numeric>(H(lst{2,2,1},5.0-5.0*I) + H(lst{2,2,1},5.0+5.0*I));
if ((cdif.real() > prec) || (cadd.imag() > prec)) {
clog << "complex conjugation test of H({2,2,1},5.0-5.0*I) seems to be wrong: " << cdif << " " << cadd << endl;
result++;
lst res;
- res.append(zeta(lst(2,1)) - zeta(3));
- res.append(zeta(lst(2,1,1,1,1)) - zeta(6));
- res.append(zeta(lst(6,3)) - (zeta(9)*83/2 - zeta(2)*zeta(7)*21 - zeta(2)*zeta(2)*zeta(5)*12/5));
- res.append(zeta(lst(4,2,3)) - (-zeta(9)*59 + zeta(2)*zeta(7)*28 + pow(zeta(2),2)*zeta(5)*4 -
+ res.append(zeta(lst{2,1}) - zeta(3));
+ res.append(zeta(lst{2,1,1,1,1}) - zeta(6));
+ res.append(zeta(lst{6,3}) - (zeta(9)*83/2 - zeta(2)*zeta(7)*21 - zeta(2)*zeta(2)*zeta(5)*12/5));
+ res.append(zeta(lst{4,2,3}) - (-zeta(9)*59 + zeta(2)*zeta(7)*28 + pow(zeta(2),2)*zeta(5)*4 -
pow(zeta(3),3)/3 + pow(zeta(2),3)*zeta(3)*8/21));
- res.append(zeta(lst(3,1,3,1,3,1,3,1)) - (2*pow(Pi,16)/factorial(18)));
- res.append(zeta(lst(2),lst(-1)) - -zeta(2)/2);
- res.append(zeta(lst(1,2),lst(-1,1)) - (-zeta(3)/4 - zeta(lst(1),lst(-1))*zeta(2)/2));
- res.append(zeta(lst(2,1,1),lst(-1,-1,1)) - (-pow(zeta(2),2)*23/40 - pow(zeta(lst(1),lst(-1)),2)*zeta(2)*3/4
- - zeta(lst(3,1),lst(-1,1))*3/2 - zeta(lst(1),lst(-1))*zeta(3)*21/8));
+ res.append(zeta(lst{3,1,3,1,3,1,3,1}) - (2*pow(Pi,16)/factorial(18)));
+ res.append(zeta(lst{2},lst{-1}) - -zeta(2)/2);
+ res.append(zeta(lst{1,2},lst{-1,1}) - (-zeta(3)/4 - zeta(lst{1},lst{-1})*zeta(2)/2));
+ res.append(zeta(lst{2,1,1},lst{-1,-1,1}) - (-pow(zeta(2),2)*23/40 - pow(zeta(lst{1},lst{-1}),2)*zeta(2)*3/4
+ - zeta(lst{3,1},lst{-1,1})*3/2 - zeta(lst{1},lst{-1})*zeta(3)*21/8));
for (lst::const_iterator it = res.begin(); it != res.end(); it++) {
Digits = 17;
lst res;
- res.append(Li(lst(4), lst(6)).hold() - Li(4, 6.0));
- res.append(G(lst(0,0,5.0,0,2.0,0,0,0,3.0),0.5).hold()
- + Li(lst(3,2,4), lst(numeric(1,10), numeric(5,2), numeric(2,3))));
- res.append(Li(lst(2,1,1), lst(almostone, almostone, almostone)) - zeta(lst(2,1,1)));
+ res.append(Li(lst{4}, lst{6}).hold() - Li(4, 6.0));
+ res.append(G(lst{0,0,5.0,0,2.0,0,0,0,3.0},0.5).hold()
+ + Li(lst{3,2,4}, lst{numeric(1,10), numeric(5,2), numeric(2,3)}));
+ res.append(Li(lst{2,1,1}, lst{almostone, almostone, almostone}) - zeta(lst{2,1,1}));
// check Li_{1,1} against known expression
symbol x("x"), y("y");
ex eps = 1e-30*I;
- ex s1 = Li(lst(1,1),lst(x,y));
+ ex s1 = Li(lst{1,1},lst{x,y});
ex s2 = log(1-1/x/y-eps)*log((1-1/x-eps)/(1/x/y-1/x)) + Li(2,(1-1/x/y-eps)/(1/x-1/x/y))
- log(-1/x/y-eps)*log((-1/x-eps)/(1/x/y-1/x)) - Li(2,(-1/x/y-eps)/(1/x-1/x/y))
- log(-1/x/y-eps)*log(1-1/x-eps) + log(-1/x/y-eps)*log(-1/x-eps);
- res.append(s1.subs(lst(x==numeric(1)/2, y==3)) - s2.subs(lst(x==numeric(1)/2, y==3)));
- res.append(s1.subs(lst(x==numeric(3)/2, y==numeric(1)/2)) - s2.subs(lst(x==numeric(3)/2, y==numeric(1)/2)));
- res.append(s1.subs(lst(x==2, y==numeric(4)/5)) - s2.subs(lst(x==2, y==numeric(4)/5)));
+ res.append(s1.subs(lst{x==numeric(1)/2, y==3}) - s2.subs(lst{x==numeric(1)/2, y==3}));
+ res.append(s1.subs(lst{x==numeric(3)/2, y==numeric(1)/2}) - s2.subs(lst{x==numeric(3)/2, y==numeric(1)/2}));
+ res.append(s1.subs(lst{x==2, y==numeric(4)/5}) - s2.subs(lst{x==2, y==numeric(4)/5}));
// shuffle and quasi-shuffle identities
- res.append(G(lst(0,0.2),1).hold() * G(lst(0.5),1).hold() - G(lst(0.5,0,0.2),1).hold()
- - G(lst(0,0.5,0.2),1).hold() - G(lst(0,0.2,0.5),1).hold());
- res.append(G(lst(0,0.5),1).hold() * G(lst(0.6),1).hold() - G(lst(0,0.5,0.5*0.6),1).hold()
- - G(lst(0.6,0,0.5*0.6),1).hold() + G(lst(0,0,0.5*0.6),1).hold());
- res.append(Li(lst(2),lst(numeric(1,5))).hold() * Li(lst(3),lst(7)).hold() - Li(lst(2,3),lst(numeric(1,5),7)).hold()
- - Li(lst(3,2),lst(7,numeric(1,5))).hold() - Li(lst(5),lst(numeric(7,5))).hold());
+ res.append(G(lst{0,0.2},1).hold() * G(lst{0.5},1).hold() - G(lst{0.5,0,0.2},1).hold()
+ - G(lst{0,0.5,0.2},1).hold() - G(lst{0,0.2,0.5},1).hold());
+ res.append(G(lst{0,0.5},1).hold() * G(lst{0.6},1).hold() - G(lst{0,0.5,0.5*0.6},1).hold()
+ - G(lst{0.6,0,0.5*0.6},1).hold() + G(lst{0,0,0.5*0.6},1).hold());
+ res.append(Li(lst{2},lst{numeric(1,5)}).hold() * Li(lst{3},lst{7}).hold() - Li(lst{2,3},lst{numeric(1,5),7}).hold()
+ - Li(lst{3,2},lst{7,numeric(1,5)}).hold() - Li(lst{5},lst{numeric(7,5)}).hold());
symbol a1, a2, a3, a4;
- res.append((G(lst(a1,a2),1) * G(lst(a3,a4),1) - G(lst(a1,a2,a3,a4),1)
- - G(lst(a1,a3,a2,a4),1) - G(lst(a3,a1,a2,a4),1)
- - G(lst(a1,a3,a4,a2),1) - G(lst(a3,a1,a4,a2),1) - G(lst(a3,a4,a1,a2),1))
- .subs(lst(a1==numeric(1)/10, a2==numeric(3)/10, a3==numeric(7)/10, a4==5)));
- res.append(G(lst(-0.009),1).hold() * G(lst(-8,1.4999),1).hold() - G(lst(-0.009,-8,1.4999),1).hold()
- - G(lst(-8,-0.009,1.4999),1).hold() - G(lst(-8,1.4999,-0.009),1).hold());
- res.append(G(lst(sqrt(numeric(1)/2)+I*sqrt(numeric(1)/2)),1).hold() * G(lst(1.51,-0.999),1).hold()
- - G(lst(sqrt(numeric(1)/2)+I*sqrt(numeric(1)/2),1.51,-0.999),1).hold()
- - G(lst(1.51,sqrt(numeric(1)/2)+I*sqrt(numeric(1)/2),-0.999),1).hold()
- - G(lst(1.51,-0.999,sqrt(numeric(1)/2)+I*sqrt(numeric(1)/2)),1).hold());
+ res.append((G(lst{a1,a2},1) * G(lst{a3,a4},1) - G(lst{a1,a2,a3,a4},1)
+ - G(lst{a1,a3,a2,a4},1) - G(lst{a3,a1,a2,a4},1)
+ - G(lst{a1,a3,a4,a2},1) - G(lst{a3,a1,a4,a2},1) - G(lst{a3,a4,a1,a2},1))
+ .subs(lst{a1==numeric(1)/10, a2==numeric(3)/10, a3==numeric(7)/10, a4==5}));
+ res.append(G(lst{-0.009},1).hold() * G(lst{-8,1.4999},1).hold() - G(lst{-0.009,-8,1.4999},1).hold()
+ - G(lst{-8,-0.009,1.4999},1).hold() - G(lst{-8,1.4999,-0.009},1).hold());
+ res.append(G(lst{sqrt(numeric(1)/2)+I*sqrt(numeric(1)/2)},1).hold() * G(lst{1.51,-0.999},1).hold()
+ - G(lst{sqrt(numeric(1)/2)+I*sqrt(numeric(1)/2),1.51,-0.999},1).hold()
+ - G(lst{1.51,sqrt(numeric(1)/2)+I*sqrt(numeric(1)/2),-0.999},1).hold()
+ - G(lst{1.51,-0.999,sqrt(numeric(1)/2)+I*sqrt(numeric(1)/2)},1).hold());
// checks for hoelder convolution which is used if one argument has a distance to one smaller than 0.01
- res.append(G(lst(0, 1.2, 1, 1.01), 1).hold() - G(lst(0, 1.2, 1, numeric("1.009999999999999999")), 1).hold());
+ res.append(G(lst{0, 1.2, 1, 1.01}, 1).hold() - G(lst{0, 1.2, 1, numeric("1.009999999999999999")}, 1).hold());
for (lst::const_iterator it = res.begin(); it != res.end(); it++) {
ex diff = abs((*it).evalf());
unsigned result = 0;
- ex r1 = zeta(lst(1,1,1,1,1,1),lst(-1,-1,-1,1,1,1));
+ ex r1 = zeta(lst{1,1,1,1,1,1}, lst{-1,-1,-1,1,1,1});
if ((r1.evalf() - numeric("-0.0012588769028204890704")) > prec) {
clog << "zeta({1,1,1,1,1,1},{-1,-1,-1,1,1,1}) seems to be wrong." << endl;
result++;
ex x1 = exp(2*Pi*I/13).evalf();
ex x2 = exp(24*Pi*I/13).evalf();
- ex r2 = Li(lst(2),lst(x1)).hold().evalf();
- ex r3 = Li(lst(2),lst(x2)).hold().evalf();
+ ex r2 = Li(lst{2},lst{x1}).hold().evalf();
+ ex r3 = Li(lst{2},lst{x2}).hold().evalf();
if ( abs(r2-conjugate(r3)) > prec ) {
clog << "Legacy test 2 seems to be wrong." << endl;
result++;
}
ex x3 = exp(5*Pi*I/3).evalf();
- ex r4 = Li(lst(3),lst(x3)).hold().evalf();
+ ex r4 = Li(lst{3},lst{x3}).hold().evalf();
if ( abs(r4 - numeric("0.40068563438653142847-0.95698384815740185713*I")) > prec ) {
clog << "Legacy test 3 seems to be wrong." << endl;
result++;
ex x4 = exp(4*Pi*I/3).evalf();
ex x5 = exp(5*Pi*I/3).evalf();
- ex r5 = Li(lst(1,1,1,1),lst(x2,x4,x3,x0)).hold().evalf();
- ex r6 = Li(lst(1,1,1,1),lst(x4,x2,x3,x0)).hold().evalf();
+ ex r5 = Li(lst{1,1,1,1},lst{x2,x4,x3,x0}).hold().evalf();
+ ex r6 = Li(lst{1,1,1,1},lst{x4,x2,x3,x0}).hold().evalf();
if ( abs(r5-conjugate(r6)) > prec ) {
clog << "Legacy test 4 seems to be wrong." << endl;
result++;
}
- ex r7 = Li(lst(1,2,1),lst(x3,x2,x4)).hold().evalf()
- +Li(lst(1,1,2),lst(x3,x2,x4)).hold().evalf()
- +Li(lst(1,1,1,1),lst(x3,x0,x2,x4)).hold().evalf()
- +Li(lst(1,1,1,1),lst(x3,x2,x0,x4)).hold().evalf()
- +Li(lst(1,1,1,1),lst(x3,x2,x4,x0)).hold().evalf()
- +Li(lst(1,2,1),lst(x2,x1,x0)).hold().evalf()
- +Li(lst(1,1,2),lst(x2,x3,x4)).hold().evalf()
- +Li(lst(1,1,1,1),lst(x2,x4,x3,x0)).hold().evalf()
- +Li(lst(1,1,1,1),lst(x2,x3,x4,x0)).hold().evalf()
- +Li(lst(1,1,1,1),lst(x2,x3,x0,x4)).hold().evalf()
- +Li(lst(2,2),lst(x5,x4)).hold().evalf()
- +Li(lst(2,1,1),lst(x5,x0,x4)).hold().evalf()
- +Li(lst(2,1,1),lst(x5,x4,x0)).hold().evalf()
- -Li(lst(1,1),lst(x3,x0)).hold().evalf()*Li(lst(1,1),lst(x2,x4)).hold().evalf();
+ ex r7 = Li(lst{1,2,1},lst{x3,x2,x4}).hold().evalf()
+ +Li(lst{1,1,2},lst{x3,x2,x4}).hold().evalf()
+ +Li(lst{1,1,1,1},lst{x3,x0,x2,x4}).hold().evalf()
+ +Li(lst{1,1,1,1},lst{x3,x2,x0,x4}).hold().evalf()
+ +Li(lst{1,1,1,1},lst{x3,x2,x4,x0}).hold().evalf()
+ +Li(lst{1,2,1},lst{x2,x1,x0}).hold().evalf()
+ +Li(lst{1,1,2},lst{x2,x3,x4}).hold().evalf()
+ +Li(lst{1,1,1,1},lst{x2,x4,x3,x0}).hold().evalf()
+ +Li(lst{1,1,1,1},lst{x2,x3,x4,x0}).hold().evalf()
+ +Li(lst{1,1,1,1},lst{x2,x3,x0,x4}).hold().evalf()
+ +Li(lst{2,2},lst{x5,x4}).hold().evalf()
+ +Li(lst{2,1,1},lst{x5,x0,x4}).hold().evalf()
+ +Li(lst{2,1,1},lst{x5,x4,x0}).hold().evalf()
+ -Li(lst{1,1},lst{x3,x0}).hold().evalf()*Li(lst{1,1},lst{x2,x4}).hold().evalf();
if ( abs(r7) > prec ) {
clog << "Legacy test 5 seems to be wrong." << endl;
result++;
static unsigned check_G_y_one_bug()
{
exvector exprs;
- exprs.push_back(G(lst(-1,-1, 1,-1, 0), 1));
- exprs.push_back(G(lst(-1, 0, 1,-1, 0), 1));
- exprs.push_back(G(lst(-1, 1,-1,-1, 0), 1));
- exprs.push_back(G(lst(-1, 1,-1, 0, 0), 1));
- exprs.push_back(G(lst(-1, 1,-1, 1, 0), 1));
- exprs.push_back(G(lst(-1, 1, 0,-1, 0), 1));
- exprs.push_back(G(lst(-1, 1, 1,-1, 0), 1));
- exprs.push_back(G(lst( 0,-1, 1,-1, 0), 1));
- exprs.push_back(G(lst( 0, 1, 1,-1, 0), 1));
+ exprs.push_back(G(lst{-1,-1, 1,-1, 0}, 1));
+ exprs.push_back(G(lst{-1, 0, 1,-1, 0}, 1));
+ exprs.push_back(G(lst{-1, 1,-1,-1, 0}, 1));
+ exprs.push_back(G(lst{-1, 1,-1, 0, 0}, 1));
+ exprs.push_back(G(lst{-1, 1,-1, 1, 0}, 1));
+ exprs.push_back(G(lst{-1, 1, 0,-1, 0}, 1));
+ exprs.push_back(G(lst{-1, 1, 1,-1, 0}, 1));
+ exprs.push_back(G(lst{ 0,-1, 1,-1, 0}, 1));
+ exprs.push_back(G(lst{ 0, 1, 1,-1, 0}, 1));
unsigned err = 0;
for (exvector::const_iterator ep = exprs.begin(); ep != exprs.end(); ++ep) {
try {
{
unsigned result = 0;
- matrix S(2, 2, lst(
+ matrix S(2, 2, lst{
1, 2,
3, 4
- )), T(2, 2, lst(
+ }), T(2, 2, lst{
1, 1,
2, -1
- )), R(2, 2, lst(
+ }), R(2, 2, lst{
27, 14,
36, 26
- ));
+ });
ex e = ((S + T) * (S + 2*T));
ex f = e.evalm();
ex e1, e2;
e1 = (1+x)*pow((2+x),2)*pow((3+x),3)*pow((4+x),4);
- e2 = sqrfree(expand(e1),lst(x));
+ e2 = sqrfree(expand(e1),lst{x});
if (e1 != e2) {
clog << "sqrfree(expand(" << e1 << ")) erroneously returned "
<< e2 << endl;
<< e2 << endl;
++result;
}
- e2 = sqrfree(expand(e1),lst(x));
+ e2 = sqrfree(expand(e1),lst{x});
if (e1 != e2) {
clog << "sqrfree(expand(" << e1 << "),[x]) erroneously returned "
<< e2 << endl;
++result;
}
- e2 = sqrfree(expand(e1),lst(y));
+ e2 = sqrfree(expand(e1),lst{y});
if (e1 != e2) {
clog << "sqrfree(expand(" << e1 << "),[y]) erroneously returned "
<< e2 << endl;
++result;
}
- e2 = sqrfree(expand(e1),lst(x,y));
+ e2 = sqrfree(expand(e1),lst{x,y});
if (e1 != e2) {
clog << "sqrfree(expand(" << e1 << "),[x,y]) erroneously returned "
<< e2 << endl;
// Read back expression from string
string x_as_string = s.str();
- ex x_again(x_as_string, lst(sym));
+ ex x_again(x_as_string, lst{sym});
// They should be equal
if (!x_again.is_equal(x)) {
return 1;
}
- ex e4 = e1.subs(lst(a==-1, b==-2.5));
+ ex e4 = e1.subs(lst{a==-1, b==-2.5});
if (!(is_exactly_a<power>(e4) &&
is_exactly_a<power>(e4.op(0)) &&
is_exactly_a<symbol>(e4.op(0).op(0)) &&
return 1;
}
- ex e5 = e1.subs(lst(a==-0.9, b==2.5));
+ ex e5 = e1.subs(lst{a==-0.9, b==2.5});
if (!(is_exactly_a<power>(e5) &&
is_exactly_a<symbol>(e5.op(0)) &&
is_exactly_a<numeric>(e5.op(1)) &&
return 1;
}
- ex e6 = e1.subs(lst(a==numeric(3)+numeric(5.3)*I, b==-5));
+ ex e6 = e1.subs(lst{a==numeric(3)+numeric(5.3)*I, b==-5});
if (!(is_exactly_a<power>(e6) &&
is_exactly_a<symbol>(e6.op(0)) &&
is_exactly_a<numeric>(e6.op(1)) &&
return 1;
}
- ex e5 = e1.subs(lst(a==3.2, b==3+numeric(5)*I));
+ ex e5 = e1.subs(lst{a==3.2, b==3+numeric(5)*I});
if (!(is_exactly_a<mul>(e5) &&
(e5.nops()==2) &&
is_exactly_a<power>(e5.op(0)) &&
return 1;
}
- ex e6 = e1.subs(lst(a==-3.2, b==3+numeric(5)*I));
+ ex e6 = e1.subs(lst{a==-3.2, b==3+numeric(5)*I});
if (!(is_exactly_a<mul>(e6) &&
(e6.nops()==2) &&
is_exactly_a<power>(e6.op(0)) &&
return 1;
}
- ex e7 = e1.subs(lst(a==3+numeric(5)*I, b==3.2));
+ ex e7 = e1.subs(lst{a==3+numeric(5)*I, b==3.2});
if (!(is_exactly_a<power>(e7) &&
is_exactly_a<mul>(e7.op(0)) &&
(e7.op(0).nops()==2) &&
}
ex det = m.determinant();
// The result should have been:
- ex cmp("-12*x2^2*x5^2*x4-12*x1*x5^2*x3^2-x5^3*x4^2-12*x1*x5^2*x4^2-12*x2*x5^2*x4^2-12*x3*x5^2*x4^2-x4^3*x5^2-36*x3*x1*x5^2*x4-36*x3*x1*x4^2*x5-36*x3*x2*x5^2*x4-36*x3*x2*x4^2*x5-2*x5^3*x4*x2-12*x3^2*x5^2*x4-12*x3^2*x4^2*x5-2*x5^3*x4*x3-2*x4^3*x5*x3-12*x1*x5^2*x2^2-36*x1*x5*x3^2*x4-36*x2*x5*x3^2*x4-x3^3*x5^2-x3^3*x4^2-2*x3^3*x5*x4-12*x2^2*x4^2*x5-12*x2*x5^2*x3^2-12*x2*x4^2*x3^2-12*x1*x4^2*x3^2-x3^2*x5^3-x3^2*x4^3-2*x4^3*x5*x2-2*x3*x5^3*x2-2*x3*x4^3*x2-2*x3^3*x5*x2-2*x3^3*x4*x2-2*x2^3*x5*x4-2*x2^3*x5*x3-2*x2^3*x4*x3-36*x2^2*x5*x4*x3-36*x2*x1*x5^2*x4-36*x2*x1*x4^2*x5-120*x2*x1*x5*x4*x3-36*x2*x1*x5^2*x3-36*x2*x1*x4^2*x3-36*x2*x1*x3^2*x5-36*x2*x1*x3^2*x4-12*x2^2*x5^2*x3-12*x2^2*x4^2*x3-12*x2^2*x3^2*x5-12*x2^2*x3^2*x4-2*x1^3*x4*x3-2*x1^3*x4*x2-2*x1^3*x3*x2-2*x1^3*x5*x2-36*x1^2*x5*x4*x3-36*x2*x1^2*x5*x4-36*x2*x3*x1^2*x5-36*x2*x3*x1^2*x4-x1^3*x5^2-x1^3*x4^2-x1^3*x3^2-x1^3*x2^2-x2^2*x5^3-x2^2*x4^3-x2^2*x3^3-12*x1*x4^2*x2^2-12*x1*x3^2*x2^2-12*x1^2*x5^2*x4-12*x1^2*x4^2*x5-12*x1^2*x5^2*x3-12*x1^2*x4^2*x3-12*x1^2*x3^2*x5-12*x1^2*x3^2*x4-12*x1^2*x5^2*x2-12*x1^2*x4^2*x2-12*x1^2*x3^2*x2-12*x1^2*x2^2*x5-12*x1^2*x2^2*x4-12*x1^2*x2^2*x3-2*x5^3*x4*x1-2*x4^3*x5*x1-2*x3*x5^3*x1-2*x3*x4^3*x1-2*x3^3*x5*x1-2*x3^3*x4*x1-2*x2*x5^3*x1-2*x2*x4^3*x1-2*x2*x3^3*x1-2*x2^3*x5*x1-2*x2^3*x4*x1-2*x2^3*x3*x1-2*x1^3*x5*x4-2*x1^3*x5*x3-36*x1*x5*x2^2*x4-36*x1*x5*x2^2*x3-36*x1*x4*x2^2*x3-x1^2*x5^3-x1^2*x4^3-x1^2*x3^3-x2^3*x5^2-x2^3*x4^2-x2^3*x3^2-x1^2*x2^3",lst(x1,x2,x3,x4,x5));
+ ex cmp("-12*x2^2*x5^2*x4-12*x1*x5^2*x3^2-x5^3*x4^2-12*x1*x5^2*x4^2-12*x2*x5^2*x4^2-12*x3*x5^2*x4^2-x4^3*x5^2-36*x3*x1*x5^2*x4-36*x3*x1*x4^2*x5-36*x3*x2*x5^2*x4-36*x3*x2*x4^2*x5-2*x5^3*x4*x2-12*x3^2*x5^2*x4-12*x3^2*x4^2*x5-2*x5^3*x4*x3-2*x4^3*x5*x3-12*x1*x5^2*x2^2-36*x1*x5*x3^2*x4-36*x2*x5*x3^2*x4-x3^3*x5^2-x3^3*x4^2-2*x3^3*x5*x4-12*x2^2*x4^2*x5-12*x2*x5^2*x3^2-12*x2*x4^2*x3^2-12*x1*x4^2*x3^2-x3^2*x5^3-x3^2*x4^3-2*x4^3*x5*x2-2*x3*x5^3*x2-2*x3*x4^3*x2-2*x3^3*x5*x2-2*x3^3*x4*x2-2*x2^3*x5*x4-2*x2^3*x5*x3-2*x2^3*x4*x3-36*x2^2*x5*x4*x3-36*x2*x1*x5^2*x4-36*x2*x1*x4^2*x5-120*x2*x1*x5*x4*x3-36*x2*x1*x5^2*x3-36*x2*x1*x4^2*x3-36*x2*x1*x3^2*x5-36*x2*x1*x3^2*x4-12*x2^2*x5^2*x3-12*x2^2*x4^2*x3-12*x2^2*x3^2*x5-12*x2^2*x3^2*x4-2*x1^3*x4*x3-2*x1^3*x4*x2-2*x1^3*x3*x2-2*x1^3*x5*x2-36*x1^2*x5*x4*x3-36*x2*x1^2*x5*x4-36*x2*x3*x1^2*x5-36*x2*x3*x1^2*x4-x1^3*x5^2-x1^3*x4^2-x1^3*x3^2-x1^3*x2^2-x2^2*x5^3-x2^2*x4^3-x2^2*x3^3-12*x1*x4^2*x2^2-12*x1*x3^2*x2^2-12*x1^2*x5^2*x4-12*x1^2*x4^2*x5-12*x1^2*x5^2*x3-12*x1^2*x4^2*x3-12*x1^2*x3^2*x5-12*x1^2*x3^2*x4-12*x1^2*x5^2*x2-12*x1^2*x4^2*x2-12*x1^2*x3^2*x2-12*x1^2*x2^2*x5-12*x1^2*x2^2*x4-12*x1^2*x2^2*x3-2*x5^3*x4*x1-2*x4^3*x5*x1-2*x3*x5^3*x1-2*x3*x4^3*x1-2*x3^3*x5*x1-2*x3^3*x4*x1-2*x2*x5^3*x1-2*x2*x4^3*x1-2*x2*x3^3*x1-2*x2^3*x5*x1-2*x2^3*x4*x1-2*x2^3*x3*x1-2*x1^3*x5*x4-2*x1^3*x5*x3-36*x1*x5*x2^2*x4-36*x1*x5*x2^2*x3-36*x1*x4*x2^2*x3-x1^2*x5^3-x1^2*x4^3-x1^2*x3^3-x2^3*x5^2-x2^3*x4^2-x2^3*x3^2-x1^2*x2^3",lst{x1,x2,x3,x4,x5});
if (det!=cmp) {
clog << "The determinant was miscalculated" << endl;
return 1;
symbol g("g");
symbol q1("q1"), q2("q2"), q3("q3"), q4("q4");
- ex ss1 = ex("(4*g*a22^3-g*a12*a21*a22^2-4*n22*a21*a22^2+4*n11*a21*a22^2+7*g*a12*a22^2+4*g^2*a22^2-4*n11*n22*a22^2+4*n11*a22^2+n22*a12*a21^2*a22-n11*a12*a21^2*a22-4*g*a21^2*a22-g*a12^2*a21*a22-5*g^2*a12*a21*a22+5*n11*n22*a12*a21*a22-7*n22*a12*a21*a22+2*n11*a12*a21*a22-4*g*a21*a22+3*g*a12^2*a22+3*g^2*a12*a22-3*n11*n22*a12*a22+3*n11*a12*a22+g*a12*a21^3+g^2*a12^2*a21^2-n11*n22*a12^2*a21^2+n22*a12^2*a21^2-2*g*a12*a21^2-3*g^2*a12^2*a21+3*n11*n22*a12^2*a21-3*n22*a12^2*a21-3*g*a12*a21)/(3*g*a12*a21*a22^2-3*n22*a21*a22^2+g*a12*a22^2-n22*a22^2+3*n11*a12*a21^2*a22-3*g*a21^2*a22+5*g*a12^2*a21*a22-5*n22*a12*a21*a22+4*n11*a12*a21*a22-4*g*a21*a22+g*a12^2*a22-n22*a12*a22+n11*a12*a22-g*a22+2*n11*a12^2*a21^2-2*g*a12*a21^2+2*g*a12^3*a21-2*n22*a12^2*a21+2*n11*a12^2*a21-2*g*a12*a21)",lst(g,a12,a21,a22,n11,n22));
+ ex ss1 = ex("(4*g*a22^3-g*a12*a21*a22^2-4*n22*a21*a22^2+4*n11*a21*a22^2+7*g*a12*a22^2+4*g^2*a22^2-4*n11*n22*a22^2+4*n11*a22^2+n22*a12*a21^2*a22-n11*a12*a21^2*a22-4*g*a21^2*a22-g*a12^2*a21*a22-5*g^2*a12*a21*a22+5*n11*n22*a12*a21*a22-7*n22*a12*a21*a22+2*n11*a12*a21*a22-4*g*a21*a22+3*g*a12^2*a22+3*g^2*a12*a22-3*n11*n22*a12*a22+3*n11*a12*a22+g*a12*a21^3+g^2*a12^2*a21^2-n11*n22*a12^2*a21^2+n22*a12^2*a21^2-2*g*a12*a21^2-3*g^2*a12^2*a21+3*n11*n22*a12^2*a21-3*n22*a12^2*a21-3*g*a12*a21)/(3*g*a12*a21*a22^2-3*n22*a21*a22^2+g*a12*a22^2-n22*a22^2+3*n11*a12*a21^2*a22-3*g*a21^2*a22+5*g*a12^2*a21*a22-5*n22*a12*a21*a22+4*n11*a12*a21*a22-4*g*a21*a22+g*a12^2*a22-n22*a12*a22+n11*a12*a22-g*a22+2*n11*a12^2*a21^2-2*g*a12*a21^2+2*g*a12^3*a21-2*n22*a12^2*a21+2*n11*a12^2*a21-2*g*a12*a21)",lst{g,a12,a21,a22,n11,n22});
- ex ss2 = ex("(4*g*a12*a22^2-4*n22*a22^2+4*a22^2-g*a12^2*a21*a22+n22*a12*a21*a22+4*n11*a12*a21*a22-5*a12*a21*a22-4*g*a21*a22+3*g*a12^2*a22-3*n22*a12*a22+3*a12*a22-n11*a12^2*a21^2+a12^2*a21^2+g*a12*a21^2+3*n11*a12^2*a21-3*a12^2*a21-3*g*a12*a21)/(2*g*a12*a22^2-2*n22*a22^2+g*a12^2*a21*a22-n22*a12*a21*a22+2*n11*a12*a21*a22-2*g*a21*a22+2*g*a12^2*a22-2*n22*a12*a22+2*n11*a12*a22-2*g*a22+n11*a12^2*a21^2-g*a12*a21^2+g*a12^3*a21-n22*a12^2*a21+n11*a12^2*a21-g*a12*a21)",lst(g,a12,a21,a22,n11,n22));
+ ex ss2 = ex("(4*g*a12*a22^2-4*n22*a22^2+4*a22^2-g*a12^2*a21*a22+n22*a12*a21*a22+4*n11*a12*a21*a22-5*a12*a21*a22-4*g*a21*a22+3*g*a12^2*a22-3*n22*a12*a22+3*a12*a22-n11*a12^2*a21^2+a12^2*a21^2+g*a12*a21^2+3*n11*a12^2*a21-3*a12^2*a21-3*g*a12*a21)/(2*g*a12*a22^2-2*n22*a22^2+g*a12^2*a21*a22-n22*a12*a21*a22+2*n11*a12*a21*a22-2*g*a21*a22+2*g*a12^2*a22-2*n22*a12*a22+2*n11*a12*a22-2*g*a22+n11*a12^2*a21^2-g*a12*a21^2+g*a12^3*a21-n22*a12^2*a21+n11*a12^2*a21-g*a12*a21)",lst{g,a12,a21,a22,n11,n22});
- ex ss3 = ex("(4*p21*a22^3-p21*a12*a21*a22^2-4*p22*a21*a22^2+4*p11*a21*a22^2+7*p21*a12*a22^2-4*p11*p22*a22^2+4*p12*p21*a22^2+4*p11*a22^2+p22*a12*a21^2*a22-p11*a12*a21^2*a22-4*p12*a21^2*a22-p21*a12^2*a21*a22+5*p11*p22*a12*a21*a22-7*p22*a12*a21*a22-5*p12*p21*a12*a21*a22+2*p11*a12*a21*a22-4*p12*a21*a22+3*p21*a12^2*a22-3*p11*p22*a12*a22+3*p12*p21*a12*a22+3*p11*a12*a22+p12*a12*a21^3-p11*p22*a12^2*a21^2+p22*a12^2*a21^2+p12*p21*a12^2*a21^2-2*p12*a12*a21^2+3*p11*p22*a12^2*a21-3*p22*a12^2*a21-3*p12*p21*a12^2*a21-3*p12*a12*a21)/(3*p21*a12*a21*a22^2-3*p22*a21*a22^2+p21*a12*a22^2-p22*a22^2+3*p11*a12*a21^2*a22-3*p12*a21^2*a22+5*p21*a12^2*a21*a22-5*p22*a12*a21*a22+4*p11*a12*a21*a22-4*p12*a21*a22+p21*a12^2*a22-p22*a12*a22+p11*a12*a22-p12*a22+2*p11*a12^2*a21^2-2*p12*a12*a21^2+2*p21*a12^3*a21-2*p22*a12^2*a21+2*p11*a12^2*a21-2*p12*a12*a21)",lst(a12,a21,a22,p11,p12,p21,p22));
+ ex ss3 = ex("(4*p21*a22^3-p21*a12*a21*a22^2-4*p22*a21*a22^2+4*p11*a21*a22^2+7*p21*a12*a22^2-4*p11*p22*a22^2+4*p12*p21*a22^2+4*p11*a22^2+p22*a12*a21^2*a22-p11*a12*a21^2*a22-4*p12*a21^2*a22-p21*a12^2*a21*a22+5*p11*p22*a12*a21*a22-7*p22*a12*a21*a22-5*p12*p21*a12*a21*a22+2*p11*a12*a21*a22-4*p12*a21*a22+3*p21*a12^2*a22-3*p11*p22*a12*a22+3*p12*p21*a12*a22+3*p11*a12*a22+p12*a12*a21^3-p11*p22*a12^2*a21^2+p22*a12^2*a21^2+p12*p21*a12^2*a21^2-2*p12*a12*a21^2+3*p11*p22*a12^2*a21-3*p22*a12^2*a21-3*p12*p21*a12^2*a21-3*p12*a12*a21)/(3*p21*a12*a21*a22^2-3*p22*a21*a22^2+p21*a12*a22^2-p22*a22^2+3*p11*a12*a21^2*a22-3*p12*a21^2*a22+5*p21*a12^2*a21*a22-5*p22*a12*a21*a22+4*p11*a12*a21*a22-4*p12*a21*a22+p21*a12^2*a22-p22*a12*a22+p11*a12*a22-p12*a22+2*p11*a12^2*a21^2-2*p12*a12*a21^2+2*p21*a12^3*a21-2*p22*a12^2*a21+2*p11*a12^2*a21-2*p12*a12*a21)",lst{a12,a21,a22,p11,p12,p21,p22});
- ex ss4 = ex("(4*p21*a12*a22^2-4*p22*a22^2+4*a22^2-p21*a12^2*a21*a22+p22*a12*a21*a22+4*p11*a12*a21*a22-5*a12*a21*a22-4*p12*a21*a22+3*p21*a12^2*a22-3*p22*a12*a22+3*a12*a22-p11*a12^2*a21^2+a12^2*a21^2+p12*a12*a21^2+3*p11*a12^2*a21-3*a12^2*a21-3*p12*a12*a21)/(2*p21*a12*a22^2-2*p22*a22^2+p21*a12^2*a21*a22-p22*a12*a21*a22+2*p11*a12*a21*a22-2*p12*a21*a22+2*p21*a12^2*a22-2*p22*a12*a22+2*p11*a12*a22-2*p12*a22+p11*a12^2*a21^2-p12*a12*a21^2+p21*a12^3*a21-p22*a12^2*a21+p11*a12^2*a21-p12*a12*a21)",lst(p11,p12,p21,p22,a12,a21,a22));
+ ex ss4 = ex("(4*p21*a12*a22^2-4*p22*a22^2+4*a22^2-p21*a12^2*a21*a22+p22*a12*a21*a22+4*p11*a12*a21*a22-5*a12*a21*a22-4*p12*a21*a22+3*p21*a12^2*a22-3*p22*a12*a22+3*a12*a22-p11*a12^2*a21^2+a12^2*a21^2+p12*a12*a21^2+3*p11*a12^2*a21-3*a12^2*a21-3*p12*a12*a21)/(2*p21*a12*a22^2-2*p22*a22^2+p21*a12^2*a21*a22-p22*a12*a21*a22+2*p11*a12*a21*a22-2*p12*a21*a22+2*p21*a12^2*a22-2*p22*a12*a22+2*p11*a12*a22-2*p12*a22+p11*a12^2*a21^2-p12*a12*a21^2+p21*a12^3*a21-p22*a12^2*a21+p11*a12^2*a21-p12*a12*a21)",lst{p11,p12,p21,p22,a12,a21,a22});
- ex res1 = ex("p11*p22*q1^2*q4^2-p12*p21*q1^2*q4^2-n22*p11*p22*q1*q4^2+2*n11*p11*p22*q1*q4^2-p11*p22*q1*q4^2+n22*p12*p21*q1*q4^2-2*n11*p12*p21*q1*q4^2+p12*p21*q1*q4^2+2*g^2*p11*p22*q4^2-2*n11*n22*p11*p22*q4^2+2*n22*p11*p22*q4^2+2*n11*p11*p22*q4^2-2*p11*p22*q4^2-2*g^2*p12*p21*q4^2+2*n11*n22*p12*p21*q4^2-2*n22*p12*p21*q4^2-2*n11*p12*p21*q4^2+2*p12*p21*q4^2-n11*p22*q1*q2*q3*q4+g*p21*q1*q2*q3*q4+g*p12*q1*q2*q3*q4-n22*p11*q1*q2*q3*q4-g^2*p22*q2*q3*q4+n11*n22*p22*q2*q3*q4-n11*p22*q2*q3*q4-2*g*p21*q2*q3*q4+g*p12*q2*q3*q4+2*g^2*p11*q2*q3*q4-2*n11*n22*p11*q2*q3*q4+2*n22*p11*q2*q3*q4-n11*p22*q1*q3*q4+p22*q1*q3*q4+g*p21*q1*q3*q4-2*g*p12*q1*q3*q4+2*n22*p11*q1*q3*q4-2*p11*q1*q3*q4-g^2*p22*q3*q4+n11*n22*p22*q3*q4-n22*p22*q3*q4-n11*p22*q3*q4+p22*q3*q4-4*g^2*p11*q3*q4+4*n11*n22*p11*q3*q4-4*n22*p11*q3*q4-4*n11*p11*q3*q4+4*p11*q3*q4+n22*p11*p22*q1*q2*q4-2*n11*p11*p22*q1*q2*q4+2*n11*p22*q1*q2*q4-n22*p12*p21*q1*q2*q4+2*n11*p12*p21*q1*q2*q4+g*p21*q1*q2*q4-2*g*p12*q1*q2*q4-n22*p11*q1*q2*q4-4*g^2*p11*p22*q2*q4+4*n11*n22*p11*p22*q2*q4-2*n22*p11*p22*q2*q4-2*n11*p11*p22*q2*q4+2*g^2*p22*q2*q4-2*n11*n22*p22*q2*q4+2*n11*p22*q2*q4+4*g^2*p12*p21*q2*q4-4*n11*n22*p12*p21*q2*q4+2*n22*p12*p21*q2*q4+2*n11*p12*p21*q2*q4-2*g*p21*q2*q4-2*g*p12*q2*q4+2*g^2*p11*q2*q4-2*n11*n22*p11*q2*q4+2*n22*p11*q2*q4-p11*p22*q1^2*q4-p22*q1^2*q4+p12*p21*q1^2*q4+2*p11*q1^2*q4-n22*p11*p22*q1*q4-4*n11*p11*p22*q1*q4+5*p11*p22*q1*q4+n22*p22*q1*q4-p22*q1*q4+n22*p12*p21*q1*q4+4*n11*p12*p21*q1*q4-5*p12*p21*q1*q4+g*p21*q1*q4+4*g*p12*q1*q4+4*n11*p11*q1*q4-4*p11*q1*q4-g^2*q2^2*q3^2+n11*n22*q2^2*q3^2+g^2*q2*q3^2-n11*n22*q2*q3^2-n22*q2*q3^2+2*n11*q2*q3^2+2*g^2*q3^2-2*n11*n22*q3^2+2*n22*q3^2+2*n11*q3^2-2*q3^2+g^2*p22*q2^2*q3-n11*n22*p22*q2^2*q3-2*g^2*p11*q2^2*q3+2*n11*n22*p11*q2^2*q3+g^2*q2^2*q3-n11*n22*q2^2*q3+2*n11*p22*q1*q2*q3-2*g*p21*q1*q2*q3+g*p12*q1*q2*q3-n22*p11*q1*q2*q3+n22*q1*q2*q3-2*n11*q1*q2*q3+g^2*p22*q2*q3-n11*n22*p22*q2*q3+n22*p22*q2*q3+4*g*p21*q2*q3+g*p12*q2*q3+4*g^2*p11*q2*q3-4*n11*n22*p11*q2*q3+4*n11*p11*q2*q3-5*g^2*q2*q3+5*n11*n22*q2*q3-n22*q2*q3-4*n11*q2*q3+2*n11*p22*q1*q3-2*p22*q1*q3-2*g*p21*q1*q3-2*g*p12*q1*q3+2*n22*p11*q1*q3-2*p11*q1*q3-2*n22*q1*q3-2*n11*q1*q3+4*q1*q3+2*g^2*p11*p22*q2^2-2*n11*n22*p11*p22*q2^2-2*g^2*p22*q2^2+2*n11*n22*p22*q2^2-2*g^2*p12*p21*q2^2+2*n11*n22*p12*p21*q2^2-2*g^2*p11*q2^2+2*n11*n22*p11*q2^2+2*g^2*q2^2-2*n11*n22*q2^2+n22*p11*p22*q1*q2+4*n11*p11*p22*q1*q2-n22*p22*q1*q2-4*n11*p22*q1*q2-n22*p12*p21*q1*q2-4*n11*p12*p21*q1*q2-n22*p11*q1*q2-4*n11*p11*q1*q2+n22*q1*q2+4*n11*q1*q2-2*p11*p22*q1^2+2*p22*q1^2+2*p12*p21*q1^2+2*p11*q1^2-2*q1^2",lst(p11,p12,p21,p22,n11,n22,g,q1,q2,q3,q4));
- ex result = res1.subs(lst(q1==ss1, q2==ss2, q3==ss3, q4==ss4));
+ ex res1 = ex("p11*p22*q1^2*q4^2-p12*p21*q1^2*q4^2-n22*p11*p22*q1*q4^2+2*n11*p11*p22*q1*q4^2-p11*p22*q1*q4^2+n22*p12*p21*q1*q4^2-2*n11*p12*p21*q1*q4^2+p12*p21*q1*q4^2+2*g^2*p11*p22*q4^2-2*n11*n22*p11*p22*q4^2+2*n22*p11*p22*q4^2+2*n11*p11*p22*q4^2-2*p11*p22*q4^2-2*g^2*p12*p21*q4^2+2*n11*n22*p12*p21*q4^2-2*n22*p12*p21*q4^2-2*n11*p12*p21*q4^2+2*p12*p21*q4^2-n11*p22*q1*q2*q3*q4+g*p21*q1*q2*q3*q4+g*p12*q1*q2*q3*q4-n22*p11*q1*q2*q3*q4-g^2*p22*q2*q3*q4+n11*n22*p22*q2*q3*q4-n11*p22*q2*q3*q4-2*g*p21*q2*q3*q4+g*p12*q2*q3*q4+2*g^2*p11*q2*q3*q4-2*n11*n22*p11*q2*q3*q4+2*n22*p11*q2*q3*q4-n11*p22*q1*q3*q4+p22*q1*q3*q4+g*p21*q1*q3*q4-2*g*p12*q1*q3*q4+2*n22*p11*q1*q3*q4-2*p11*q1*q3*q4-g^2*p22*q3*q4+n11*n22*p22*q3*q4-n22*p22*q3*q4-n11*p22*q3*q4+p22*q3*q4-4*g^2*p11*q3*q4+4*n11*n22*p11*q3*q4-4*n22*p11*q3*q4-4*n11*p11*q3*q4+4*p11*q3*q4+n22*p11*p22*q1*q2*q4-2*n11*p11*p22*q1*q2*q4+2*n11*p22*q1*q2*q4-n22*p12*p21*q1*q2*q4+2*n11*p12*p21*q1*q2*q4+g*p21*q1*q2*q4-2*g*p12*q1*q2*q4-n22*p11*q1*q2*q4-4*g^2*p11*p22*q2*q4+4*n11*n22*p11*p22*q2*q4-2*n22*p11*p22*q2*q4-2*n11*p11*p22*q2*q4+2*g^2*p22*q2*q4-2*n11*n22*p22*q2*q4+2*n11*p22*q2*q4+4*g^2*p12*p21*q2*q4-4*n11*n22*p12*p21*q2*q4+2*n22*p12*p21*q2*q4+2*n11*p12*p21*q2*q4-2*g*p21*q2*q4-2*g*p12*q2*q4+2*g^2*p11*q2*q4-2*n11*n22*p11*q2*q4+2*n22*p11*q2*q4-p11*p22*q1^2*q4-p22*q1^2*q4+p12*p21*q1^2*q4+2*p11*q1^2*q4-n22*p11*p22*q1*q4-4*n11*p11*p22*q1*q4+5*p11*p22*q1*q4+n22*p22*q1*q4-p22*q1*q4+n22*p12*p21*q1*q4+4*n11*p12*p21*q1*q4-5*p12*p21*q1*q4+g*p21*q1*q4+4*g*p12*q1*q4+4*n11*p11*q1*q4-4*p11*q1*q4-g^2*q2^2*q3^2+n11*n22*q2^2*q3^2+g^2*q2*q3^2-n11*n22*q2*q3^2-n22*q2*q3^2+2*n11*q2*q3^2+2*g^2*q3^2-2*n11*n22*q3^2+2*n22*q3^2+2*n11*q3^2-2*q3^2+g^2*p22*q2^2*q3-n11*n22*p22*q2^2*q3-2*g^2*p11*q2^2*q3+2*n11*n22*p11*q2^2*q3+g^2*q2^2*q3-n11*n22*q2^2*q3+2*n11*p22*q1*q2*q3-2*g*p21*q1*q2*q3+g*p12*q1*q2*q3-n22*p11*q1*q2*q3+n22*q1*q2*q3-2*n11*q1*q2*q3+g^2*p22*q2*q3-n11*n22*p22*q2*q3+n22*p22*q2*q3+4*g*p21*q2*q3+g*p12*q2*q3+4*g^2*p11*q2*q3-4*n11*n22*p11*q2*q3+4*n11*p11*q2*q3-5*g^2*q2*q3+5*n11*n22*q2*q3-n22*q2*q3-4*n11*q2*q3+2*n11*p22*q1*q3-2*p22*q1*q3-2*g*p21*q1*q3-2*g*p12*q1*q3+2*n22*p11*q1*q3-2*p11*q1*q3-2*n22*q1*q3-2*n11*q1*q3+4*q1*q3+2*g^2*p11*p22*q2^2-2*n11*n22*p11*p22*q2^2-2*g^2*p22*q2^2+2*n11*n22*p22*q2^2-2*g^2*p12*p21*q2^2+2*n11*n22*p12*p21*q2^2-2*g^2*p11*q2^2+2*n11*n22*p11*q2^2+2*g^2*q2^2-2*n11*n22*q2^2+n22*p11*p22*q1*q2+4*n11*p11*p22*q1*q2-n22*p22*q1*q2-4*n11*p22*q1*q2-n22*p12*p21*q1*q2-4*n11*p12*p21*q1*q2-n22*p11*q1*q2-4*n11*p11*q1*q2+n22*q1*q2+4*n11*q1*q2-2*p11*p22*q1^2+2*p22*q1^2+2*p12*p21*q1^2+2*p11*q1^2-2*q1^2",lst{p11,p12,p21,p22,n11,n22,g,q1,q2,q3,q4});
+ ex result = res1.subs(lst{q1==ss1, q2==ss2, q3==ss3, q4==ss4});
ex normalresult = normal(result);
if (!normalresult.is_zero()) {
clog << "Normalization should have returned 0." << endl;
{
unsigned result = 0;
const symbol a("a"), b("b");
- ex p[10] = {ex("a",lst(a,b)),
- ex("b",lst(a,b)),
- ex("a+b",lst(a,b)),
- ex("a^2+a*b+b^2",lst(a,b)),
- ex("a^3+a^2*b-a*b^2+b^3",lst(a,b)),
- ex("a^4+a^3*b+a^2*b^2+a*b^3+b^4",lst(a,b)),
- ex("a^5+a^4*b+a^3*b^2-a^2*b^3+a*b^4+b^5",lst(a,b)),
- ex("a^6+a^5*b+a^4*b^2+a^3*b^3+a^2*b^4+a*b^5+b^6",lst(a,b)),
- ex("a^7+a^6*b+a^5*b^2+a^4*b^3-a^3*b^4+a^2*b^5+a*b^6+b^7",lst(a,b)),
- ex("a^8+a^7*b+a^6*b^2+a^5*b^3+a^4*b^4+a^3*b^5+a^2*b^6+a*b^7+b^8",lst(a,b))
+ ex p[10] = {ex("a",lst{a,b}),
+ ex("b",lst{a,b}),
+ ex("a+b",lst{a,b}),
+ ex("a^2+a*b+b^2",lst{a,b}),
+ ex("a^3+a^2*b-a*b^2+b^3",lst{a,b}),
+ ex("a^4+a^3*b+a^2*b^2+a*b^3+b^4",lst{a,b}),
+ ex("a^5+a^4*b+a^3*b^2-a^2*b^3+a*b^4+b^5",lst{a,b}),
+ ex("a^6+a^5*b+a^4*b^2+a^3*b^3+a^2*b^4+a*b^5+b^6",lst{a,b}),
+ ex("a^7+a^6*b+a^5*b^2+a^4*b^3-a^3*b^4+a^2*b^5+a*b^6+b^7",lst{a,b}),
+ ex("a^8+a^7*b+a^6*b^2+a^5*b^3+a^4*b^4+a^3*b^5+a^2*b^6+a*b^7+b^8",lst{a,b})
};
// construct Toeplitz matrix (diagonal structure: [[x,y,z],[y,x,y],[z,y,x]]):
cout << "Enter an expression containing 'x' and/or 'y': ";
cin >> s;
// Expression now in expr
- ex expr(s, lst(x,y));
+ ex expr(s, lst{x,y});
cout << "start integration of " << expr << " ..." << endl;
// Optionally, compile with custom compiler flags:
// setenv("CXXFLAGS", "-O3 -fomit-frame-pointer -ffast-math", 1);
- compile_ex(lst(expr), lst(x,y), fp);
+ compile_ex(lst{expr}, lst{x,y}, fp);
// Starting VEGAS
// By invocation of compile() the expression in expr is converted into the
the same type to GiNaC methods such as @code{subs()} and some @code{matrix}
constructors, so you should have a basic understanding of them.
-Lists can be constructed by assigning a comma-separated sequence of
-expressions:
+Lists can be constructed from an initializer list of expressions:
@example
@{
symbol x("x"), y("y");
lst l;
- l = x, 2, y, x+y;
+ l = @{x, 2, y, x+y@};
// now, l is a list holding the expressions 'x', '2', 'y', and 'x+y',
// in that order
...
@end example
-There are also constructors that allow direct creation of lists of up to
-16 expressions, which is often more convenient but slightly less efficient:
-
-@example
- ...
- // This produces the same list 'l' as above:
- // lst l(x, 2, y, x+y);
- // lst l = lst(x, 2, y, x+y);
- ...
-@end example
-
Use the @code{nops()} method to determine the size (number of expressions) of
a list and the @code{op()} method or the @code{[]} operator to access
individual elements:
cout << M2 << endl;
// -> [[a,0],[0,b]]
- cout << matrix(2, 2, lst(a, 0, 0, b)) << endl;
+ cout << matrix(2, 2, lst@{a, 0, 0, b@}) << endl;
// -> [[a,0],[0,b]]
- cout << lst_to_matrix(lst(lst(a, 0), lst(0, b))) << endl;
+ cout << lst_to_matrix(lst@{lst@{a, 0@}, lst@{0, b@}@}) << endl;
// -> [[a,0],[0,b]]
- cout << diag_matrix(lst(a, b)) << endl;
+ cout << diag_matrix(lst@{a, b@}) << endl;
// -> [[a,0],[0,b]]
cout << unit_matrix(3) << endl;
dirac_gamma(mu.toggle_variance()) *
(dirac_slash(l, D) + m * dirac_ONE());
e = dirac_trace(e).simplify_indexed(sp);
- e = e.collect(lst(l, ldotq, m));
+ e = e.collect(lst@{l, ldotq, m@});
cout << e << endl;
// -> (8-4*D)*l^2+(8-4*D)*ldotq+4*D*m^2
@}
...
idx i(symbol("i"), 4);
realsymbol s("s");
- ex M = diag_matrix(lst(1, -1, 0, s));
+ ex M = diag_matrix(lst@{1, -1, 0, s@});
ex e = clifford_unit(i, M);
ex e0 = e.subs(i == 0);
ex e1 = e.subs(i == 1);
...
idx i(symbol("i"), 4);
realsymbol s("s");
- ex M = diag_matrix(lst(1, -1, 0, s));
- ex e0 = lst_to_clifford(lst(1, 0, 0, 0), i, M);
- ex e1 = lst_to_clifford(lst(0, 1, 0, 0), i, M);
- ex e2 = lst_to_clifford(lst(0, 0, 1, 0), i, M);
- ex e3 = lst_to_clifford(lst(0, 0, 0, 1), i, M);
+ ex M = diag_matrix(lst@{1, -1, 0, s@});
+ ex e0 = lst_to_clifford(lst@{1, 0, 0, 0@}, i, M);
+ ex e1 = lst_to_clifford(lst@{0, 1, 0, 0@}, i, M);
+ ex e2 = lst_to_clifford(lst@{0, 0, 1, 0@}, i, M);
+ ex e3 = lst_to_clifford(lst@{0, 0, 0, 1@}, i, M);
...
@}
@end example
@example
@{
symbol A("A"), B("B"), C("C");
- ex e = lst(lst(A, B), C);
+ ex e = lst@{lst@{A, B@}, C@};
std::copy(e.begin(), e.end(),
std::ostream_iterator<ex>(cout, "\n"));
// -> 73
ex e2 = x*y + x;
- cout << "e2(-2, 4) = " << e2.subs(lst(x == -2, y == 4)) << endl;
+ cout << "e2(-2, 4) = " << e2.subs(lst@{x == -2, y == 4@}) << endl;
// -> -10
@}
@end example
If you specify multiple substitutions, they are performed in parallel, so e.g.
-@code{subs(lst(x == y, y == x))} exchanges @samp{x} and @samp{y}.
+@code{subs(lst@{x == y, y == x@})} exchanges @samp{x} and @samp{y}.
The second form of @code{subs()} takes an @code{exmap} object which is a
pair associative container that maps expressions to expressions (currently
symbol x("x"), y("y");
ex e2 = x*y + x;
- cout << "e2(-2, 4) = " << e2.subs(lst(x, y), lst(-2, 4)) << endl;
+ cout << "e2(-2, 4) = " << e2.subs(lst@{x, y@}, lst@{-2, 4@}) << endl;
@}
@end example
@example
(x*y*sin(y)).is_polynomial(x) // Returns true.
-(x*y*sin(y)).is_polynomial(lst(x,y)) // Returns false.
+(x*y*sin(y)).is_polynomial(lst@{x,y@}) // Returns false.
@end example
@subsection Expanding and collecting
Square-free decomposition is available in GiNaC:
@example
-ex sqrfree(const ex & a, const lst & l = lst());
+ex sqrfree(const ex & a, const lst & l = lst@{@});
@end example
Here is an example that by the way illustrates how the exact form of the
result may slightly depend on the order of differentiation, calling for
symbol x("x"), y("y");
ex BiVarPol = expand(pow(2-2*y,3) * pow(1+x*y,2) * pow(x-2*y,2) * (x+y));
- cout << sqrfree(BiVarPol, lst(x,y)) << endl;
+ cout << sqrfree(BiVarPol, lst@{x,y@}) << endl;
// -> 8*(1-y)^3*(y*x^2-2*y+x*(1-2*y^2))^2*(y+x)
- cout << sqrfree(BiVarPol, lst(y,x)) << endl;
+ cout << sqrfree(BiVarPol, lst@{y,x@}) << endl;
// -> 8*(1-y)^3*(-y*x^2+2*y+x*(-1+2*y^2))^2*(y+x)
cout << sqrfree(BiVarPol) << endl;
cout << ex(indexed(A, i, j)).symmetrize() << endl;
// -> 1/2*A.j.i+1/2*A.i.j
- cout << ex(indexed(A, i, j, k)).antisymmetrize(lst(i, j)) << endl;
+ cout << ex(indexed(A, i, j, k)).antisymmetrize(lst@{i, j@}) << endl;
// -> -1/2*A.j.i.k+1/2*A.i.j.k
- cout << ex(lst(a, b, c)).symmetrize_cyclic(lst(a, b, c)) << endl;
+ cout << ex(lst@{a, b, c@}).symmetrize_cyclic(lst@{a, b, c@}) << endl;
// -> 1/3*@{a,b,c@}+1/3*@{b,c,a@}+1/3*@{c,a,b@}
@}
@end example
will be interpreted as the sequence of signs for the corresponding indices
@code{m} or the sign of the imaginary part for the
corresponding arguments @code{a}, it must contain 1 or -1, e.g.
-@code{zeta(lst(3,4), lst(-1,1))} means
+@code{zeta(lst@{3,4@}, lst@{-1,1@})} means
@tex
$\zeta(\overline{3},4)$
@end tex
@command{zeta(\overline@{3@},4)}
@end ifnottex
and
-@code{G(lst(a,b), lst(-1,1), c)} means
+@code{G(lst@{a,b@}, lst@{-1,1@}, c)} means
@tex
$G(a-0\epsilon,b+0\epsilon;c)$.
@end tex
@end ifnottex
The definition of @code{H} allows indices to be 0, 1 or -1 (in expanded notation) or equally to
be any integer (in compact notation). With GiNaC expanded and compact notation can be mixed,
-e.g. @code{lst(0,0,-1,0,1,0,0)}, @code{lst(0,0,-1,2,0,0)} and @code{lst(-3,2,0,0)} are equivalent as
+e.g. @code{lst@{0,0,-1,0,1,0,0@}}, @code{lst@{0,0,-1,2,0,0@}} and @code{lst@{-3,2,0,0@}} are equivalent as
indices. The anonymous evaluator @code{eval()} tries to reduce the functions, if possible, to
the least-generic multiple polylogarithm. If all arguments are unit, it returns @code{zeta}.
Arguments equal to zero get considered, too. Riemann's zeta function @code{zeta} (with depth one)
return simplify_indexed(indexed(metric.op(0)*_ex1_2, i, j) + indexed(metric.op(0)*_ex1_2, j, i));
}
} else {
- return metric.subs(lst(metric.op(1) == i, metric.op(2) == j), subs_options::no_pattern);
+ return metric.subs(lst{metric.op(1) == i, metric.op(2) == j}, subs_options::no_pattern);
}
} else {
exvector indices = metric.get_free_indices();
if (symmetrised)
- return _ex1_2*simplify_indexed(metric.subs(lst(indices[0] == i, indices[1] == j), subs_options::no_pattern)
- + metric.subs(lst(indices[0] == j, indices[1] == i), subs_options::no_pattern));
+ return _ex1_2*simplify_indexed(metric.subs(lst{indices[0] == i, indices[1] == j}, subs_options::no_pattern)
+ + metric.subs(lst{indices[0] == j, indices[1] == i}, subs_options::no_pattern));
else
- return metric.subs(lst(indices[0] == i, indices[1] == j), subs_options::no_pattern);
+ return metric.subs(lst{indices[0] == i, indices[1] == j}, subs_options::no_pattern);
}
}
return e;
// Substitute gammaL/R and expand product, if necessary
- ex e_expanded = e.subs(lst(
+ ex e_expanded = e.subs(lst{
dirac_gammaL(rl) == (dirac_ONE(rl)-dirac_gamma5(rl))/2,
dirac_gammaR(rl) == (dirac_ONE(rl)+dirac_gamma5(rl))/2
- ), subs_options::no_pattern).expand();
+ }, subs_options::no_pattern).expand();
if (!is_a<ncmul>(e_expanded))
return dirac_trace(e_expanded, rls, trONE);
ex curridx_toggle = is_a<varidx>(curridx)
? ex_to<varidx>(curridx).toggle_variance()
: curridx;
- S = S * e.op(j).subs(lst(curridx == ival,
- curridx_toggle == ival), subs_options::no_pattern);
+ S = S * e.op(j).subs(lst{curridx == ival, curridx_toggle == ival},
+ subs_options::no_pattern);
}
} else
S = S * e.op(j);
#ifdef __GNUC__
#define unlikely(cond) __builtin_expect((cond), 0)
#define likely(cond) __builtin_expect((cond), 1)
+#define deprecated __attribute__ ((deprecated));
#else
#define unlikely(cond) (cond)
#define likely(cond) (cond)
+#define deprecated
#endif
#ifdef _MSC_VER
#include "print.h"
#include "archive.h"
#include "assertion.h"
+#include "compiler.h"
#include <algorithm>
#include <iterator>
container_storage() {}
container_storage(size_t n, const ex & e) : seq(n, e) {}
+ container_storage(std::initializer_list<ex> il) : seq(il) {}
template <class In>
container_storage(In b, In e) : seq(b, e) {}
setflag(get_default_flags());
}
- explicit container(const ex & p1)
- : container_storage<C>(1, p1)
+ container(std::initializer_list<ex> il)
+ : container_storage<C>(il)
{
setflag(get_default_flags());
}
- container(const ex & p1, const ex & p2)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 2);
- this->seq.push_back(p1); this->seq.push_back(p2);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 3);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 4);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 5);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4); this->seq.push_back(p5);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 6);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4); this->seq.push_back(p5); this->seq.push_back(p6);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6,
- const ex & p7)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 7);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4); this->seq.push_back(p5); this->seq.push_back(p6);
- this->seq.push_back(p7);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 8);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4); this->seq.push_back(p5); this->seq.push_back(p6);
- this->seq.push_back(p7); this->seq.push_back(p8);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8, const ex & p9)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 9);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4); this->seq.push_back(p5); this->seq.push_back(p6);
- this->seq.push_back(p7); this->seq.push_back(p8); this->seq.push_back(p9);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8, const ex & p9,
- const ex & p10)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 10);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4); this->seq.push_back(p5); this->seq.push_back(p6);
- this->seq.push_back(p7); this->seq.push_back(p8); this->seq.push_back(p9);
- this->seq.push_back(p10);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8, const ex & p9,
- const ex & p10, const ex & p11)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 11);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4); this->seq.push_back(p5); this->seq.push_back(p6);
- this->seq.push_back(p7); this->seq.push_back(p8); this->seq.push_back(p9);
- this->seq.push_back(p10); this->seq.push_back(p11);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8, const ex & p9,
- const ex & p10, const ex & p11, const ex & p12)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 12);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4); this->seq.push_back(p5); this->seq.push_back(p6);
- this->seq.push_back(p7); this->seq.push_back(p8); this->seq.push_back(p9);
- this->seq.push_back(p10); this->seq.push_back(p11); this->seq.push_back(p12);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8, const ex & p9,
- const ex & p10, const ex & p11, const ex & p12,
- const ex & p13)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 13);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4); this->seq.push_back(p5); this->seq.push_back(p6);
- this->seq.push_back(p7); this->seq.push_back(p8); this->seq.push_back(p9);
- this->seq.push_back(p10); this->seq.push_back(p11); this->seq.push_back(p12);
- this->seq.push_back(p13);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8, const ex & p9,
- const ex & p10, const ex & p11, const ex & p12,
- const ex & p13, const ex & p14)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 14);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4); this->seq.push_back(p5); this->seq.push_back(p6);
- this->seq.push_back(p7); this->seq.push_back(p8); this->seq.push_back(p9);
- this->seq.push_back(p10); this->seq.push_back(p11); this->seq.push_back(p12);
- this->seq.push_back(p13); this->seq.push_back(p14);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8, const ex & p9,
- const ex & p10, const ex & p11, const ex & p12,
- const ex & p13, const ex & p14, const ex & p15)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 15);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4); this->seq.push_back(p5); this->seq.push_back(p6);
- this->seq.push_back(p7); this->seq.push_back(p8); this->seq.push_back(p9);
- this->seq.push_back(p10); this->seq.push_back(p11); this->seq.push_back(p12);
- this->seq.push_back(p13); this->seq.push_back(p14); this->seq.push_back(p15);
- }
-
- container(const ex & p1, const ex & p2, const ex & p3,
- const ex & p4, const ex & p5, const ex & p6,
- const ex & p7, const ex & p8, const ex & p9,
- const ex & p10, const ex & p11, const ex & p12,
- const ex & p13, const ex & p14, const ex & p15,
- const ex & p16)
- {
- setflag(get_default_flags());
- this->reserve(this->seq, 16);
- this->seq.push_back(p1); this->seq.push_back(p2); this->seq.push_back(p3);
- this->seq.push_back(p4); this->seq.push_back(p5); this->seq.push_back(p6);
- this->seq.push_back(p7); this->seq.push_back(p8); this->seq.push_back(p9);
- this->seq.push_back(p10); this->seq.push_back(p11); this->seq.push_back(p12);
- this->seq.push_back(p13); this->seq.push_back(p14); this->seq.push_back(p15);
- this->seq.push_back(p16);
- }
+ explicit container(const ex & p1) deprecated;
+ container(const ex & p1, const ex & p2) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10, const ex & p11) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10, const ex & p11, const ex & p12) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10, const ex & p11, const ex & p12, const ex & p13) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10, const ex & p11, const ex & p12, const ex & p13, const ex & p14) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10, const ex & p11, const ex & p12, const ex & p13, const ex & p14, const ex & p15) deprecated;
+ container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10, const ex & p11, const ex & p12, const ex & p13, const ex & p14, const ex & p15, const ex & p16) deprecated;
// First step of initialization of container with a comma-separated
// sequence of expressions. Subsequent steps are handled by
// container_init<>::operator,().
- container_init<ex, STLT> operator=(const ex & x)
- {
- this->seq.push_back(x);
- return container_init<ex, STLT>(this->seq);
- }
+ container_init<ex, STLT> operator=(const ex & x) deprecated;
// functions overriding virtual functions from base classes
public:
setflag(get_default_flags());
}
+/** Deprecatd constructors (prefer initializer list) */
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1)
+ : container_storage<C>(1, p1) { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2)
+ : container_storage<C>{p1, p2} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3)
+ : container_storage<C>{p1, p2, p3} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4)
+ : container_storage<C>{p1, p2, p3, p4} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5)
+ : container_storage<C>{p1, p2, p3, p4, p5} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6)
+ : container_storage<C>{p1, p2, p3, p4, p5, p6} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7)
+ : container_storage<C>{p1, p2, p3, p4, p5, p6, p7} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8)
+ : container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9)
+ : container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10)
+ : container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10, const ex & p11)
+ : container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10, const ex & p11, const ex & p12)
+ : container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10, const ex & p11, const ex & p12, const ex & p13)
+ : container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10, const ex & p11, const ex & p12, const ex & p13, const ex & p14)
+ : container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10, const ex & p11, const ex & p12, const ex & p13, const ex & p14, const ex & p15)
+ : container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15} { setflag(get_default_flags()); }
+template <template <class T, class = std::allocator<T>> class C>
+container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
+ const ex & p9, const ex & p10, const ex & p11, const ex & p12, const ex & p13, const ex & p14, const ex & p15, const ex & p16)
+ : container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16} { setflag(get_default_flags()); }
+
+template <template <class T, class = std::allocator<T>> class C>
+container_init<ex, typename container_storage<C>::STLT> container<C>::operator=(const ex & x)
+{
+ this->seq.push_back(x);
+ return container_init<ex, typename container_storage<C>::STLT>(this->seq);
+}
template <template <class T, class = std::allocator<T>> class C>
void container<C>::do_print(const print_context & c, unsigned level) const
/** Substitute objects in an expression (syntactic substitution) and return
* the result as a new expression. There are two valid types of
* replacement arguments: 1) a relational like object==ex and 2) a list of
- * relationals lst(object1==ex1,object2==ex2,...). */
+ * relationals lst{object1==ex1,object2==ex2,...}. */
ex ex::subs(const ex & e, unsigned options) const
{
if (e.info(info_flags::relation_equal)) {
void compile_ex(const ex& expr, const symbol& sym, FUNCP_1P& fp, const std::string filename)
{
symbol x("x");
- ex expr_with_x = expr.subs(lst(sym==x));
+ ex expr_with_x = expr.subs(lst{sym==x});
std::ofstream ofs;
std::string unique_filename = filename;
void compile_ex(const ex& expr, const symbol& sym1, const symbol& sym2, FUNCP_2P& fp, const std::string filename)
{
symbol x("x"), y("y");
- ex expr_with_xy = expr.subs(lst(sym1==x, sym2==y));
+ ex expr_with_xy = expr.subs(lst{sym1==x, sym2==y});
std::ofstream ofs;
std::string unique_filename = filename;
* @see expairseq::split_ex_to_pair() */
ex expairseq::recombine_pair_to_ex(const expair &p) const
{
- return lst(p.rest,p.coeff);
+ return lst{p.rest, p.coeff};
}
bool expairseq::expair_needs_further_processing(epp it)
}
else {
lst res;
- return lst();
+ return lst{};
}
}
ex vn = pp.collect(x).lcoeff(x);
ex vnlst;
if ( is_a<numeric>(vn) ) {
- vnlst = lst(vn);
+ vnlst = lst{vn};
}
else {
ex vnfactors = factor(vn);
// try Hensel lifting
ex res = hensel_multivar(pp, x, epv, prime, l, modfactors, C);
- if ( res != lst() ) {
+ if ( res != lst{} ) {
ex result = cont * unit;
for ( size_t i=0; i<res.nops(); ++i ) {
result *= res.op(i).content(x) * res.op(i).unit(x);
// the following lines have been generated for max. @maxargs@ parameters
+++ for N in range(1, maxargs + 1):
function::function(unsigned ser, @seq('const ex & param%(n)d', N)@)
- : exprseq(@seq('param%(n)d', N)@), serial(ser)
+ : exprseq{@seq('param%(n)d', N)@}, serial(ser)
{
}
---
// other constructors
//////////
-indexed::indexed(const ex & b) : inherited(b), symtree(not_symmetric())
+indexed::indexed(const ex & b) : inherited{b}, symtree(not_symmetric())
{
validate();
}
-indexed::indexed(const ex & b, const ex & i1) : inherited(b, i1), symtree(not_symmetric())
+indexed::indexed(const ex & b, const ex & i1) : inherited{b, i1}, symtree(not_symmetric())
{
validate();
}
-indexed::indexed(const ex & b, const ex & i1, const ex & i2) : inherited(b, i1, i2), symtree(not_symmetric())
+indexed::indexed(const ex & b, const ex & i1, const ex & i2) : inherited{b, i1, i2}, symtree(not_symmetric())
{
validate();
}
-indexed::indexed(const ex & b, const ex & i1, const ex & i2, const ex & i3) : inherited(b, i1, i2, i3), symtree(not_symmetric())
+indexed::indexed(const ex & b, const ex & i1, const ex & i2, const ex & i3) : inherited{b, i1, i2, i3}, symtree(not_symmetric())
{
validate();
}
-indexed::indexed(const ex & b, const ex & i1, const ex & i2, const ex & i3, const ex & i4) : inherited(b, i1, i2, i3, i4), symtree(not_symmetric())
+indexed::indexed(const ex & b, const ex & i1, const ex & i2, const ex & i3, const ex & i4) : inherited{b, i1, i2, i3, i4}, symtree(not_symmetric())
{
validate();
}
-indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2) : inherited(b, i1, i2), symtree(symm)
+indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2) : inherited{b, i1, i2}, symtree(symm)
{
validate();
}
-indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2, const ex & i3) : inherited(b, i1, i2, i3), symtree(symm)
+indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2, const ex & i3) : inherited{b, i1, i2, i3}, symtree(symm)
{
validate();
}
-indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2, const ex & i3, const ex & i4) : inherited(b, i1, i2, i3, i4), symtree(symm)
+indexed::indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2, const ex & i3, const ex & i4) : inherited{b, i1, i2, i3, i4}, symtree(symm)
{
validate();
}
-indexed::indexed(const ex & b, const exvector & v) : inherited(b), symtree(not_symmetric())
+indexed::indexed(const ex & b, const exvector & v) : inherited{b}, symtree(not_symmetric())
{
seq.insert(seq.end(), v.begin(), v.end());
validate();
}
-indexed::indexed(const ex & b, const symmetry & symm, const exvector & v) : inherited(b), symtree(symm)
+indexed::indexed(const ex & b, const symmetry & symm, const exvector & v) : inherited{b}, symtree(symm)
{
seq.insert(seq.end(), v.begin(), v.end());
validate();
/*
* N.B. we don't want to use
*
- * e = e.subs(lst(
+ * e = e.subs(lst{
* *it2 == ex_to<varidx>(*it2).toggle_variance(),
* ex_to<varidx>(*it2).toggle_variance() == *it2
- * ), subs_options::no_pattern);
+ * }, subs_options::no_pattern);
*
* since this can trigger non-trivial repositioning of indices,
* e.g. due to non-trivial symmetry properties of e, thus
exvector common_indices;
set_intersection(va.begin(), va.end(), vb.begin(), vb.end(), std::back_insert_iterator<exvector>(common_indices), ex_is_less());
if (common_indices.empty()) {
- return lst(lst(), lst());
+ return lst{lst{}, lst{}};
} else {
exvector new_indices, old_indices;
old_indices.reserve(2*common_indices.size());
}
++ip;
}
- return lst(lst(old_indices.begin(), old_indices.end()), lst(new_indices.begin(), new_indices.end()));
+ return lst{lst(old_indices.begin(), old_indices.end()), lst(new_indices.begin(), new_indices.end())};
}
}
for (int i=0; i < idim; i++) {
if (subs_idx && is_a<varidx>(nu)) {
ex other = ex_to<varidx>(nu).toggle_variance();
- en += result.subs(lst(
+ en += result.subs(lst{
nu == idx(i, idim),
other == idx(i, idim)
- ));
+ });
} else {
en += result.subs( nu.op(0) == i );
}
if (eqns.info(info_flags::relation_equal)) {
if (!symbols.info(info_flags::symbol))
throw(std::invalid_argument("lsolve(): 2nd argument must be a symbol"));
- const ex sol = lsolve(lst(eqns),lst(symbols));
+ const ex sol = lsolve(lst{eqns}, lst{symbols});
GINAC_ASSERT(sol.nops()==1);
GINAC_ASSERT(is_exactly_a<relational>(sol.op(0)));
} catch (const std::runtime_error & e) {
// Probably singular matrix or otherwise overdetermined system:
// It is consistent to return an empty list
- return lst();
+ return lst{};
}
GINAC_ASSERT(solution.cols()==1);
GINAC_ASSERT(solution.rows()==symbols.nops());
- // return list of equations of the form lst(var1==sol1,var2==sol2,...)
+ // return list of equations of the form lst{var1==sol1,var2==sol2,...}
lst sollist;
for (size_t i=0; i<symbols.nops(); i++)
sollist.append(symbols.op(i)==solution(i,0));
*
* The functions are:
* classical polylogarithm Li(n,x)
- * multiple polylogarithm Li(lst(m_1,...,m_k),lst(x_1,...,x_k))
- * G(lst(a_1,...,a_k),y) or G(lst(a_1,...,a_k),lst(s_1,...,s_k),y)
+ * multiple polylogarithm Li(lst{m_1,...,m_k},lst{x_1,...,x_k})
+ * G(lst{a_1,...,a_k},y) or G(lst{a_1,...,a_k},lst{s_1,...,s_k},y)
* Nielsen's generalized polylogarithm S(n,p,x)
- * harmonic polylogarithm H(m,x) or H(lst(m_1,...,m_k),x)
- * multiple zeta value zeta(m) or zeta(lst(m_1,...,m_k))
- * alternating Euler sum zeta(m,s) or zeta(lst(m_1,...,m_k),lst(s_1,...,s_k))
+ * harmonic polylogarithm H(m,x) or H(lst{m_1,...,m_k},x)
+ * multiple zeta value zeta(m) or zeta(lst{m_1,...,m_k})
+ * alternating Euler sum zeta(m,s) or zeta(lst{m_1,...,m_k},lst{s_1,...,s_k})
*
* Some remarks:
*
if ((!y.info(info_flags::numeric)) || (!y.info(info_flags::positive))) {
return G(x_, y).hold();
}
- lst x = is_a<lst>(x_) ? ex_to<lst>(x_) : lst(x_);
+ lst x = is_a<lst>(x_) ? ex_to<lst>(x_) : lst{x_};
if (x.nops() == 0) {
return _ex1;
}
if ((!y.info(info_flags::numeric)) || (!y.info(info_flags::positive))) {
return G(x_, y).hold();
}
- lst x = is_a<lst>(x_) ? ex_to<lst>(x_) : lst(x_);
+ lst x = is_a<lst>(x_) ? ex_to<lst>(x_) : lst{x_};
if (x.nops() == 0) {
return _ex1;
}
if ((!y.info(info_flags::numeric)) || (!y.info(info_flags::positive))) {
return G(x_, s_, y).hold();
}
- lst x = is_a<lst>(x_) ? ex_to<lst>(x_) : lst(x_);
- lst s = is_a<lst>(s_) ? ex_to<lst>(s_) : lst(s_);
+ lst x = is_a<lst>(x_) ? ex_to<lst>(x_) : lst{x_};
+ lst s = is_a<lst>(s_) ? ex_to<lst>(s_) : lst{s_};
if (x.nops() != s.nops()) {
return G(x_, s_, y).hold();
}
if ((!y.info(info_flags::numeric)) || (!y.info(info_flags::positive))) {
return G(x_, s_, y).hold();
}
- lst x = is_a<lst>(x_) ? ex_to<lst>(x_) : lst(x_);
- lst s = is_a<lst>(s_) ? ex_to<lst>(s_) : lst(s_);
+ lst x = is_a<lst>(x_) ? ex_to<lst>(x_) : lst{x_};
+ lst s = is_a<lst>(s_) ? ex_to<lst>(s_) : lst{s_};
if (x.nops() != s.nops()) {
return G(x_, s_, y).hold();
}
if (is_a<lst>(m_)) {
m = ex_to<lst>(m_);
} else {
- m = lst(m_);
+ m = lst{m_};
}
lst x;
if (is_a<lst>(x_)) {
x = ex_to<lst>(x_);
} else {
- x = lst(x_);
+ x = lst{x_};
}
c.s << "\\mathrm{Li}_{";
lst::const_iterator itm = m.begin();
return _ex0;
}
if (x == 1) {
- lst m(n+1);
+ lst m{n+1};
for (int i=ex_to<numeric>(p).to_int()-1; i>0; i--) {
m.append(1);
}
if (is_a<lst>(e.op(0))) {
parameter = ex_to<lst>(e.op(0));
} else {
- parameter = lst(e.op(0));
+ parameter = lst{e.op(0)};
}
ex arg = e.op(1);
if (is_a<lst>(e.op(0))) {
parameter = ex_to<lst>(e.op(0));
} else {
- parameter = lst(e.op(0));
+ parameter = lst{e.op(0)};
}
lst m;
if (is_a<lst>(e.op(0))) {
parameter = ex_to<lst>(e.op(0));
} else {
- parameter = lst(e.op(0));
+ parameter = lst{e.op(0)};
}
ex arg = e.op(1);
if (parameter.op(parameter.nops()-1) == 0) {
if (h2nops > 1) {
hlong = ex_to<lst>(h2.op(0));
} else {
- hlong = h2.op(0).op(0);
+ hlong = lst{h2.op(0).op(0)};
}
}
for (std::size_t i=0; i<=hlong.nops(); i++) {
ex addzeta = convert_H_to_zeta(newparameter);
return e.subs(h == (addzeta-H(newparameter, h.op(1)).hold())).expand();
} else {
- return e * (-H(lst(ex(0)),1/arg).hold());
+ return e * (-H(lst{ex(0)},1/arg).hold());
}
}
newparameter.prepend(1);
return e.subs(h == H(newparameter, h.op(1)).hold());
} else {
- return e * H(lst(ex(1)),1-arg).hold();
+ return e * H(lst{ex(1)},1-arg).hold();
}
}
ex addzeta = convert_H_to_zeta(newparameter);
return e.subs(h == (addzeta-H(newparameter, h.op(1)).hold())).expand();
} else {
- ex addzeta = convert_H_to_zeta(lst(ex(-1)));
- return (e * (addzeta - H(lst(ex(-1)),1/arg).hold())).expand();
+ ex addzeta = convert_H_to_zeta(lst{ex(-1)});
+ return (e * (addzeta - H(lst{ex(-1)},1/arg).hold())).expand();
}
}
newparameter.prepend(-1);
return e.subs(h == H(newparameter, h.op(1)).hold()).expand();
} else {
- return (e * H(lst(ex(-1)),(1-arg)/(1+arg)).hold()).expand();
+ return (e * H(lst{ex(-1)},(1-arg)/(1+arg)).hold()).expand();
}
}
newparameter.prepend(1);
return e.subs(h == H(newparameter, h.op(1)).hold()).expand();
} else {
- return (e * H(lst(ex(1)),(1-arg)/(1+arg)).hold()).expand();
+ return (e * H(lst{ex(1)},(1-arg)/(1+arg)).hold()).expand();
}
}
// leading one
map_trafo_H_1mx recursion;
map_trafo_H_mult unify;
- ex res = H(lst(ex(1)), arg).hold() * H(newparameter, arg).hold();
+ ex res = H(lst{ex(1)}, arg).hold() * H(newparameter, arg).hold();
std::size_t firstzero = 0;
while (parameter.op(firstzero) == 1) {
firstzero++;
}
if (allthesame) {
map_trafo_H_mult unify;
- return unify((pow(H(lst(ex(-1)),1/arg).hold() - H(lst(ex(0)),1/arg).hold(), parameter.nops())
+ return unify((pow(H(lst{ex(-1)},1/arg).hold() - H(lst{ex(0)},1/arg).hold(), parameter.nops())
/ factorial(parameter.nops())).expand());
}
} else {
}
if (allthesame) {
map_trafo_H_mult unify;
- return unify((pow(H(lst(ex(1)),1/arg).hold() + H(lst(ex(0)),1/arg).hold() + H_polesign, parameter.nops())
+ return unify((pow(H(lst{ex(1)},1/arg).hold() + H(lst{ex(0)},1/arg).hold() + H_polesign, parameter.nops())
/ factorial(parameter.nops())).expand());
}
}
// leading one
map_trafo_H_1overx recursion;
map_trafo_H_mult unify;
- ex res = H(lst(ex(1)), arg).hold() * H(newparameter, arg).hold();
+ ex res = H(lst{ex(1)}, arg).hold() * H(newparameter, arg).hold();
std::size_t firstzero = 0;
while (parameter.op(firstzero) == 1) {
firstzero++;
}
if (allthesame) {
map_trafo_H_mult unify;
- return unify((pow(-H(lst(ex(1)),(1-arg)/(1+arg)).hold() - H(lst(ex(-1)),(1-arg)/(1+arg)).hold(), parameter.nops())
+ return unify((pow(-H(lst{ex(1)},(1-arg)/(1+arg)).hold() - H(lst{ex(-1)},(1-arg)/(1+arg)).hold(), parameter.nops())
/ factorial(parameter.nops())).expand());
}
} else if (parameter.op(0) == -1) {
}
if (allthesame) {
map_trafo_H_mult unify;
- return unify((pow(log(2) - H(lst(ex(-1)),(1-arg)/(1+arg)).hold(), parameter.nops())
+ return unify((pow(log(2) - H(lst{ex(-1)},(1-arg)/(1+arg)).hold(), parameter.nops())
/ factorial(parameter.nops())).expand());
}
} else {
}
if (allthesame) {
map_trafo_H_mult unify;
- return unify((pow(-log(2) - H(lst(ex(0)),(1-arg)/(1+arg)).hold() + H(lst(ex(-1)),(1-arg)/(1+arg)).hold(), parameter.nops())
+ return unify((pow(-log(2) - H(lst{ex(0)},(1-arg)/(1+arg)).hold() + H(lst{ex(-1)},(1-arg)/(1+arg)).hold(), parameter.nops())
/ factorial(parameter.nops())).expand());
}
}
// leading one
map_trafo_H_1mxt1px recursion;
map_trafo_H_mult unify;
- ex res = H(lst(ex(1)), arg).hold() * H(newparameter, arg).hold();
+ ex res = H(lst{ex(1)}, arg).hold() * H(newparameter, arg).hold();
std::size_t firstzero = 0;
while (parameter.op(firstzero) == 1) {
firstzero++;
if (is_a<lst>(m_)) {
m = ex_to<lst>(m_);
} else {
- m = lst(m_);
+ m = lst{m_};
}
if (m.nops() == 0) {
return _ex1;
if (is_a<lst>(m_)) {
m = ex_to<lst>(m_);
} else {
- m = lst(m_);
+ m = lst{m_};
}
ex mb = *m.begin();
if (mb > _ex1) {
if (is_a<lst>(m_)) {
m = ex_to<lst>(m_);
} else {
- m = lst(m_);
+ m = lst{m_};
}
c.s << "\\mathrm{H}_{";
lst::const_iterator itm = m.begin();
if (is_a<lst>(m)) {
return filter2(filter(H(m, x).hold()));
} else {
- return filter2(filter(H(lst(m), x).hold()));
+ return filter2(filter(H(lst{m}, x).hold()));
}
}
if (is_a<lst>(m_)) {
m = ex_to<lst>(m_);
} else {
- m = lst(m_);
+ m = lst{m_};
}
lst s;
if (is_a<lst>(s_)) {
s = ex_to<lst>(s_);
} else {
- s = lst(s_);
+ s = lst{s_};
}
c.s << "\\zeta(";
lst::const_iterator itm = m.begin();
// public
-ncmul::ncmul(const ex & lh, const ex & rh) : inherited(lh,rh)
+ncmul::ncmul(const ex & lh, const ex & rh) : inherited{lh,rh}
{
}
-ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3) : inherited(f1,f2,f3)
+ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3) : inherited{f1,f2,f3}
{
}
ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3,
- const ex & f4) : inherited(f1,f2,f3,f4)
+ const ex & f4) : inherited{f1,f2,f3,f4}
{
}
ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3,
- const ex & f4, const ex & f5) : inherited(f1,f2,f3,f4,f5)
+ const ex & f4, const ex & f5) : inherited{f1,f2,f3,f4,f5}
{
}
ncmul::ncmul(const ex & f1, const ex & f2, const ex & f3,
- const ex & f4, const ex & f5, const ex & f6) : inherited(f1,f2,f3,f4,f5,f6)
+ const ex & f4, const ex & f5, const ex & f6) : inherited{f1,f2,f3,f4,f5,f6}
{
}
ex basic::normal(exmap & repl, exmap & rev_lookup, int level) const
{
if (nops() == 0)
- return (new lst(replace_with_symbol(*this, repl, rev_lookup), _ex1))->setflag(status_flags::dynallocated);
+ return (new lst{replace_with_symbol(*this, repl, rev_lookup), _ex1})->setflag(status_flags::dynallocated);
else {
if (level == 1)
- return (new lst(replace_with_symbol(*this, repl, rev_lookup), _ex1))->setflag(status_flags::dynallocated);
+ return (new lst{replace_with_symbol(*this, repl, rev_lookup), _ex1})->setflag(status_flags::dynallocated);
else if (level == -max_recursion_level)
throw(std::runtime_error("max recursion level reached"));
else {
normal_map_function map_normal(level - 1);
- return (new lst(replace_with_symbol(map(map_normal), repl, rev_lookup), _ex1))->setflag(status_flags::dynallocated);
+ return (new lst{replace_with_symbol(map(map_normal), repl, rev_lookup), _ex1})->setflag(status_flags::dynallocated);
}
}
}
* @see ex::normal */
ex symbol::normal(exmap & repl, exmap & rev_lookup, int level) const
{
- return (new lst(*this, _ex1))->setflag(status_flags::dynallocated);
+ return (new lst{*this, _ex1})->setflag(status_flags::dynallocated);
}
}
// Denominator is always a real integer (see numeric::denom())
- return (new lst(numex, denom()))->setflag(status_flags::dynallocated);
+ return (new lst{numex, denom()})->setflag(status_flags::dynallocated);
}
// Handle trivial case where denominator is 1
if (den.is_equal(_ex1))
- return (new lst(num, den))->setflag(status_flags::dynallocated);
+ return (new lst{num, den})->setflag(status_flags::dynallocated);
// Handle special cases where numerator or denominator is 0
if (num.is_zero())
- return (new lst(num, _ex1))->setflag(status_flags::dynallocated);
+ return (new lst{num, _ex1})->setflag(status_flags::dynallocated);
if (den.expand().is_zero())
throw(std::overflow_error("frac_cancel: division by zero in frac_cancel"));
// Return result as list
//std::clog << " returns num = " << num << ", den = " << den << ", pre_factor = " << pre_factor << std::endl;
- return (new lst(num * pre_factor.numer(), den * pre_factor.denom()))->setflag(status_flags::dynallocated);
+ return (new lst{num * pre_factor.numer(), den * pre_factor.denom()})->setflag(status_flags::dynallocated);
}
ex add::normal(exmap & repl, exmap & rev_lookup, int level) const
{
if (level == 1)
- return (new lst(replace_with_symbol(*this, repl, rev_lookup), _ex1))->setflag(status_flags::dynallocated);
+ return (new lst{replace_with_symbol(*this, repl, rev_lookup), _ex1})->setflag(status_flags::dynallocated);
else if (level == -max_recursion_level)
throw(std::runtime_error("max recursion level reached"));
ex mul::normal(exmap & repl, exmap & rev_lookup, int level) const
{
if (level == 1)
- return (new lst(replace_with_symbol(*this, repl, rev_lookup), _ex1))->setflag(status_flags::dynallocated);
+ return (new lst{replace_with_symbol(*this, repl, rev_lookup), _ex1})->setflag(status_flags::dynallocated);
else if (level == -max_recursion_level)
throw(std::runtime_error("max recursion level reached"));
ex power::normal(exmap & repl, exmap & rev_lookup, int level) const
{
if (level == 1)
- return (new lst(replace_with_symbol(*this, repl, rev_lookup), _ex1))->setflag(status_flags::dynallocated);
+ return (new lst{replace_with_symbol(*this, repl, rev_lookup), _ex1})->setflag(status_flags::dynallocated);
else if (level == -max_recursion_level)
throw(std::runtime_error("max recursion level reached"));
if (n_exponent.info(info_flags::positive)) {
// (a/b)^n -> {a^n, b^n}
- return (new lst(power(n_basis.op(0), n_exponent), power(n_basis.op(1), n_exponent)))->setflag(status_flags::dynallocated);
+ return (new lst{power(n_basis.op(0), n_exponent), power(n_basis.op(1), n_exponent)})->setflag(status_flags::dynallocated);
} else if (n_exponent.info(info_flags::negative)) {
// (a/b)^-n -> {b^n, a^n}
- return (new lst(power(n_basis.op(1), -n_exponent), power(n_basis.op(0), -n_exponent)))->setflag(status_flags::dynallocated);
+ return (new lst{power(n_basis.op(1), -n_exponent), power(n_basis.op(0), -n_exponent)})->setflag(status_flags::dynallocated);
}
} else {
if (n_exponent.info(info_flags::positive)) {
// (a/b)^x -> {sym((a/b)^x), 1}
- return (new lst(replace_with_symbol(power(n_basis.op(0) / n_basis.op(1), n_exponent), repl, rev_lookup), _ex1))->setflag(status_flags::dynallocated);
+ return (new lst{replace_with_symbol(power(n_basis.op(0) / n_basis.op(1), n_exponent), repl, rev_lookup), _ex1})->setflag(status_flags::dynallocated);
} else if (n_exponent.info(info_flags::negative)) {
if (n_basis.op(1).is_equal(_ex1)) {
// a^-x -> {1, sym(a^x)}
- return (new lst(_ex1, replace_with_symbol(power(n_basis.op(0), -n_exponent), repl, rev_lookup)))->setflag(status_flags::dynallocated);
+ return (new lst{_ex1, replace_with_symbol(power(n_basis.op(0), -n_exponent), repl, rev_lookup)})->setflag(status_flags::dynallocated);
} else {
// (a/b)^-x -> {sym((b/a)^x), 1}
- return (new lst(replace_with_symbol(power(n_basis.op(1) / n_basis.op(0), -n_exponent), repl, rev_lookup), _ex1))->setflag(status_flags::dynallocated);
+ return (new lst{replace_with_symbol(power(n_basis.op(1) / n_basis.op(0), -n_exponent), repl, rev_lookup), _ex1})->setflag(status_flags::dynallocated);
}
}
}
// (a/b)^x -> {sym((a/b)^x, 1}
- return (new lst(replace_with_symbol(power(n_basis.op(0) / n_basis.op(1), n_exponent), repl, rev_lookup), _ex1))->setflag(status_flags::dynallocated);
+ return (new lst{replace_with_symbol(power(n_basis.op(0) / n_basis.op(1), n_exponent), repl, rev_lookup), _ex1})->setflag(status_flags::dynallocated);
}
newseq.push_back(expair(restexp, it.coeff));
}
ex n = pseries(relational(var,point), std::move(newseq));
- return (new lst(replace_with_symbol(n, repl, rev_lookup), _ex1))->setflag(status_flags::dynallocated);
+ return (new lst{replace_with_symbol(n, repl, rev_lookup), _ex1})->setflag(status_flags::dynallocated);
}
| '[' matrix ']' {$$ = lst_to_matrix(ex_to<lst>($2));}
;
-exprseq : exp {$$ = exprseq($1);}
+exprseq : exp {$$ = exprseq{$1};}
| exprseq ',' exp {exprseq es(ex_to<exprseq>($1)); $$ = es.append($3);}
;
| list {$$ = $1;}
;
-list : exp {$$ = lst($1);}
+list : exp {$$ = lst{$1};}
| list ',' exp {lst l(ex_to<lst>($1)); $$ = l.append($3);}
;
-matrix : '[' row ']' {$$ = lst($2);}
+matrix : '[' row ']' {$$ = lst{$2};}
| matrix ',' '[' row ']' {lst l(ex_to<lst>($1)); $$ = l.append($4);}
;
-row : exp {$$ = lst($1);}
+row : exp {$$ = lst{$1};}
| row ',' exp {lst l(ex_to<lst>($1)); $$ = l.append($3);}
;