Cast is an abstract syntax tree library written in C. This allows for converting char* variables to mathematical structures.
#include "include/cast/parser.h"
int main(void) {
char* toParse = "a * bc + 123 / sin(3.1415 * n) ^ log_(2, 8) - e";
struct Operation operation = parseOperation(toParse);
printOperation(operation);
// Replace variables!
struct Operation variable = Variable("a");
struct Operation constant = Constant(2 + 2 * I);
struct Operation evaluated = evaluate(operation, variable, constant);
// Or replace entire functions:
struct Operation toReplace = parseOperation("sin(3.1415 * n)");
struct Operation replaceWith = parseOperation("2 + 5i");
struct Operation replaced = evaluate(evaluated, toReplace, replaceWith);
}
Soon there will be support for derivatives of functions with respect to some variable.