1 // Input expression containing variable 'x' and compute its derivative
2 // with respect to 'x'.
3 // Example from the tutorial (chapter Input/Output, section `Expression
11 #include <ginac/ginac.h>
14 using namespace GiNaC;
18 cout << "Enter an expression containing 'x': " << flush;
23 symtab table = reader.get_syms();
25 symbol x = table.find("x") != table.end() ?
26 ex_to<symbol>(table["x"]) : symbol("x");
28 cout << "The derivative of " << e << " with respect to x is ";
29 cout << e.diff(x) << "." << endl;
30 } catch (exception &p) {
31 cerr << p.what() << endl;