Domanda

I'm making a program that takes input for an expression and integrates it and prints the result to the user. I'm using SymbolicC++, but can't seem to figure out how to input a symbolic... how do I do this - I'm using Visual Studio for my IDE

È stato utile?

Soluzione

Like this (example from here):

#include <iostream>
#include "symbolicc++.h"
using namespace std;

int main(void)
{
    Symbolic x("x");
    cout << integrate(x+1, x);     // => 1/2*x^(2)+x
    Symbolic y("y");
    cout << df(y, x);              // => 0
    cout << df(y[x], x);           // => df(y[x],x)
    cout << df(exp(cos(y[x])), x); // => -sin(y[x])*df(y[x],x)*e^cos(y[x])
    return 0;
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top