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

# Edit detail for Definite Integration revision 6 of 6

 1 2 3 4 5 6 Editor: test1 Time: 2018/01/17 17:33:20 GMT+0 Note:

added:

But FriCAS can do indefinite integral
\begin{axiom}
integrate(x^n*exp(-x^2/2), x)
\end{axiom}
so the problem is due to too weak limit.


Here are some integration problems.

Test1

Start here:

fricas
integrate(x/sqrt(2*%pi)*exp(-1/2*log(x)^2),x=0..%plusInfinity)
 (1)
Type: Union(f1: OrderedCompletion?(Expression(Integer)),...)

Test2

A simpler integration:

fricas
integrate(1/sqrt(2*%pi)*exp(-1/2*x^2),x=%minusInfinity..%plusInfinity)
 (2)
Type: Union(f1: OrderedCompletion?(Expression(Integer)),...)

We are using the following version of FriCAS:

fricas
)version
Value = "FriCAS 1.3.2 compiled at Tue Jan 16 19:11:58 UTC 2018"

Another definite integral
fricas
integrate(x^n*exp(-x^2/2), x=0..%plusInfinity,"noPole")
 (3)
Type: Union(fail: failed,...)

But FriCAS can do indefinite integral

fricas
integrate(x^n*exp(-x^2/2), x)
 (4)
Type: Union(Expression(Integer),...)

so the problem is due to too weak limit.

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

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

I think the idea that one should be able to "declare the type" of a variable in FriCAS by the command
fricas
n:PositiveInteger
Type: Void

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

Unfortunately FriCAS 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

fricas
n:PositiveInteger
Type: Void

what this tells FriCAS 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 FriCAS 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:
fricas
f(x | (x >=0) and (x <=1) ) == 1
Type: Void
fricas
f(x | (x<0) or (x > 1)) == 0
Type: Void

It is obvious that , while FriCAS signals error.

fricas
integrate(f(t), t=-1..2)
There are 1 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 >=
or "$" to specify which version of the function you need. FriCAS will attempt to step through and interpret the code. There are 1 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.