This is a sample code using symbolic C++.

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

int main(void)
{
    int i;
    Symbolic x("x"), y, z("z");

    y = (x + 2)^3;
    cout<<" y = "<<y;

    for ( i = 0 ; i < 1 ; i++)
    {
        y = df(y,x);
        cout<<" y = "<<y<<endl;
    }

    return 0;
}

My question : is there any way to make symbolic variables to be input by user ?

If you want to get functions from the user to pass to the program than you might be able to do the following. No guarantee though I am just guessing from the code that you have provided.

string input;
cout << "Enter Equation: ";
getline(cin, input);
Symbolic y(input.c_str());

string input;
cout << "Enter Equation: ";
getline(cin, input);
Symbolic y(input.c_str());

It doesn't realy work, beacuse, the expression is "stored" in input, but is quite useless. If you try to differentiate it, the result is "0".

I have no idea how to define a "function" (Symbolic f) from a string. I've been dealing with this problem since a long time...

Where have you searched? Have you studied the information in this link?

Yes. I have read this, downloaded from here only. I gone through the header file of symbolicc++ and found this.

ostream &operator<<(ostream &o,const Symbolic &s)
{ s.print(o); return o; }

So I was thinking is there any way that is there any way to overload >> operator ?
I couldn't find any way, how to take symbolic variables from user during runtime.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.