X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Finifcns.cpp;h=1fcba692b5796a46f64992f4871e62e222f9be84;hp=0daa97989abf8260202a0db99cfb572f576379ec;hb=05c47b615d0d309d4868c688cd26f68376fa4277;hpb=7cad9b41c97f0b042ba4af8080e82c8ad4804560 diff --git a/ginac/inifcns.cpp b/ginac/inifcns.cpp index 0daa9798..1fcba692 100644 --- a/ginac/inifcns.cpp +++ b/ginac/inifcns.cpp @@ -29,8 +29,6 @@ #include "lst.h" #include "matrix.h" #include "mul.h" -#include "ncmul.h" -#include "numeric.h" #include "power.h" #include "relational.h" #include "pseries.h" @@ -49,13 +47,13 @@ static ex abs_evalf(const ex & arg) TYPECHECK(arg,numeric) END_TYPECHECK(abs(arg)) - return abs(ex_to_numeric(arg)); + return abs(ex_to(arg)); } static ex abs_eval(const ex & arg) { if (is_ex_exactly_of_type(arg, numeric)) - return abs(ex_to_numeric(arg)); + return abs(ex_to(arg)); else return abs(arg).hold(); } @@ -74,16 +72,17 @@ static ex csgn_evalf(const ex & arg) TYPECHECK(arg,numeric) END_TYPECHECK(csgn(arg)) - return csgn(ex_to_numeric(arg)); + return csgn(ex_to(arg)); } static ex csgn_eval(const ex & arg) { if (is_ex_exactly_of_type(arg, numeric)) - return csgn(ex_to_numeric(arg)); + return csgn(ex_to(arg)); - else if (is_ex_exactly_of_type(arg, mul)) { - numeric oc = ex_to_numeric(arg.op(arg.nops()-1)); + else if (is_ex_of_type(arg, mul) && + is_ex_of_type(arg.op(arg.nops()-1),numeric)) { + numeric oc = ex_to(arg.op(arg.nops()-1)); if (oc.is_real()) { if (oc > 0) // csgn(42*x) -> csgn(x) @@ -101,7 +100,7 @@ static ex csgn_eval(const ex & arg) return -csgn(I*arg/oc).hold(); } } - + return csgn(arg).hold(); } @@ -112,7 +111,7 @@ static ex csgn_series(const ex & arg, { const ex arg_pt = arg.subs(rel); if (arg_pt.info(info_flags::numeric) - && ex_to_numeric(arg_pt).real().is_zero() + && ex_to(arg_pt).real().is_zero() && !(options & series_options::suppress_branchcut)) throw (std::domain_error("csgn_series(): on imaginary axis")); @@ -137,9 +136,9 @@ static ex eta_evalf(const ex & x, const ex & y) TYPECHECK(y,numeric) END_TYPECHECK(eta(x,y)) - numeric xim = imag(ex_to_numeric(x)); - numeric yim = imag(ex_to_numeric(y)); - numeric xyim = imag(ex_to_numeric(x*y)); + numeric xim = imag(ex_to(x)); + numeric yim = imag(ex_to(y)); + numeric xyim = imag(ex_to(x*y)); return evalf(I/4*Pi)*((csgn(-xim)+1)*(csgn(-yim)+1)*(csgn(xyim)+1)-(csgn(xim)+1)*(csgn(yim)+1)*(csgn(-xyim)+1)); } @@ -148,9 +147,9 @@ static ex eta_eval(const ex & x, const ex & y) if (is_ex_exactly_of_type(x, numeric) && is_ex_exactly_of_type(y, numeric)) { // don't call eta_evalf here because it would call Pi.evalf()! - numeric xim = imag(ex_to_numeric(x)); - numeric yim = imag(ex_to_numeric(y)); - numeric xyim = imag(ex_to_numeric(x*y)); + numeric xim = imag(ex_to(x)); + numeric yim = imag(ex_to(y)); + numeric xyim = imag(ex_to(x*y)); return (I/4)*Pi*((csgn(-xim)+1)*(csgn(-yim)+1)*(csgn(xyim)+1)-(csgn(xim)+1)*(csgn(yim)+1)*(csgn(-xyim)+1)); } @@ -165,9 +164,9 @@ static ex eta_series(const ex & arg1, { const ex arg1_pt = arg1.subs(rel); const ex arg2_pt = arg2.subs(rel); - if (ex_to_numeric(arg1_pt).imag().is_zero() || - ex_to_numeric(arg2_pt).imag().is_zero() || - ex_to_numeric(arg1_pt*arg2_pt).imag().is_zero()) { + if (ex_to(arg1_pt).imag().is_zero() || + ex_to(arg2_pt).imag().is_zero() || + ex_to(arg1_pt*arg2_pt).imag().is_zero()) { throw (std::domain_error("eta_series(): on discontinuity")); } epvector seq; @@ -191,7 +190,7 @@ static ex Li2_evalf(const ex & x) TYPECHECK(x,numeric) END_TYPECHECK(Li2(x)) - return Li2(ex_to_numeric(x)); // -> numeric Li2(numeric) + return Li2(ex_to(x)); // -> numeric Li2(numeric) } static ex Li2_eval(const ex & x) @@ -290,7 +289,7 @@ static ex Li2_series(const ex &x, const relational &rel, int order, unsigned opt } // third special case: x real, >=1 (branch cut) if (!(options & series_options::suppress_branchcut) && - ex_to_numeric(x_pt).is_real() && ex_to_numeric(x_pt)>1) { + ex_to(x_pt).is_real() && ex_to(x_pt)>1) { // method: // This is the branch cut: assemble the primitive series manually // and then add the corresponding complex step function. @@ -345,7 +344,7 @@ static ex factorial_evalf(const ex & x) static ex factorial_eval(const ex & x) { if (is_ex_exactly_of_type(x, numeric)) - return factorial(ex_to_numeric(x)); + return factorial(ex_to(x)); else return factorial(x).hold(); } @@ -365,7 +364,7 @@ static ex binomial_evalf(const ex & x, const ex & y) static ex binomial_eval(const ex & x, const ex &y) { if (is_ex_exactly_of_type(x, numeric) && is_ex_exactly_of_type(y, numeric)) - return binomial(ex_to_numeric(x), ex_to_numeric(y)); + return binomial(ex_to(x), ex_to(y)); else return binomial(x, y).hold(); } @@ -472,17 +471,17 @@ ex lsolve(const ex &eqns, const ex &symbols) ex eq = eqns.op(r).op(0)-eqns.op(r).op(1); // lhs-rhs==0 ex linpart = eq; for (unsigned c=0; c(symbols.op(c)),1); linpart -= co*symbols.op(c); - sys.set(r,c,co); + sys(r,c) = co; } linpart = linpart.expand(); - rhs.set(r,0,-linpart); + rhs(r,0) = -linpart; } // test if system is linear and fill vars matrix for (unsigned i=0; i