Hi guys,
first, thanks for your great package!
I am trying to let users input expressions with matrix indices in their
expressions (like A.i). I order to try this feature, I wrote a simple
program (see attached file try.cpp)
(compiled with gcc)
the bulk of the program consist in:
ex e("2*S.j+n", lst(S,j,n)); //(S is a symbol, j an idx, n a symbol)
cout << "ok! :" << e << endl;
I am getting the result:
ok! :2*S
which is wrong in my opinion.
Am I doing something wrong? Are there ways to get around this problem?
Thanks for your help
#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;
int main (){
symbol j_sym("j");
symbol n("n");
idx j(j_sym,n);
symbol S("S");
try {
ex e("2*S.j+n", lst(S,j,n));
cout << "ok! :" << e << endl;
} catch (exception &p) {
cerr << p.what() << endl;
}
}