[fricas-devel] Simple Gaussian integral fails

2018-11-08 Thread Marduk
Dear all, I just tried calculating this integral (I defined inf ==> %plusInfinity) integrate(exp(-a^2*x^2),x=-inf..inf) in FriCAS 1.3.4 and it failed. Why? Best regards, Marduk -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system"

[fricas-devel] Re: Simple Gaussian integral fails

2018-11-08 Thread Marduk
Interesting. I did some experiments and it seems that limit(erf(M*x), x=inf) returns 1 whenever FriCAS can determine that M > 0. In particular M=a^2 and M=exp(a) work, whereas M=a does not. However, M = abs(a) does not work either. Now I have some questions: 1) Why does not sqrt(a^2) return

Re: [fricas-devel] Re: Simple Gaussian integral fails

2018-11-08 Thread Ralf Hemmecke
> 1) Why does not sqrt(a^2) return abs(a)? OK, let's try with a being the imaginary unity. (4) -> sqrt(%i^2) (4) %i Type: Expression(Complex(Integer)) (5) -> abs(%i) (5) abs(%i) FriCAS does not simplify abs(%i). So it's left unspecified. You

Re: [fricas-devel] Re: Factor a polynomial in the argument of an exponential

2018-11-08 Thread Ralf Hemmecke
> In particular, there must be a way of defining a type for an > exponential of a factored polynomial. Of course, there is. However, I guess, you don't want to program this just for the following. > I am not interested in factorizing the exponential for doing a > calculation, it is just for

Re: [fricas-devel] Re: Factor a polynomial in the argument of an exponential

2018-11-08 Thread Marduk
> > PS: BTW, what does have TeXmacs have to do with this FriCAS question? > I use TeXmacs as a frontend for FriCAS. I would like to be able to use the expressions generated by the CAS directly in my notes, papers, etc. But apparently, it takes some work to get that done. Thanks anyway for

Re: [fricas-devel] Factor a polynomial in the argument of an exponential

2018-11-08 Thread Ralf Hemmecke
Hi Marduk, > I would like to convert exp(-a^2*x^2 - a^2*y^2) into exp(-a^2*(x^2 + > y^2)). I don't know either. Maybe it would be easier to help if you explain the actual problem you want to solve. Perhaps this factorization is not really necessary. It might even be that your rule (whatever it

Re: [fricas-devel] Simple Gaussian integral fails

2018-11-08 Thread Ralf Hemmecke
I suspect, the problem lies in the limit computation. Ralf (1) -> i := integrate(exp(-a^2*x^2),x)::Expression(Integer) +--+ +---+ | 2 \|%pi erf(x\|a ) (1) - +--+ | 2 2 \|a

Re: [fricas-devel] Re: Simple Gaussian integral fails

2018-11-08 Thread Marduk
> > OK, let's try with a being the imaginary unity. > I thought that by default FriCAS assumes that variables are real. > Because it is just an operator and a can be anything. Fair enough. Then one should be able to specify on which domain an operator is acting and abs(a) | a is real

[fricas-devel] Re: Factor a polynomial in the argument of an exponential

2018-11-08 Thread Marduk
Hi Ralf, Thank you for your prompt reply. I understand that FriCAS works different from other CA systems. To me it is like using Haskell for doing computer algebra. And I think that is a very interesting approach. I am not a computer scientist, but I think it should be possible to do the

[fricas-devel] Factor a polynomial in the argument of an exponential

2018-11-08 Thread Marduk
Dear all, I would like to convert exp(-a^2*x^2 - a^2*y^2) into exp(-a^2*(x^2 + y^2)). However, it seems that exp converts its argument presumably to Expression Integer, and since FriCAS always expands products the factorization is lost. For more general expressions, I would like to write a

Re: [fricas-devel] Re: Simple Gaussian integral fails

2018-11-08 Thread Ralf Hemmecke
> I must say that it is highly disappointing that to this date there > is no serious free-software alternative to Mathematica. It all depends on what you want to do. > The three programs mentioned above have been developed for about > 40-50 years by very capable computer scientists and

Re: [fricas-devel] Re: Factor a polynomial in the argument of an exponential

2018-11-08 Thread oldk1331
I was also having some thoughs about factoring Expression. I think it's doable, especially for displaying purpose. We can use "paren"/"box" to keep the factors. A quick sketch: (25) -> exp map(x+->box(x::EXPR INT),factor numer first argument mainKernel exp(-a^2*x^2 - a^2*y^2)) 2

Re: [fricas-devel] Re: Factor a polynomial in the argument of an exponential

2018-11-08 Thread Ralf Hemmecke
> We can use "paren"/"box" to keep the factors. I was thinking about "box", but not in such a sophisticated way as you did. Comes probably from my dislike of Expression(X). ;-) Ralf > (25) -> exp map(x+->box(x::EXPR INT),factor numer first argument > mainKernel exp(-a^2*x^2 - a^2*y^2)) > >

Re: [fricas-devel] Re: Simple Gaussian integral fails

2018-11-08 Thread Riccardo GUIDA
1) Why does not sqrt(a^2) return abs(a)? IIUC: When operating on a symbolic expression x in Expression R, the operator sqrt "represents an arbitrary (but always the same through the code) solution y of the algebraic equation y^2=x". Even when R = Integer, there are still 2 real roots y that

Re: [fricas-devel] Simple Gaussian integral fails

2018-11-08 Thread oldk1331
I think it's doable. First, by default, "limit" is for real expression (there are accompanying "complexLimit"), so it knows "sqrt(a)" is positive: (8) -> limit(sqrt(a)*x,x=%plusInfinity) (8) + infinity So in theory, it should also compute for "erf(sqrt(a)*x)", but: (9) ->

[fricas-devel] Re: Re: Simple Gaussian integral fails

2018-11-08 Thread Riccardo GUIDA
On 11/8/18 1:05 PM, Marduk wrote: 3) How can one tell FriCAS that a>0 in the Gaussian integral? Write a=A^2 : (1) -> inf ==> %plusInfinity; integrate(exp(-A^4*x^2),x=-inf..inf) ┌───┐ \│%pi (1) ── 2 A Type: Union(f1: