]> www.ginac.de Git - ginac.git/blobdiff - ginac/inifcns.cpp
introduced new class for constructing symmetry tree definitions
[ginac.git] / ginac / inifcns.cpp
index 9ce90672050007a2f76729a7a1561c97557af339..e2714cf2ccbd98b1c49e7c68cab18ac45e3a1d49 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's initially known functions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2001 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
 #include "lst.h"
 #include "matrix.h"
 #include "mul.h"
-#include "ncmul.h"
-#include "numeric.h"
 #include "power.h"
 #include "relational.h"
 #include "pseries.h"
 #include "symbol.h"
 #include "utils.h"
 
-#ifndef NO_NAMESPACE_GINAC
 namespace GiNaC {
-#endif // ndef NO_NAMESPACE_GINAC
 
 //////////
 // absolute value
@@ -84,7 +80,8 @@ static ex csgn_eval(const ex & arg)
        if (is_ex_exactly_of_type(arg, numeric))
                return csgn(ex_to_numeric(arg));
        
-       else if (is_ex_exactly_of_type(arg, mul)) {
+       else if (is_ex_of_type(arg, mul) &&
+                is_ex_of_type(arg.op(arg.nops()-1),numeric)) {
                numeric oc = ex_to_numeric(arg.op(arg.nops()-1));
                if (oc.is_real()) {
                        if (oc > 0)
@@ -103,7 +100,7 @@ static ex csgn_eval(const ex & arg)
                                return -csgn(I*arg/oc).hold();
                }
        }
-   
+       
        return csgn(arg).hold();
 }
 
@@ -114,7 +111,8 @@ 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_numeric(arg_pt).real().is_zero()
+           && !(options & series_options::suppress_branchcut))
                throw (std::domain_error("csgn_series(): on imaginary axis"));
        
        epvector seq;
@@ -178,7 +176,8 @@ static ex eta_series(const ex & arg1,
 
 REGISTER_FUNCTION(eta, eval_func(eta_eval).
                        evalf_func(eta_evalf).
-                       series_func(eta_series));
+                       series_func(eta_series).
+                       latex_name("\\eta"));
 
 
 //////////
@@ -316,7 +315,8 @@ static ex Li2_series(const ex &x, const relational &rel, int order, unsigned opt
 REGISTER_FUNCTION(Li2, eval_func(Li2_eval).
                        evalf_func(Li2_evalf).
                        derivative_func(Li2_deriv).
-                       series_func(Li2_series));
+                       series_func(Li2_series).
+                       latex_name("\\mbox{Li}_2"));
 
 //////////
 // trilogarithm
@@ -329,7 +329,8 @@ static ex Li3_eval(const ex & x)
        return Li3(x).hold();
 }
 
-REGISTER_FUNCTION(Li3, eval_func(Li3_eval));
+REGISTER_FUNCTION(Li3, eval_func(Li3_eval).
+                       latex_name("\\mbox{Li}_3"));
 
 //////////
 // factorial
@@ -405,7 +406,8 @@ static ex Order_series(const ex & x, const relational & r, int order, unsigned o
 // Differentiation is handled in function::derivative because of its special requirements
 
 REGISTER_FUNCTION(Order, eval_func(Order_eval).
-                         series_func(Order_series));
+                         series_func(Order_series).
+                         latex_name("\\mathcal{O}"));
 
 //////////
 // Inert partial differentiation operator
@@ -471,15 +473,15 @@ ex lsolve(const ex &eqns, const ex &symbols)
                for (unsigned c=0; c<symbols.nops(); c++) {
                        ex co = eq.coeff(ex_to_symbol(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<symbols.nops(); i++) {
-               vars.set(i,0,symbols.op(i));
+               vars(i,0) = symbols.op(i);
                if (sys.has(symbols.op(i)))
                        throw(std::logic_error("lsolve: system is not linear"));
                if (rhs.has(symbols.op(i)))
@@ -505,27 +507,9 @@ ex lsolve(const ex &eqns, const ex &symbols)
        return sollist;
 }
 
-/** non-commutative power. */
-ex ncpower(const ex &basis, unsigned exponent)
-{
-       if (exponent==0) {
-               return _ex1();
-       }
-
-       exvector v;
-       v.reserve(exponent);
-       for (unsigned i=0; i<exponent; ++i) {
-               v.push_back(basis);
-       }
-
-       return ncmul(v,1);
-}
-
 /** Force inclusion of functions from initcns_gamma and inifcns_zeta
  *  for static lib (so ginsh will see them). */
 unsigned force_include_tgamma = function_index_tgamma;
 unsigned force_include_zeta1 = function_index_zeta1;
 
-#ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
-#endif // ndef NO_NAMESPACE_GINAC