Well, it depends what "interval" wants to express.
[0.0, 4.0] is correct in the sense that all values that lie in x their
square lies in [0.0, 4.0]. Maybe it is not the closest interval that is
possible. Given that the implementation of interval(a,b) rounds up and
down accordingly, your patch should be safe.
Ralf
On 5/7/26 11:26, 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.
- 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/ef7f3006-0d58-4015-b230-2c14e2f91836%40hemmecke.org.