On 30.09.2013 17:32, Vladimir V. Kisil wrote:
Let f be declared as GiNaC::ex and x be GiNaC::realsymbol. At some point a user may do an assignment f=3*x+2. If later he need the value which you denote by f(2), you need to return him f.subs(x==2). I cannot see a reason why you need to declare f as GiNaC::function, which shall not be confused with mathematical functions as maps X -> Y. But what if I have multiple functions, for example f(x) and g(x) and some expression e that looks like f(2) + g(5) ... . Calling e.subs(x==2) would bring great trouble. How can I distinguish between the x in f(x) = 3*x+2 and the x in g(x) = 1/2*x-4, for example. Of course I can imagine ways to make this work, but I don't like to reinvent the wheel to much.