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)

-- 
                              Waldek Hebisch

-- 
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/agEgtJnm5ChyoFt6%40fricas.org.

Reply via email to