[GiNaC-list] list input

Vladimir V. Kisil kisilv at maths.leeds.ac.uk
Sun Mar 1 13:14:03 CET 2015


>>>>> On Sun, 01 Mar 2015 13:07:15 +0100, "Richard B. Kreckel" <kreckel at in.terlu.de> said:

    RK> On 03/01/2015 12:25 PM, soppon wrote:
    >> #include <iostream> #include <ginac/ginac.h> using namespace std;
    >> using namespace GiNaC;
    >> 
    >> int main() { symbol xs("x"); lst expr; parser reader;
    >> expr=reader("{x,x}"); cout <<"list " << expr << endl; cout
    >> <<"number of elements "<< expr.nops() << endl; cout <<"1st el "
    >> <<expr[0] << endl; cout <<"2nd el, error " <<expr[1]<< endl;
    >> return 0; }

    RK> Your list expr has only one element, which is itself a list with
    RK> two elements.
    
    As was already suggested, a plain list may be obtained by:

    expr=ex_to<lst>(reader("{x,x}"));
-- 
Vladimir V. Kisil                 http://www.maths.leeds.ac.uk/~kisilv/
  Book:     Geometry of Mobius Transformations     http://goo.gl/EaG2Vu
  Software: Geometry of cycles          http://moebinv.sourceforge.net/


More information about the GiNaC-list mailing list