* Implementation of GiNaC's initially known functions. */
/*
- * GiNaC Copyright (C) 1999-2015 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2016 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
case info_flags::prime:
case info_flags::crational_polynomial:
case info_flags::rational_function:
- case info_flags::algebraic:
case info_flags::positive:
case info_flags::negative:
case info_flags::nonnegative:
else
prodseq.push_back(abs(*i));
}
- return (new mul(prodseq))->setflag(status_flags::dynallocated | status_flags::expanded);
+ return dynallocate<mul>(prodseq).setflag(status_flags::expanded);
}
if (options & expand_options::expand_function_args)
{
if ((is_a<numeric>(exp) && ex_to<numeric>(exp).is_even()) || exp.info(info_flags::even)) {
if (arg.info(info_flags::real) || arg.is_equal(arg.conjugate()))
- return power(arg, exp);
+ return pow(arg, exp);
else
- return power(arg, exp/2)*power(arg.conjugate(), exp/2);
+ return pow(arg, exp/2) * pow(arg.conjugate(), exp/2);
} else
return power(abs(arg), exp).hold();
}
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));
// determined by the secant between the values xx[0] and xx[1].
// Don't set the secant_weight to one because that could disturb
// the convergence in some corner cases!
- static const double secant_weight = 0.984375; // == 63/64 < 1
+ constexpr double secant_weight = 0.984375; // == 63/64 < 1
numeric xxmid = (1-secant_weight)*0.5*(xx[0]+xx[1])
+ secant_weight*(xx[0]+fx[0]*(xx[0]-xx[1])/(fx[1]-fx[0]));
ex fxmid_ = f.subs(x == xxmid).evalf();