You have asked for the solution to a rather complex problem with a very short question. You appear to be attempting to create a pseudo-interpreter.
One way to do it would be to use Qbasic to evalute the expressions: 1) Convert the expressions into BASIC syntax. 2) Write them to a BAS file. 3) Shell to Qbasic, telling it to open and run the newly created BAS file, then exit (you would have to find a way to save the results of the expressions to the environment or another file that can be read by the calling program).
This would be very awkward and hard to implement.
Another way to do it would be to get into the trenches and work out a solution, one element at a time (essentially, you will end up doing work that has already been performed by the Microsoft programmers).
Evaluate each expression as a string using INSTR, LEFT$ MID$ and the others:[tt]
Expression$ = "sin(x)+cos

"
If Expression$ contains "sin(" then
Get the value of the variable following "sin("
Place SIN(x) in a temporary variable
If Expression$ contains "cos(" then
Get the value of the variable following "cos(
Place COS

in a temporary variable
If "sin(?)" and "cos(?)" are separated by "+" then
Add the two temporary variables
Place the result in another variable
Do tons of other stuff
EndIf
EndIf
EndIf
[/tt]
I hope you can appreciate how complicated this could become in a very short amount of time. The pseudo-code example I just noted would be a very poor way to interpret strings as expressions but I hope it helps you see the nature of your question.
You want us to tell you how to build a space station without asking us whether or not it will work or if it is even a good idea. It probably won't fly and it will serve as a source of frustration... but it will be a great learning experience and you will probably have a bit of fun in the process.
Start with thread314-22099. This doesn't even address the problems of evaluating the symbolic representations of functions and variables from a string but
it does talk about ways to perform math on numbers (some rather
large numbers) that are stored as strings. It might not be a bad way for you to "get your feet wet."
Good luck with your interesting project.