Ok, so this is the moment I show how little physics I know... Anyway, what about something like replacing the variables with their dimensions, e.g.
Then decide if the degree of L is correct?
No, your second example gives a division by zero. Sorry, we can't do this robustly currently I think. An interesting project for a physics person: dimensional analysis in Maxima.
Yet, it might be worth a second try, once our moodle and stack are updated.
substitutions: [var1=f1*unit1, var2=f2*unit2....];
numberp( ev(ans/tans, substitutions);
homog : rat( subst([a=L*a,t=L*t], ans1)/ans1/L^4 );
You then test if homog is 1. You can change that 4 to the desired/required degree.
This seems to be a very robust solution. The only drawback is that there must not be any overlap between variable and unit names (like m for mass and m for meter). Yet, this is easy to handle, as you either aren't going to expose the unit names in the feedback or you can use texput to substitute whatever you want for output.
I'll open an issue on github for further discussion.