4.12 How to find if some function is present in an expression

Given expression \(3 \sin \left (x \right )+t +3 f \left (x , t\right ) t +g \left (x , t\right )\) find if it contains function \(f()\).

Use indets with specfunc(f)

restart; 
expr := 3*sin(x)+t+3*f(x,t)*t+g(x,t); 
res  := indets(expr, specfunc(f)); 
if numelems(res)<>0 then 
   print("Found f(x,t)"); 
else 
   print("could not find f(x,t)"); 
fi;
 

"Found f(x,t)"