Maxima won't pull out a constant from a linear function



The problem is in rem-const, which uses constant rather than $constantp.
 Here is a version with $constantp.   You can put this in a file xxx.lisp
in your load path and then run load("xxx.lisp"). This should probably be
updated in the distribution, but I'm not set up for checking in source.

            -s

(defun rem-const (e) ;removes constantp stuff
  (do ((l (cdr e) (cdr l))
       (a (list (opident (caar e))))
       (b (list (opident (caar e)))))
      ((null l)
       (cons (simplifya (cons (list (caar e)) a) nil)
     (simplifya (cons (list (caar e)) b) nil)))
    (if ($constantp (car l))
(setq a (cons (car l) a))
      (setq b (cons (car l) b)))))


On Thu, Dec 13, 2012 at 7:00 PM, David Scherfgen <d.scherfgen at googlemail.com
> wrote:

> Hello,
>
> I declare "f" to be a *linear function* and "c" to be a *constant*:
>
> declare(f, linear, c, constant);
>
> Now, Maxima correctly does the following simplifications:
>
> f(c * x) = c * f(x)
> f(x / 5) = f(x) / 5
>
> However, it won't pull out the constant in the following case:
>
> f(x / c)
>
> This should be f(x) / c,
> just like f(x / 5) becomes f(x) / 5.
>
> Do you have any idea how I can make Maxima pull out the constant?
> Ideally, it would pull out *any* constant expression, not just a simple
> constant, for example:
>
> f(x / log(42 * %pi)) should become f(x) / log(42 * %pi) ...
>
> Help is greatly appreciated.
>
> Kind regards,
> David Scherfgen
> ______________________________**_________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>;
>