declare(A,outative)



Sorry--I wasn't using a fresh Maxima. Also, multiadditive needs to be 
loaded.

  (%i1) load("multiadditive")$
  (%i2) load("multioutative.lisp")$

  (%i3) declare(f,multioutative);
  (%o3) done

  (%i4) f(6*x, 7*y,p-q);
  (%o4) 42*f(x,y,p-q)

My code uses numfactor to decide what to factor out--I should look at the 
outative code to see what it does.

--Barton

Leo Butler <l.butler at ed.ac.uk> wrote on 09/03/2010 09:01:34 AM:

> [image removed] 
> 
> Re: [Maxima] declare(A,outative)
> 
> Leo Butler 
> 
> to:
> 
> Barton Willis
> 
> 09/03/2010 09:01 AM
> 
> Cc:
> 
> Marek Pietrow, "'Maxima List'"
> 
> 
> 
> On Fri, 3 Sep 2010, Barton Willis wrote:
> 
> < I think Maxima doesn't have a way to declare a function to be 
> multioutative. If 
> < you are willing to experiment, try making a file 
> multioutative.lisp (given below)
> < and let me know if it works. Example
> < 
> < (%i12) load("multioutative.lisp")$
> < (%i13) declare(f,multioutative);
> < (%o13) done
> < 
> < (%i15) f(6*x, 7*y,p-q);
> < (%o15) 42*(f(x,y,p)-f(x,y,q))
> 
> This is not consistent with the behaviour of outative,
> it is more akin to multilinear. Also, your code appears
> to only fish out numeric constants using numfactor, which
> is not desirable.
> 
> Leo
> 
> < 
> < If all is well, I'll commit the multioutative code to the file /
> share/contrib/multiadditive.lisp
> < 
> < ;;---------------start of multioutative.lisp
> < (setq $opproperties ($cons '$multioutative $opproperties))
> < 
> < (setq opers (cons '$multioutative opers)
> <       *opers-list (cons '($multioutative . multioutative) 
*opers-list))
> < 
> < (defun multioutative (e z)
> <   (let ((op (car e))
> <    (args (margs e))
> <    (w 1))
> <     (setq args (mapcar #'(lambda (s) 
> <             (let ((k ($numfactor s)))
> <               (setq w (mul w k))
> <               (div s k))) args))
> < 
> <     (if (or (eq w 1) ($subvarp e)) (protected-oper-apply e z) 
> <       (mul w (protected-oper-apply (simplifya (cons op args)) z)))))
> < ;;-----------------end of multioutative.lisp
> < 
> < --Barton
> < 
> < -----maxima-bounces at math.utexas.edu wrote: -----
> < 
> < 
> < >Hi,
> < >I have an operator F of two arguments. How to declare in maxima that 
> < 
>constants should be pulled out also in the second argument? The command 
> < >declare(F,outative) removes constants only from the first one.
> < >Marek Pietrow.
> < >_______________________________________________
> < >Maxima mailing list
> < >Maxima at math.utexas.edu
> < >http://www.math.utexas.edu/mailman/listinfo/maxima
> < _______________________________________________
> < Maxima mailing list
> < Maxima at math.utexas.edu
> < http://www.math.utexas.edu/mailman/listinfo/maxima
> < 
> < 
> -- 
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>