Negligible terms in polynomials



Thank you very much, the code

freeof_var ([xe]) := block ([v, x, e],
  if xe=[] then return(true),
  block ([ex : reverse(xe)].
    e : first (ex),
    x : rest (ex)
  ),
  v : listofvars (e),
  while true do (
    if x=[] then
      return (true)
    elseif member(first(x),v) then
      return (false)
    else
      x : rest(x)
  )
)$

works fine. I don't understand your lisp implementation because I dont't know lisp, do you want to add the new freeof_var to Maxima core in further versions?
Can I ask you a last thing? Just for curiosity :-) The code above works fine but I wish to understand why with the previous  code:

(%i1) freeof_var (ee, [x]) := block ([v : listofvars(ee)],
not apply("or", map (lambda([xx], member(xx,v)), x)))$

(%i2)  map (lambda([e], if freeof(A,e) or freeof(I,e) then e else 
limit(e, A, inf)), u);

where u is a vector, only the first condition in the if statement is evaluated, because ee is set only once, only to A and never to I. I'm far from being a Maxima geek :-(

Thanks, Stefano



Alexey Beshenov ha scritto:
> Maybe it is really handy to have a special version of
> freeof(x_1,...,x_n, expr) which compares x_1,...,x_n only
> with non-dummy variables in expr.
>
> Here's a code which could be used in addition to nrat4.lisp
> stuff:
>
> ------------------------------------------------------------
>
> (defun lfreeof-var (x expr)
>   (let*
>     (($listdummyvars nil)
>      (v ($listofvars expr)))
>     (loop while x do
>       (if (member (car x) v :test 'equal)
>         (return-from lfreeof-var nil))
>       (setf x (cdr x)))
>     t))
>
> (defun $lfreeof_var (x expr)
>   (if ($listp x)
>     (lfreeof-var (margs x) expr)
>     (merror "First argument must be a list")))
>
> (defun $freeof_var (&rest xe)
>   (let ((ex (reverse xe)))
>     (lfreeof-var (cdr ex) (car ex))))
>
> ------------------------------------------------------------
>
> Examples:
>
> freeof_var (x,y,z, x^n + y^n = z^n)           => false
> freeof     (x,y,z, x^n + y^n = z^n)           => false
>
> Dummy variables:
> freeof_var (i, 'sum(i,i,0,1000))              => true
> freeof     (i, 'sum(i,i,0,1000))              => true
>
> Useless for operators or constants:
> freeof_var (cos, cos(x))                      => true
> freeof     (cos, cos(x))                      => false
> freeof_var (23, 23*x)                         => true
> freeof     (23, 23*x)                         => false
>
> But may be useful for subscripted names:
> freeof_var (x,y,z, x[0]^n + y[0]^n = z[0]^n)  => true
> freeof     (x,y,z, x[0]^n + y[0]^n = z[0]^n)  => false
>
>