- #1
- 7,861
- 1,600
- TL;DR Summary
- How should a computer program make a function out of a symbolic expression that is not known before the program executes?
Suppose a program computes or reads-in a symbolic mathematical expression like ##2x^2 - xy + y##. What's an effective way to cause the program to implement the expression as a function (e.g. implement ## f(x,y) = 2x^2 - xy + y##) when the programmer doesn't know in advance what the expression will be?
It would be nice to find a way it to implement the function so it runs (as efficiently) as if the programmer had known he expression in advance and coded and compiled it in the normal way.
I've deliberately not mentioned a specific computer language. I'd be interested in how different languages approach this task.
If the programmer knew "the general form" of the expression in advance (e.g. ##Ax^2 + Bxy + Cy##) then the function could be coded in advance "by hand" and implemented by having he program set the appropriate values of the constants. However, suppose the programmer doesn't have such specific information.
It would be nice to find a way it to implement the function so it runs (as efficiently) as if the programmer had known he expression in advance and coded and compiled it in the normal way.
I've deliberately not mentioned a specific computer language. I'd be interested in how different languages approach this task.
If the programmer knew "the general form" of the expression in advance (e.g. ##Ax^2 + Bxy + Cy##) then the function could be coded in advance "by hand" and implemented by having he program set the appropriate values of the constants. However, suppose the programmer doesn't have such specific information.