kill(all)$

maxima : programming use. freeof command, version 1.0
peter.vlasschaert@gmail.com,09/06/2022

use :freeof, listofvars,showratvars,setify (= set),listify (=list),declare,noun.

 expr : a*b*c*sin(x);

p1a:listofvars(expr);

p1b:showratvars(expr);

p1c:flatten([p1a,p1b]);

→ relation between : listify⇔setify

p1d:setify(p1c);

p1d1:listify(p1d);

→ syntax :freeof (var, expr);

freeof (x_1, ..., x_n, expr) is equivalent to freeof (x_1, expr) and ... and freeof (x_n, expr). 

use : list p1d1 , "see above"

p1e:makelist(freeof(p1d1[i],expr),i,1,length(p1d1));

p2:args(expr);

p1e1:makelist(freeof(p2[i],expr),i,1,length(p2));

freeof(z,expr)

p1e2:freeof(z,expr);/* z not element of expr*/

Function: freeof (x_1, …, x_n, expr)

1e) arguments x_1, …, x_n =
{functions, variables,subscripted names,operators (enclosed in double quotes) } → false
------------------------------------------------------------------------------------------------------------------

expr1:x^5*z*f(s);

p1f1:freeof("^",expr1);/*operators (enclosed in double quotes)*/

p1f2:freeof(f(s),expr1);/*function*/

2e) noun nor verb form of any operator in expr → false
-------------------------------------------------------------------------

declare (bar, noun);/*protect bar from evaluation*/
bar(x) := x^2;/* declare function bar */ 
bar(2);          /*result : function: bar */

expr2:bar(y)*x^5*z;

rem :https://maths.cnam.fr/Membres/wilk/MathMax/help/Maxima/maxima_6.html

p1f3:freeof(bar(y),expr2);/*function*/

p1f4:freeof(bar(x),expr2);/*function*/

rem :By default, function names are verbs

3e) check before expression not after
-------------------------------------------------
see : example.

→ before

expr3: (x+y)^2$

p1g1:freeof(x+y,expr3);

→ after

expr4:ratexpand(expr3);/*equivalent on expr3*/

p1g2:freeof(x+y,expr4);

rem : freeof does not consider equivalent expressions.

4e) A summation or definite integral is free of its dummy variable. 
An indefinite integral is not free of its variable of integration. 
----------------------------------------------------------------------------------------

→ summation or integral  

p1h1:freeof (i, 'sum (f(i), i, 0, n));/* i = dummy variable*/
p1h2: freeof (x, 'integrate (x^2, x, 0, 1));/*definite integral */
p1h3:freeof (x, 'integrate (x^2, x)); /*indefinite integral */

Local variables in block are not recognized by freeof as dummy variables; this is a bug. 

ref :https://maths.cnam.fr/Membres/wilk/MathMax/help/Maxima/maxima_6.html#IDX153

appendix:

p1i1:exp (x);
p1i2:freeof (exp, exp (x));

rem : see "p1e2"

---------------------------------------------------------------------------------------------------------------------------