[sage-devel] Re: Integral is divergent (playing with floor and ceil)

2017-03-15 Thread rjf
I don't know how much verbiage to contribute to this notion of
"returning infinity"  being open to question.
Just a few notes.
When we say integrate from 0 to infinity,  is  "infinity" a value?  Not 
really.
We are asking about the computation of integration from 0 to Z
where Z increases without limit in the positive real direction. 
 Specifically,
does it approach a finite value?  Or alternatively, does it not have
a specific limit (e.g. oscillates)  or does it increase beyond any finite 
value?
  This last alternative is not the same as "returns a finite value named 
infinity"
because you can do arithmetic with finite values that you can't do with
infinity.
  If a user types in infinity, it is a shorthand for some kind of language
involving limits.  Even if the user doesn't acknowledge or realize that.
Returning infinity is inevitably problematical, even if the system goes
to the effort of simplifying  infinity-infinity  to something like 
"indefinite".
Somewhat more supportive of continued computation is an interval [-oo,oo]. 
  
In this context oo can be identified as a special signifier for an interval
that is unbounded at one or both ends.  Not that it has the value infinity
at an endpoint.

Sometimes doing math by computer ends up requiring subtleties.
RJF 

On Monday, March 13, 2017 at 5:53:33 AM UTC-7, kcrisman wrote:
>
> As it happens, in this case the underlying problem is that we send such 
> unevaluated integrals to GSL when asked for a numerical approximation, 
> which can't handle this kind.  Raising some kind of error or divergence 
> notification makes more sense than returning infinity in any case.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Integral is divergent (playing with floor and ceil)

2017-03-15 Thread rjf


On Sunday, March 12, 2017 at 4:38:41 AM UTC-7, Peleg Michaeli wrote:
>
> > you might  simplify  infinity-infinityto 0,
> Well, this is the wrong thing here... but sage is smarter than that, I 
> believe.
>
>
>>> I truly doubt that.   There are presumably many subsystems that can make
this mistake.  One of them is the Maxima system that is in Sage.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Integral is divergent (playing with floor and ceil)

2017-03-13 Thread kcrisman
As it happens, in this case the underlying problem is that we send such 
unevaluated integrals to GSL when asked for a numerical approximation, 
which can't handle this kind.  Raising some kind of error or divergence 
notification makes more sense than returning infinity in any case.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Integral is divergent (playing with floor and ceil)

2017-03-12 Thread Peleg Michaeli
> you might  simplify  infinity-infinityto 0,
Well, this is the wrong thing here... but sage is smarter than that, I 
believe.

On Saturday, 11 March 2017 19:09:07 UTC+2, rjf wrote:
>
>
>
> On Wednesday, March 1, 2017 at 2:11:41 AM UTC-8, Peleg Michaeli wrote:
>>
>> Hi,
>>
>> I have two questions, one might be thought of as a bug report / feature 
>> request, please tell me what you think. Trying
>> integrate(x, x, 0, infinity)
>> raises ValueError: Integral is divergent.
>>
>> My first question: why it does not simply return infinity? 
>>
>
> Arguably,  infinity  as an answer is bogus, and it might be more
> appropriate to signal a problem.  
>
> Why?   If you return such an answer and continue to compute with it
> (without displaying it ever to the user)  you might  simplify 
>  infinity-infinity
> to 0,  infinity/infinity to 1,  etc.  So you would never know that you
> did bogus arithmetic, and just get a bogus answer.
>
>  
>
>> (it does, by the way, if one chooses algorithm='sympy')
>>
>> Now, trying
>> integrate(ceil(x), x, 0, infinity)
>> returns something weird:
>> limit(1/2*(2*x + 1)*ceil(x) - 1/2*ceil(x)^2, x, +Infinity, minus)
>> and trying to evaluate it with `.n()` raises TypeError.
>>
>> My second question: why it does not return infinity / raises ValueError: 
>> Integral is divergent..?
>>
>> And now, two more observations, which are certainly bugs:
>>
>> Bug 1: running
>> integrate(ceil(x), x, 0, infinity, algorithm='sympy')
>> raises AttributeError: 'module' object has no attribute 'ceiling'. I am 
>> not sure, but I think that the problem is that in sympy there's no `ceil` 
>> but rather `ceiling`.
>>
>> Bug 2: running
>> integrate(floor(x), x, 0, infinity, algorithm='sympy')
>> returns
>> integrate(floor(x), x, 0, +Infinity)
>> and trying to evaluate it with `.n()` returns (!!)
>> -679.7441466712775
>>
>> Should I open 2 tickets for these last two bugs?
>>
>>
>> Thanks,
>> Peleg.
>>
>>
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Integral is divergent (playing with floor and ceil)

2017-03-11 Thread rjf


One other possibility for symbolic systems when the question when
the object in question cannot be simplified or evaluated, is to return
the unsimplified or unevaluated expression.
The simplest case might be something like

is (a>b)   which, in the absence of any information
about the values of a and b,  just returns "itself"  rather than
an error or "unknown".

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Integral is divergent (playing with floor and ceil)

2017-03-11 Thread rjf


On Wednesday, March 1, 2017 at 2:11:41 AM UTC-8, Peleg Michaeli wrote:
>
> Hi,
>
> I have two questions, one might be thought of as a bug report / feature 
> request, please tell me what you think. Trying
> integrate(x, x, 0, infinity)
> raises ValueError: Integral is divergent.
>
> My first question: why it does not simply return infinity? 
>

Arguably,  infinity  as an answer is bogus, and it might be more
appropriate to signal a problem.  

Why?   If you return such an answer and continue to compute with it
(without displaying it ever to the user)  you might  simplify 
 infinity-infinity
to 0,  infinity/infinity to 1,  etc.  So you would never know that you
did bogus arithmetic, and just get a bogus answer.

 

> (it does, by the way, if one chooses algorithm='sympy')
>
> Now, trying
> integrate(ceil(x), x, 0, infinity)
> returns something weird:
> limit(1/2*(2*x + 1)*ceil(x) - 1/2*ceil(x)^2, x, +Infinity, minus)
> and trying to evaluate it with `.n()` raises TypeError.
>
> My second question: why it does not return infinity / raises ValueError: 
> Integral is divergent..?
>
> And now, two more observations, which are certainly bugs:
>
> Bug 1: running
> integrate(ceil(x), x, 0, infinity, algorithm='sympy')
> raises AttributeError: 'module' object has no attribute 'ceiling'. I am 
> not sure, but I think that the problem is that in sympy there's no `ceil` 
> but rather `ceiling`.
>
> Bug 2: running
> integrate(floor(x), x, 0, infinity, algorithm='sympy')
> returns
> integrate(floor(x), x, 0, +Infinity)
> and trying to evaluate it with `.n()` returns (!!)
> -679.7441466712775
>
> Should I open 2 tickets for these last two bugs?
>
>
> Thanks,
> Peleg.
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Integral is divergent (playing with floor and ceil)

2017-03-10 Thread Peleg Michaeli
Reported in
https://trac.sagemath.org/ticket/22566
and in
https://trac.sagemath.org/ticket/22567


On Thursday, 2 March 2017 11:56:05 UTC+2, Ralf Stephan wrote:
>
> Opening a ticket for bugs is always a good idea.
>
> On Wednesday, March 1, 2017 at 11:11:41 AM UTC+1, Peleg Michaeli wrote:
>>
>> Hi,
>>
>> I have two questions, one might be thought of as a bug report / feature 
>> request, please tell me what you think. Trying
>> integrate(x, x, 0, infinity)
>> raises ValueError: Integral is divergent.
>>
>> My first question: why it does not simply return infinity? (it does, by 
>> the way, if one chooses algorithm='sympy')
>>
>> Now, trying
>> integrate(ceil(x), x, 0, infinity)
>> returns something weird:
>> limit(1/2*(2*x + 1)*ceil(x) - 1/2*ceil(x)^2, x, +Infinity, minus)
>> and trying to evaluate it with `.n()` raises TypeError.
>>
>> My second question: why it does not return infinity / raises ValueError: 
>> Integral is divergent..?
>>
>> And now, two more observations, which are certainly bugs:
>>
>> Bug 1: running
>> integrate(ceil(x), x, 0, infinity, algorithm='sympy')
>> raises AttributeError: 'module' object has no attribute 'ceiling'. I am 
>> not sure, but I think that the problem is that in sympy there's no `ceil` 
>> but rather `ceiling`.
>>
>> Bug 2: running
>> integrate(floor(x), x, 0, infinity, algorithm='sympy')
>> returns
>> integrate(floor(x), x, 0, +Infinity)
>> and trying to evaluate it with `.n()` returns (!!)
>> -679.7441466712775
>>
>> Should I open 2 tickets for these last two bugs?
>>
>>
>> Thanks,
>> Peleg.
>>
>>
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Integral is divergent (playing with floor and ceil)

2017-03-02 Thread Ralf Stephan
Opening a ticket for bugs is always a good idea.

On Wednesday, March 1, 2017 at 11:11:41 AM UTC+1, Peleg Michaeli wrote:
>
> Hi,
>
> I have two questions, one might be thought of as a bug report / feature 
> request, please tell me what you think. Trying
> integrate(x, x, 0, infinity)
> raises ValueError: Integral is divergent.
>
> My first question: why it does not simply return infinity? (it does, by 
> the way, if one chooses algorithm='sympy')
>
> Now, trying
> integrate(ceil(x), x, 0, infinity)
> returns something weird:
> limit(1/2*(2*x + 1)*ceil(x) - 1/2*ceil(x)^2, x, +Infinity, minus)
> and trying to evaluate it with `.n()` raises TypeError.
>
> My second question: why it does not return infinity / raises ValueError: 
> Integral is divergent..?
>
> And now, two more observations, which are certainly bugs:
>
> Bug 1: running
> integrate(ceil(x), x, 0, infinity, algorithm='sympy')
> raises AttributeError: 'module' object has no attribute 'ceiling'. I am 
> not sure, but I think that the problem is that in sympy there's no `ceil` 
> but rather `ceiling`.
>
> Bug 2: running
> integrate(floor(x), x, 0, infinity, algorithm='sympy')
> returns
> integrate(floor(x), x, 0, +Infinity)
> and trying to evaluate it with `.n()` returns (!!)
> -679.7441466712775
>
> Should I open 2 tickets for these last two bugs?
>
>
> Thanks,
> Peleg.
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.