diff --git a/core/SympyCdb.cc b/core/SympyCdb.cc index a02b204f90..7b34495208 100644 --- a/core/SympyCdb.cc +++ b/core/SympyCdb.cc @@ -32,10 +32,13 @@ pybind11::object sympy::SympyBridge::export_ex() pybind11::module sympy_parser = pybind11::module::import("sympy.parsing.sympy_parser"); auto parse = sympy_parser.attr("parse_expr"); #ifdef DEBUG - std::cerr << str.str() << std::endl; + std::cerr << "sympy::SympyBridge::export_ex: " << str.str() << std::endl; #endif pybind11::object ret = parse(str.str()); - +#ifdef DEBUG + std::cerr << "sympy::SympyBridge::export_ex: succes" << std::endl; +#endif + return ret; } @@ -43,7 +46,7 @@ void sympy::SympyBridge::import_ex(const std::string& s) { preparse_import(s); #ifdef DEBUG - std::cerr << s << std::endl; + std::cerr << "sympy::SympyBridge::import_ex: " << s << std::endl; #endif auto ptr = std::make_shared(); cadabra::Parser parser(ptr); diff --git a/core/pythoncdb/py_ex.hh b/core/pythoncdb/py_ex.hh index 53111e15b7..15a8ba4759 100644 --- a/core/pythoncdb/py_ex.hh +++ b/core/pythoncdb/py_ex.hh @@ -18,7 +18,7 @@ namespace cadabra { /// \ingroup pythoncore /// - /// Add two expressions, adding a top-level \sum node if required. + /// Add two expressions, adding a top-level '\sum' node if required. Ex_ptr Ex_add(const Ex_ptr ex1, const ExNode ex2); Ex_ptr Ex_add(const Ex_ptr ex1, const Ex_ptr ex2); @@ -26,13 +26,13 @@ namespace cadabra { /// \ingroup pythoncore /// - /// Multiply two expressions, adding a top-level \prod node if required. + /// Multiply two expressions, adding a top-level '\prod' node if required. Ex_ptr Ex_mul(const Ex_ptr ex1, const Ex_ptr ex2); Ex_ptr Ex_mul(const Ex_ptr ex1, const Ex_ptr ex2, Ex::iterator top2); /// \ingroup pythoncore /// - /// Subtract two expressions, adding a top-level \sum node if required. + /// Subtract two expressions, adding a top-level '\sum' node if required. Ex_ptr Ex_sub(const Ex_ptr ex1, const ExNode ex2); Ex_ptr Ex_sub(const Ex_ptr ex1, const Ex_ptr ex2); Ex_ptr Ex_sub(const Ex_ptr ex1, const Ex_ptr ex2, Ex::iterator top2); @@ -109,4 +109,4 @@ namespace cadabra { void call_post_process(Kernel& kernel, Ex_ptr ex); void init_ex(pybind11::module& m); - } \ No newline at end of file + } diff --git a/tests/sympy_cdb.cdb b/tests/sympy_cdb.cdb index 2c2c851af3..0effbe1465 100644 --- a/tests/sympy_cdb.cdb +++ b/tests/sympy_cdb.cdb @@ -4,7 +4,7 @@ def test01(): __cdbkernel__=create_scope() ex:=3x + x**2 + a x**2 + b x; q=SympyBridge(ex) - q.from_sympy( str(sympy.collect(q.to_sympy(), $x$)) ) + q.from_sympy( str(sympy.collect(q.to_sympy(), str($x$))) ) tst:= x**2 (a + 1) + x ( b + 3) - @(ex); assert(tst==0) print("Test 01 passed") @@ -13,10 +13,10 @@ test01() def test02(): __cdbkernel__=create_scope() - {r,t}::Coordinate; - f::Depends(r,t); + {r,t}::Coordinate. + f::Depends(r,t). ex:=f*A; - \partial{#}::PartialDerivative; + \partial{#}::PartialDerivative. ex:= \partial_{r}{ f + (\sin(r)**2)**2 }; map_sympy(ex) tst:= \partial_{r}{f} + 4 \sin(r)**3 \cos(r) - @(ex); @@ -27,9 +27,9 @@ test02() def test03(): __cdbkernel__=create_scope() - \tau::Coordinate; - \partial{#}::Derivative(\tau); - r::Depends(\tau); + \tau::Coordinate. + \partial{#}::Derivative(\tau). + r::Depends(\tau). ex:=\partial{r}; q=SympyBridge(ex) q.from_sympy(str(q.to_sympy()))