login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #6 integration result Gamma not TeXed correctly revision 3 of 7

1 2 3 4 5 6 7
Editor: kratt6
Time: 2007/12/23 10:32:13 GMT-8
Note:

added:

From kratt6 Sun Dec 23 10:32:06 -0800 2007
From: kratt6
Date: Sun, 23 Dec 2007 10:32:06 -0800
Subject: 
Message-ID: <20071223103206-0800@axiom-wiki.newsynthesis.org>

Here is a simple patch::

  diff -c /home/martin/fricas/src/algebra/op.spad.pamphlet\~ /home/martin/fricas/src/algebra/op.spad.pamphlet
  *** /home/martin/fricas/src/algebra/op.spad.pamphlet~	2007-12-23 18:14:48.000000000 +0100
  --- /home/martin/fricas/src/algebra/op.spad.pamphlet	2007-12-23 19:14:41.000000000 +0100
  ***************
  *** 443,449 ****
        dpi l    == "%pi"::Symbol::O
        dfact x  == postfix("!"::Symbol::O, (ATOM(x)$Lisp => x; paren x))
        dquote l == prefix(quote(first(l)::O), rest l)
  !     dgamma l == prefix(hconcat(super("|"::Symbol::O, "-"::Symbol::O)), l)
        setDummyVar(op, n) == setProperty(op, DUMMYVAR, n pretend None)
    
        dexp x ==
  --- 443,468 ----
        dpi l    == "%pi"::Symbol::O
        dfact x  == postfix("!"::Symbol::O, (ATOM(x)$Lisp => x; paren x))
        dquote l == prefix(quote(first(l)::O), rest l)
  !     dgamma l == prefix(super("|"::Symbol::O, "-"::Symbol::O), l)
  ! @
  ! 
  ! It is certainly an abuse of [[OutputForm]] to produce a Gamma as done above.
  ! Originally, it was even worse:
  ! \begin{verbatim}
  !     dgamma l == prefix(hconcat("|"::Symbol::O, overbar(" "::Symbol::O)), l)
  ! \end{verbatim}
  ! which was TeXed to
  ! $$
  ! {|{\overline {\ }}} 
  ! \left(
  ! {x} 
  ! \right).
  ! $$
  ! 
  ! The right thing would be to introduce Greek letters in [[OutputForm]], but that
  ! should be coordinated with the new mathml package.
  ! 
  ! <<package COMMONOP CommonOperators>>=
        setDummyVar(op, n) == setProperty(op, DUMMYVAR, n pretend None)
    
        dexp x ==

Warning: Gamma looks *slightly* different in ASCII then.  A better patch is discussed on the FriCAS list, 23.12.2007

Martin

Submitted by : (unknown) at: 2007-11-17T23:01:10-08:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

integrate((x^2)*(%e^(-x^2)),x=0..%plusInfinity) does not give sqrt(%pi)/4.

anonymous [mathaction@axiom-developer.org]? wrote:
integrate((x^2)*(%e^(-x^2)),x=0..%plusInfinity) does not give sqrt(%pi)/4.

The answer it gives is correct (unless there is a new bug introduced that is not on my axiom 0.20040831-1). The gamma function has sqrt(pi) for half-integer values.

axiom
integrate(x^2*(exp(-x^2)), x=0..%plusInfinity)
LatexWiki Image(1)
Type: Union(f1: OrderedCompletion? Expression Integer,...)
axiom
Gamma(3/2)/2::Float
LatexWiki Image(2)
Type: DoubleFloat?
axiom
sqrt(%pi)/4::Float
LatexWiki Image(3)
Type: Expression Float

What I don't understand is why the integration result is so hard to convert to a Float. Appending ::Float to the integrate() command fails. Why? If I type Gamma(3/2)/2 by hand it has no problem.

Actually the text output is:
          _ 3
         | (-)
            2
   (28)  -----
           2
                    Type: Union(f1: OrderedCompletion Expression Integer,...)

which I assume is the Gamma function, but the tex is converted improperly:

    {{|{\overline {\ }}} 
    \left(
    {{3 \over 2}} 
    \right)}
    \over 2 
    \leqno(29)

i.e. clearly does not contain \Gamma.

{|{\overline {\ } == Gamma? --Bill Page, Thu, 23 Dec 2004 01:32:23 -0600 reply
It is possible to convert this peculiar monogram to \Gamma for display but I think the problem is more fundamental. Clearly AXIOM does not have a consistent and complete representation of the Gamma function. I think integrate should at least return a Gamma that can be converted to Float or something of type Expression Integer like sqrt(%pi)/4. But it seems that the current Gamma function always agressively returns a DoubleFloat? value. This doesn't seem very useful to me for symbolic computations.

{|{\overline {\ } == Gamma? --Bob McElrath?, Thu, 23 Dec 2004 01:42:39 -0600 reply
Bill, What is the type that is returned there? How can I get axiom to print the entire type rather than ...?

I think therein lies the problem. Note that

axiom
integrate(x^2*(exp(-x^2)), x=0..%plusInfinity)::InputForm
LatexWiki Image(4)
Type: InputForm?

seems correct.

P.S. IssueTracker? + axiom rules. Having axiom right here is so powerful... I will have to pay more attention to IssueTracker?. I was half thinking to strip it when (if) I fork zwiki. Right now IssueTracker? is a big hack that can't be uninstalled...

this is not a math bug, only the output is not as nice as it could be --kratt6, Wed, 19 Jan 2005 08:34:21 -0600 reply
Category: Axiom Mathematics => Axiom User Interface Severity: normal => minor

I think this is a math bug! --Bill Page, Wed, 19 Jan 2005 08:54:51 -0600 reply
I disagree. There is something fundamentally wrong here. The result of
axiom
integrate(x^2*(exp(-x^2)), x=0..%plusInfinity)
LatexWiki Image(5)
Type: Union(f1: OrderedCompletion? Expression Integer,...)

Not only prints oddly without conversion to proper LaTeX? but also it is not actually recognized "mathematically" as Gamma().

Further, there is something wrong with the implementation of Gamma() itself because it only works numerically and is of no use symbolically. It seems like there are two separate Gamma functions. The one produced by the integration is "symbolic" but does not seem to be connected to any appropriate logic.

6501a8c0@Asus">this is not a mathbug, only the output is not as nice as it could be --Bill Page, 6501a8c0@Asus">Wed, 19 Jan 2005 09:20:12 -0600 reply

Category: Axiom Mathematics => Axiom User Interface Severity: normal => minor

:)

This shows where your priorities are Martin! But, thanks.

Some User Interface issue is involved here, but I don't think that it is quite correct to classify it this way. The issue is really what symbollic computations are possible in Axiom involving Gamma? I would say that this is more of a deficiency in the mathmatics.

Name: #6 wrong integration result => #6 integration result Gamma not TeXed correctly

Here is a simple patch:
  diff -c /home/martin/fricas/src/algebra/op.spad.pamphlet\~ /home/martin/fricas/src/algebra/op.spad.pamphlet
  *** /home/martin/fricas/src/algebra/op.spad.pamphlet~ 2007-12-23 18:14:48.000000000 +0100
  --- /home/martin/fricas/src/algebra/op.spad.pamphlet  2007-12-23 19:14:41.000000000 +0100
  ***************
  *** 443,449 ****
        dpi l    == "%pi"::Symbol::O
        dfact x  == postfix("!"::Symbol::O, (ATOM(x)$Lisp => x; paren x))
        dquote l == prefix(quote(first(l)::O), rest l)
  !     dgamma l == prefix(hconcat(super("|"::Symbol::O, "-"::Symbol::O)), l)
        setDummyVar(op, n) == setProperty(op, DUMMYVAR, n pretend None)

        dexp x ==
  --- 443,468 ----
        dpi l    == "%pi"::Symbol::O
        dfact x  == postfix("!"::Symbol::O, (ATOM(x)$Lisp => x; paren x))
        dquote l == prefix(quote(first(l)::O), rest l)
  !     dgamma l == prefix(super("|"::Symbol::O, "-"::Symbol::O), l)
  ! @
  ! 
  ! It is certainly an abuse of [[OutputForm]] to produce a Gamma as done above.
  ! Originally, it was even worse:
  ! <img alt="LatexWiki Image" class="equation" src="images/6088886649565853660-18.0px.png" width="703" height="33"/>
  ! which was TeXed to
  ! <a name="unnumbered"><table width="95%"><tr><td align="center" width="95%"><img alt="LatexWiki Image" class="equation" src="images/8760961923361831896-18.0px.png" width="67" height="18"/></td><td width="5%" align="right">&nbsp;</td></tr></table></a>
  ! 
  ! The right thing would be to introduce Greek letters in [[OutputForm]], but that
  ! should be coordinated with the new mathml package.
  ! 
  ! <<package COMMONOP CommonOperators>>=
        setDummyVar(op, n) == setProperty(op, DUMMYVAR, n pretend None)

        dexp x ==

Warning: Gamma looks slightly different in ASCII then. A better patch is discussed on the FriCAS? list, 23.12.2007

Martin