I can think of 2 ways to do what you want and I've used both methods, although there may be other ways. 1) Write a parser and an evaluation "engine" class. The last time I did that I based it on the Forth system so it's real fast, but I converted the system to regular algebraic rather than reverse polish notation. I'd post a link, but the last time I did that I wrote it in Pascal, not C#, and I don't have a link to any code handy. 2) Use the CodeDomProvider class to write the function in the .NET language of your choice. For users I generally stick with VB since users seem most familiar with that. I've also used JScript, C#, F# in addition to VB. My article ScriptEngine - User Defined Calculations in C#, VB, JScript and F#[^] provides an example of how to do this, but you will need to modify for your own purposes. Note, that as mentioned in some of the comments, there doesn't appear to be a good way to ever unload the code if you have a long running application. In either case you can allow more than just a simple formula, depending on how you limit things. You'll still need to evaluate the function for all your input values and handle the graphics. Perhaps someone else will have additional ideas. Good luck!
CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software