what are these x,y how your application getting inputs
through text box?
the simplest method is use (like calculator)
(1) text boxes (1)
(2) use cmd buttons for numbers
(3) use combo box for pre defined functions like cos(),,,,

if you want your application to identify the functions as the user types
then you can do it but error prone ;