1 Dec 2009 01:03

### gamma_incomplete(1/2,0)?

Current CVS says gamma_incomplete(1/2,0) is sqrt(%pi)/2.  But the help
for gamma_incomplete says gamma_incomplete(a,z) =
integrate(exp(-t)*t^(a-1),t,0,z).  (This matches A&S 6.5.2.)

So from the documentation, I would expect the integral to be 0.

Which is correct?  Since A&S is our reference, I think the current value
is incorrect and we should return 0.

Ray
1 Dec 2009 01:51

### Re: gamma_incomplete(1/2,0)?

Am Montag, den 30.11.2009, 19:03 -0500 schrieb Raymond Toy:
> Current CVS says gamma_incomplete(1/2,0) is sqrt(%pi)/2.  But the help
> for gamma_incomplete says gamma_incomplete(a,z) =
> integrate(exp(-t)*t^(a-1),t,0,z).  (This matches A&S 6.5.2.)
>
> So from the documentation, I would expect the integral to be 0.
>
> Which is correct?  Since A&S is our reference, I think the current value
> is incorrect and we should return 0.

Sorry, but I think the documentation is wrong. The problem is that the
Incomplete Gamma function and the lower Incomplete Gamma function are
easy to mix up. I think these are the defintions (e.g. wolfram.com)

Incomplete Gamma functions:

gamma_incomplete(a,z) = integrate(exp(-t)*t^(a-1),t,z,inf)

lower Incomplete Gamma function (gammagreek in Maxima):

lower_gamma_incomplete(a,z)= integrate(exp(-t)*t^(a-1),t,0,z)

Dieter Kaiser
1 Dec 2009 01:55

### Bug ID: 893633 "depends(a,[b,b,b])".

I had a look at the bug report bug ID: 893633 "depends(a,[b,b,b])".

The following modification of the the routine i-$dependices does not do a union between the list of dependencies from the property list and the arguments to the function depends, but add the dependencies element-wise. This allows to check for symbols and to remove duplicates. (defmfun i-$dependencies (l &aux y res)
(dolist (z l)
(cond
((atom z)
(merror (intl:gettext "depends: argument must be a non-atomic
expression; found ~M") z))
((or (eq (caar z) 'mqapply) (member 'array (cdar z) :test #'eq))
(merror (intl:gettext "depends: argument cannot be a subscripted
expression; found ~M") z))
(t
(setq y (reverse (mget (caar z) 'depends)))
(do ((zz z (cdr zz)))
((null zz)
(mputprop (caar z) (setq y (reverse y)) 'depends)
(setq res (push (cons (ncons (caar z)) y) res))
(unless (cdr $dependencies) (setq$dependencies '((mlist simp))))
(add2lnc (cons (cons (caar z) nil) y) $dependencies)) (cond ((not (symbolp (cadr zz))) (merror (intl:gettext "depends: argument must be a symbol; found ~M") (cadr zz))) (Continue reading) 1 Dec 2009 03:28 ### Re: gamma_incomplete(1/2,0)? Dieter Kaiser wrote: > Am Montag, den 30.11.2009, 19:03 -0500 schrieb Raymond Toy: > >> Current CVS says gamma_incomplete(1/2,0) is sqrt(%pi)/2. But the help >> for gamma_incomplete says gamma_incomplete(a,z) = >> integrate(exp(-t)*t^(a-1),t,0,z). (This matches A&S 6.5.2.) >> >> So from the documentation, I would expect the integral to be 0. >> >> Which is correct? Since A&S is our reference, I think the current value >> is incorrect and we should return 0. >> > > Sorry, but I think the documentation is wrong. The problem is that the > Incomplete Gamma function and the lower Incomplete Gamma function are > easy to mix up. I think these are the defintions (e.g. wolfram.com) > > Incomplete Gamma functions: > > gamma_incomplete(a,z) = integrate(exp(-t)*t^(a-1),t,z,inf) > Heh. That would explain why limit(gamma_incomplete(a,z),z,inf) is zero. Let's fix the documentation then. Ray 1 Dec 2009 09:03 ### Re: Bug ID: 893633 "depends(a,[b,b,b])". On 11/30/09, Dieter Kaiser <drdieterkaiser <at> web.de> wrote: > There are two changes in the output visible to the user: > > 1. depends now add the new dependencies always at the end of the > property list. > 2. The return value of depends shows the complete dependencies, > including the dependencies already on the property list. > > (%i4) depends(f,[x,y]); > (%o4) [f(x,y)] > (%i5) depends(f,[a,b]); > (%o5) [f(x,y,a,b)] Hmm. I'm not in favor of this. I'm pretty sure it is clearer to have the effect of a declaration supersede previous declarations. Otherwise to know the effect of a new declaration, you have to know any previous ones. best Robert Dodier 1 Dec 2009 10:50 ### Vector / matrix differentials Hi all I have a function 1 / | s^H U |^2 where s is a complex vector function of phi and theta, i.e. s(phi, theta) U is a complex matrix (columns are basis vectors), | | denotes the L2 vector norm ^H is hermitian transpose ^2 is the square operator. The function could also be written as 1 / s^H U U^H s. How do I instruct Maxima to find the partial derivatives of the function w.r.t. phi and theta. Assume that I can obtain the p.d.'s of s w.r.t. phi and theta. I'm rather hazy on specifying the constraints (e.g. U is a complex matrix, s is a complex vector, etc.) Thanks for any help. Ryan Disclaimer: http://www.peralex.com/disclaimer.html 1 Dec 2009 11:06 ### PATCH: Translating maxima macros Hi, The maxima translator currently expands maxima macros at compile time not at run time. I think this should be corrected. Here is a patch to expand macros at run time. Andrej Index: transl.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/src/transl.lisp,v retrieving revision 1.42 diff -u -r1.42 transl.lisp --- transl.lisp 1 Dec 2009 07:31:34 -0000 1.42 +++ transl.lisp 1 Dec 2009 10:03:15 -0000 <at> <at> -748,15 +748,16 <at> <at> (defun toplevel-optimize-1 (form &aux (op (car form)) prop) (cond ((or (atom op) (member 'array op :test #'eq)) form) - ((progn (setq op (car op)) - (setq prop - (if$transrun	; crock a minute.
-			  (or (get op 'translated-mmacro)
-			      (mget op 'mmacro))
-			  (or (mget op 'mmacro)
-			      (get op 'translated-mmacro)))))
-	 (mmacro-apply prop form))
-	((setq prop ($get op '$optimize))
+	;; DONT EXPAND MACROS AT TRANSLATION TIME
+	;((progn (setq op (car op)) nil))

1 Dec 2009 14:58

### mactex translation

Hi.

If we input
simp:false; tex(2.6^(1/3)); simp:true;
then output is $$2.6^{{{1}\over{3}}}$$
More correct answer is: $${2.6}^{{{1}\over{3}}}$$

Best regards,
Mihail D

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
1 Dec 2009 15:27

### Re: gamma_incomplete(1/2,0)?

Dieter Kaiser wrote:
> Am Montag, den 30.11.2009, 19:03 -0500 schrieb Raymond Toy:
>
>> Current CVS says gamma_incomplete(1/2,0) is sqrt(%pi)/2.  But the help
>> for gamma_incomplete says gamma_incomplete(a,z) =
>> integrate(exp(-t)*t^(a-1),t,0,z).  (This matches A&S 6.5.2.)
>>
>> So from the documentation, I would expect the integral to be 0.
>>
>> Which is correct?  Since A&S is our reference, I think the current value
>> is incorrect and we should return 0.
>>
>
> Sorry, but I think the documentation is wrong. The problem is that the
> Incomplete Gamma function and the lower Incomplete Gamma function are
> easy to mix up. I think these are the defintions (e.g. wolfram.com)
>
> Incomplete Gamma functions:
>
>  gamma_incomplete(a,z) = integrate(exp(-t)*t^(a-1),t,z,inf)
>
>
> lower Incomplete Gamma function (gammagreek in Maxima):
>
>  lower_gamma_incomplete(a,z)= integrate(exp(-t)*t^(a-1),t,0,z)
>
>
Do we have a function to evaluate lower_gamma_incomplete?  Using
gamma_incomplete is not very accurate if a is large and z is relatively
small (about 1) since we end up subtracting two numbers approximately
equal to gamma(a).

Ray
1 Dec 2009 17:31

### Re: PATCH: Translating maxima macros

Hi.

This naive patch of course does not work in general. Maybe I should
explain the problem. I have a file with lots of functions, some of
which benefit from compiling. So after loading the file I want to do
compile(all). This breaks some functions which use macros.

I'm using the with_parameters macro from augmented_lagrangian;

with_parameters([L])::=buildq([a:subst(:,=,ev(L[1])),e:rest(L)],block(a,splice(e)))

Define a simple function f.

(%i12) f(x, [opt]) := with_parameters(opt, if symbolp(a) then x else 1);
(%o12) f(x,[opt]):=with_parameters(opt,if symbolp(a) then x else 1)

Before compiling:

(%i13) f(x, a=1);
(%o13) 1
(%i14) f(x);
(%o14) x

(%i15) compile(f);
(%o15) [f]

After compiling

(%i16) f(x, a=1);
(%o16) x
(%i17) f(x);
(%o17) x

I want to modify the translator so that f gives the same result before
and after compiling. The only way I can think of is to disable the
translation of with_parameters form and to expand it when f is called.
This gives the results I expect but of course does not benefit from
translation. What is the correct way to compile functions which
include macros like with_parameters?

BTW: the translation does not work correctly for macros.

(%i17) translate(with_parameters);
; in: LAMBDA NIL
;     #'(LAMBDA MAXIMA::|mlexpr NARGS|
;         (COND
;          ((< MAXIMA::|mlexpr NARGS| 0)
;           (MAXIMA::$ERROR 'MAXIMA::MAXIMA-ERROR 'MAXIMA::$WITH_PARAMETERS
;                           " takes no less than " 0 '" arguments."))
;          (T ((LAMBDA # # #) (CONS '# #)))))
;
; caught ERROR:
;   The lambda expression has a missing or non-list lambda list:
;     (LAMBDA |mlexpr NARGS|
;       (COND
;        ((< |mlexpr NARGS| 0)
;         ($ERROR 'MAXIMA-ERROR '$WITH_PARAMETERS " takes no less than " 0
;                 '" arguments."))
;        (T
;         ((LAMBDA (|$l|) (DECLARE #) (MBUILDQ-SUBST # '#)) ; (CONS '(MLIST) (LISTIFY #)))))) ; ; compilation unit finished ; caught 1 ERROR condition (%o17) [] Andrej On Tue, Dec 1, 2009 at 11:06 AM, Andrej Vodopivec <andrej.vodopivec <at> gmail.com> wrote: > Hi, > > The maxima translator currently expands maxima macros at compile time > not at run time. I think this should be corrected. Here is a patch to > expand macros at run time. > > Andrej > > Index: transl.lisp > =================================================================== > RCS file: /cvsroot/maxima/maxima/src/transl.lisp,v > retrieving revision 1.42 > diff -u -r1.42 transl.lisp > --- transl.lisp 1 Dec 2009 07:31:34 -0000 1.42 > +++ transl.lisp 1 Dec 2009 10:03:15 -0000 > <at> <at> -748,15 +748,16 <at> <at> > (defun toplevel-optimize-1 (form &aux (op (car form)) prop) > (cond ((or (atom op) > (member 'array op :test #'eq)) form) > - ((progn (setq op (car op)) > - (setq prop > - (if$transrun     ; crock a minute.
> -                         (or (get op 'translated-mmacro)
> -                             (mget op 'mmacro))
> -                         (or (mget op 'mmacro)
> -                             (get op 'translated-mmacro)))))
> -        (mmacro-apply prop form))
> -       ((setq prop ($get op '$optimize))
> +       ;; DONT EXPAND MACROS AT TRANSLATION TIME
> +       ;((progn (setq op (car op)) nil))
> +       ;       (setq prop
> +       ;             (if $transrun ; crock a minute. > + ; (or (get op 'translated-mmacro) > + ; (mget op 'mmacro)) > + ; (or (mget op 'mmacro) > + ; (get op 'translated-mmacro))))) > + ; (mmacro-apply prop form)) > + ((progn (setq op (car op)) (setq prop ($get op '\$optimize)))
>         ;; interesting, the MAPPLY here causes the simplification
>         ;; of the form and the result.
>         ;; The optimize property can be used to implement
> Index: fcall.lisp
> ===================================================================
> RCS file: /cvsroot/maxima/maxima/src/fcall.lisp,v
> retrieving revision 1.14
> diff -u -r1.14 fcall.lisp
> --- fcall.lisp  1 Dec 2009 07:34:34 -0000       1.14
> +++ fcall.lisp  1 Dec 2009 10:03:15 -0000
>  <at>  <at>  -82,6 +82,9  <at>  <at>
>        ((macro-function f)
>         (eval (cons f list-argl)))
>        ((not (symbolp f)) (merror (intl:gettext "apply: expected symbol or
> function; found: ~M") f))
> +       ;;; EXPAND MAXIMA MACROS
> +       ((setq f-prop (or (get f 'translated-macro) (mget f 'mmacro)))
> +        (meval (mmacro-apply f-prop `((,f) , <at> argl))))
>        ((setq f-prop (get f 'mfexpr*))
>         (funcall f-prop (cons nil argl)))
>        ((setq f-prop (mget f 'mexpr))
>

Gmane