Added a validation check to ensure only numbers are used for the equation