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

Edit detail for Definite Integration revision 1 of 8

1 2 3 4 5 6 7 8
Editor: 127.0.0.1
Time: 2007/11/15 20:10:11 GMT-8
Note: transferred from axiom-developer

changed:
-
Here are some integration problems submitted by "Anonymous". In
at least one example, Axiom generated a 'segmentation fault'. We
will see if we can reproduce the problem here in a more controlled
environment.

Test1

Start here:
\begin{axiom}
integrate(x/sqrt(2*%pi)*exp(-1/2*log(x)**2),x=0..%plusInfinity)
\end{axiom}

Test2

Might not work:
\begin{axiom}
integrate(1/sqrt(2*%pi)*exp(-1/2*log(x)**2),x=0..%plusInfinity, noPole)
\end{axiom}

Test3

A simpler integration:
\begin{axiom}
integrate(1/sqrt(2*%pi)*exp(-1/2*x**2),x=%minusInfinity..%plusInfinity)
\end{axiom}

We are using the following version of Axiom:
\begin{axiom}
)version
\end{axiom}


From HPW Sat Jan 22 06:14:31 -0600 2005
From: HPW
Date: Sat, 22 Jan 2005 06:14:31 -0600
Subject: 
Message-ID: <20050122061431-0600@page.axiom-developer.org>

Another definite integral
\begin{axiom}
integrate(x^n*exp(-x^2/2), x=0..%plusInfinity,"noPole")
\end{axiom}

What if the positive Integer is declare as a positiveInteger 
or even chosen, say, as 2:
\begin{axiom}
n:PositiveInteger
integrate(x^n*exp(-x^2/2), x=0..%plusInfinity)
integrate(x^2*exp(-x^2/2), x=0..%plusInfinity)
\end{axiom}



From BillPage Mon Jan 24 14:11:55 -0600 2005
From: Bill Page
Date: Mon, 24 Jan 2005 14:11:55 -0600
Subject: declaring 'n' as PositiveInteger
Message-ID: <20050124141155-0600@page.axiom-developer.org>

I think the idea that one should be able to "declare the type" of a
variable in Axiom by the command
\begin{axiom}
n:PositiveInteger
\end{axiom}

is a frequent expectation of new users of Axiom - especially if one
have used other computer algebra systems, after all Axiom is supposed
to be a "strongly typed" system, right? Certainly I was surprized (and
disappointed) by Axiom's limitations in this reguard.

Unfortunately Axiom does not attempt to use this type information
when forming expressions - but worse - declaring the type actually
interferes with the use of the variable to form expressions!

When you write
\begin{axiom}
n:PositiveInteger
\end{axiom}
what this tells Axiom is that 'n' will be assigned an integer
value greater than 0 - only that. After it is actually assigned
some value, then it can be used exactly like that value, but
not before.

To me, this is a tremedous waste of an opportunity in Axiom to
to deal with "domain of computation" issues such as are
addressed in other untyped computer algebra systems by the use
of "assumptions" such as::

  assume(x,PositiveInteger);

Such knowledge can be used to considerably improve the quality
and generality of the computations.



From unknown Sat Mar 12 08:25:13 -0600 2005
From: 
Date: Sat, 12 Mar 2005 08:25:13 -0600
Subject: Another problem with integrate
Message-ID: <20050312082513-0600@page.axiom-developer.org>

Consider the following piecewise function:
\begin{axiom}
f(x | (x >=0) and (x <=1) ) == 1
f(x | (x<0) or (x > 1)) == 0
\end{axiom}
It is obvious that $\int_{-1}^2 f(t) dt= 1$, while Axiom claims otherwise:
\begin{axiom}
integrate(f(t), t=-1..2)
\end{axiom}
What's worse, it doesn't say that it cannot calsulate it, but it simply gives an incorrect result! Haven't I first tested it with such a simple example I wouldn't even know, the results are wrong. Any clue how to serve Axiom such function, so that it integrates them correctly? Is this a bug in Axiom or I'm doing something wrong? TIA

Here are some integration problems submitted by "Anonymous". In at least one example, Axiom generated a segmentation fault. We will see if we can reproduce the problem here in a more controlled environment.

Test1

Start here:

axiom
integrate(x/sqrt(2*%pi)*exp(-1/2*log(x)**2),x=0..%plusInfinity)

\label{eq1}\mbox{\tt "failed"}(1)
Type: Union(fail: failed,...)

Test2

Might not work:

axiom
integrate(1/sqrt(2*%pi)*exp(-1/2*log(x)**2),x=0..%plusInfinity, noPole)
There are 4 exposed and 1 unexposed library operations named integrate having 3 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op integrate to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named integrate with argument type(s) Expression(Integer) SegmentBinding(OrderedCompletion(Integer)) Variable(noPole)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

Test3

A simpler integration:

axiom
integrate(1/sqrt(2*%pi)*exp(-1/2*x**2),x=%minusInfinity..%plusInfinity)

\label{eq2}{2 \ {\sqrt{\pi}}}\over{{\sqrt{2}}\ {\sqrt{2 \  \pi}}}(2)
Type: Union(f1: OrderedCompletion?(Expression(Integer)),...)

We are using the following version of Axiom:

axiom
)version
Value = "FriCAS 2010-12-08 compiled at Thursday March 10, 2011 at 19:56:28 "

Another definite integral
axiom
integrate(x^n*exp(-x^2/2), x=0..%plusInfinity,"noPole")

\label{eq3}\mbox{\tt "failed"}(3)
Type: Union(fail: failed,...)

What if the positive Integer is declare as a positiveInteger or even chosen, say, as 2:

axiom
n:PositiveInteger
Type: Void
axiom
integrate(x^n*exp(-x^2/2), x=0..%plusInfinity)
n is declared as being in PositiveInteger but has not been given a value. integrate(x^2*exp(-x^2/2), x=0..%plusInfinity)

\label{eq4}\mbox{\tt "failed"}(4)
Type: Union(fail: failed,...)

declaring n as PositiveInteger? --Bill Page, Mon, 24 Jan 2005 14:11:55 -0600 reply
I think the idea that one should be able to "declare the type" of a variable in Axiom by the command
axiom
n:PositiveInteger
Type: Void

is a frequent expectation of new users of Axiom - especially if one have used other computer algebra systems, after all Axiom is supposed to be a "strongly typed" system, right? Certainly I was surprized (and disappointed) by Axiom's limitations in this reguard.

Unfortunately Axiom does not attempt to use this type information when forming expressions - but worse - declaring the type actually interferes with the use of the variable to form expressions!

When you write

axiom
n:PositiveInteger
Type: Void

what this tells Axiom is that n will be assigned an integer value greater than 0 - only that. After it is actually assigned some value, then it can be used exactly like that value, but not before.

To me, this is a tremedous waste of an opportunity in Axiom to to deal with "domain of computation" issues such as are addressed in other untyped computer algebra systems by the use of "assumptions" such as:

  assume(x,PositiveInteger);

Such knowledge can be used to considerably improve the quality and generality of the computations.

Another problem with integrate
Sat, 12 Mar 2005 08:25:13 -0600 reply
Consider the following piecewise function:
axiom
f(x | (x >=0) and (x <=1) ) == 1
Type: Void
axiom
f(x | (x<0) or (x > 1)) == 0
Type: Void

It is obvious that \int_{-1}^2 f(t) dt= 1, while Axiom claims otherwise:

axiom
integrate(f(t), t=-1..2)
There are 4 exposed and 1 unexposed library operations named < having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op < to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation. Cannot find a definition or applicable library operation named < with argument type(s) Variable(t) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. FriCAS will attempt to step through and interpret the code. There are 4 exposed and 1 unexposed library operations named < having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op < to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named < with argument type(s) Variable(t) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

What's worse, it doesn't say that it cannot calsulate it, but it simply gives an incorrect result! Haven't I first tested it with such a simple example I wouldn't even know, the results are wrong. Any clue how to serve Axiom such function, so that it integrates them correctly? Is this a bug in Axiom or I'm doing something wrong? TIA