There is a Function(TextField) GUI element in EJS, that user can input formula and EJS will evaluate it.
You should be able to create a scientific calculator with EJS.
Try it by yourseld first. If you really have trouble, then I will help you!