I have a third-party library, and I want to use one of the supplied constructors.
ex.h:
/** Construct example from string and a list of symbols. The input grammar is
* similar to the GiNaC output format. All symbols and indices to be used
* in the expression must be specified in a lst in the second argument.
* Undefined symbols and other parser errors will throw an exception. */
ex(const std::string &s, const ex &l);
I tried the following:
symbol x("x");
ex e("x^2",x);
Unfortunately the usage of this constructor is incorrect. I get the following error message:
libc++abi.dylib: terminating with uncaught exception of type std::invalid_argument: find_or_insert_symbol: symbol "x" not found
All documentation that is provided is the comment above the declaration. I am a C++ novice, so I have no idea what is wrong.
I tried the suggestion in the first answer like the following:
symbol x("x");
ex expression;
ex e("x^2",expression);
std::cout << diff(e,x) << std::end
This results in the following error message:
libc++abi.dylib: terminating with uncaught exception of type std::invalid_argument: find_or_insert_symbol: symbol "x" not found (lldb)
Note: I tried using e and expression in diff().