can't subs(lst) on a function
Hello, I use GiNaC version 1.0.8 (and gcc version 3.0.1) and found out that the only subs-method that can be used with an exprseq is ex subs(const lst & ls, const lst & lr, bool no_pattern = false) The consequence seems to be that (since a function is derived from a exprseq) that I am allowed to write ex e=sin(x*y+x); cout << e.subs(lst(x==-2,y==4)) << endl; which gives the expected result sin(-10), but I am not allowed to write cout << sin(x*y+x).subs(lst(x==-2,y==4)) << endl; because this causes the error: test.C: In function `int main(int, char**)': test.C:9: no matching function for call to `GiNaC::function::subs(GiNaC::lst) const' /usr/local/include/ginac/exprseq.h:84: candidates are: virtual GiNaC::ex GiNaC::exprseq::subs(const GiNaC::lst&, const GiNaC::lst&, bool = false) const I think another subs-method should be added to exprseq so that this error no longer occurs. Greetings, Chris Dams
Hello Chris, The solution is to cast the function to a ginac ex : cout << ex(sin(x*y+x)).subs(lst(x==-2,y==4)) << endl; Greetings.
participants (2)
-
Chris Dams
-
Hugo LECLERC