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

Here are some integration problems.

Test1

Start here:

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

\label{eq1}\frac{{{e}^{2}}\ {\sqrt{2}}\ {\sqrt{\pi}}}{\sqrt{2 \  \pi}}(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)

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

We are using the following version of FriCAS:

fricas
)version
"FriCAS 1.3.9 compiled at Fri Sep 15 09:22:33 PM CEST 2023"

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

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

But FriCAS can do indefinite integral

fricas
integrate(x^n*exp(-x^2/2), x)

\label{eq4}-{{{e}^{\frac{{\left(n - 1 \right)}\ {\log \left({2}\right)}}{2}}}\ {\Gamma \left({{\frac{n + 1}{2}}, \:{\frac{{x}^{2}}{2}}}\right)}}(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.

... --None reply
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 \int_{-1}^2 f(t) dt= 1, 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 >= 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 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.

Currently conditional expressions are not supported. Axiom used to evaluate such examples using its internal order on expressions, which gave unexpected results. From users point of view the results were wrong.




  Subject: (replying)   Be Bold !!
  ( 14 subscribers )  
Please rate this page: