lo <= 0 =>
           even?(denom(n)) =>
               error "fractional power only defined for x > 0"
           even?(numer(n)) =>
               hi < 0 =>
                   interval(hi^n, lo^n)      -- lo < hi <=0
               interval(0, max(lo^n, hi^n))  -- lo <=0 < hi
           interval(lo^n, hi^n)              -- lo <=0, odd power
      interval(lo^n, hi^n)                   -- lo > 0


I think there is no problem in other branch?

Also, I just found out that Interval supports negative fractional
power, but not negative integer power.

AIntervalCategory does not support both.

I guess that Interval did not want to deal with inverse of
[a,b] where a<0<b?

- Qian

On 5/11/26 8:20 AM, Waldek Hebisch wrote:
> On Thu, May 07, 2026 at 05:26:02PM +0800, Qian Yun wrote:
>> (1) -> x := interval(-2.0,-1.0)$Interval Float
>>
>>    (1)  [- 2.0, - 1.0]
>>                                Type: Interval(Float)
>> (2) -> x^(2/1)
>>
>>    (2)  [0.0, 4.0000000000_000000001]
>>                                Type: Interval(Float)
>> (3) -> x^2
>>
>>    (3)  [0.9999999999_9999999999, 4.0000000000_000000001]
>>                                 Type: Interval(Float)
>>
>>
>> Notice that for the fractional power (2/1), the answer is wrong.
> 
> As Ralf noted the anwer is not strictly speaking wrong, just
> suboptimal.  AFAICS one could get better intervals in other
> case, by adding something like:
> 
>                   0 < lo => interval(lo^n, hi^n)
> 
> 0 is only needed for case when lo <= 0 <= hi
> 
>> - Qian
>>
>> diff --git a/src/algebra/interval.spad b/src/algebra/interval.spad
>> index 180b1c7b..8bd84ec1 100644
>> --- a/src/algebra/interval.spad
>> +++ b/src/algebra/interval.spad
>> @@ -429,7 +429,7 @@
>>                 error "fractional power only defined for x > 0"
>>             even?(numer(n)) =>
>>                 hi < 0 =>
>> -                   interval(0, lo^n)
>> +                   interval(hi^n, lo^n)
>>                 interval(0, max(lo^n, hi^n))
>>             interval(lo^n, hi^n)
>>        interval(lo^n, hi^n)
> 

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/fricas-devel/8fa3166f-f808-4a21-a2ea-c963c16f14a4%40gmail.com.

Reply via email to