# check if the expression is a equation

I need to check if the expression is a correct equation with only 1 variable x and without functions, that are not build into Mathematica. For example

Sin[x]==0


is correct equation. And expressions

Sin[x*a]==0, Sin[[x]==0, f[x]==0, Exp[x]=9


are not correct equations.

-
Are you testing these as strings or as expressions? Because one of them sticks out immediately being syntactically incorrect, so Mathematica won't have a problem checking whether it is a well-formed equation or not. –  István Zachar Dec 1 '13 at 19:26
I'm testing these as strings. When expression is incorrect I will get message. The best variant for me is to get messages in other cases. –  user10893 Dec 1 '13 at 19:37

admissibleEqPat =
eq_Equal /;
DeleteDuplicates[
Context /@
DeleteCases[
Cases[eq, _Symbol, Infinity,
Heads -> True], x]] === {"System"};

MatchQ[x^2 + 3 x == 4 x^2/(x + 2), admissibleEqPat]
(* True *)

(* True *)


I'm assuming that by built-in functions, you mean the standard built-in ones that are in the System context.