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
8 #include <ginac/ginac.h>
10 using namespace GiNaC;
14 cout << "Enter an expression containing 'x': " << flush;
19 symtab table = reader.get_syms();
21 symbol x = table.find("x") != table.end() ?
22 ex_to<symbol>(table["x"]) : symbol("x");
24 cout << "The derivative of " << e << " with respect to x is ";
25 cout << e.diff(x) << "." << endl;
26 } catch (exception &p) {
27 cerr << p.what() << endl;