Opened 11 years ago

Closed 7 years ago

# Sage mixes Infinity and +Infinity

Reported by: Owned by: zimmerma robertwb major sage-duplicate/invalid/wontfix coercion infinity, equality N/A

### Description

This is related to #8942. The limit function can output either `+Infinity`, `-Infinity`, or `Infinity`, the later meaning a complex infinity. For example:

```sage: limit(1/x, x=0, dir='above')
+Infinity
sage: limit(1/x, x=0, dir='below')
-Infinity
sage: limit(1/x, x=0)
Infinity
```

However Sage does not distinguish `+Infinity` and `Infinity`:

```sage: l1=limit(1/x, x=0, dir='above')
sage: l2=limit(1/x, x=0, dir='below')
sage: l3=limit(1/x, x=0)
sage: l1==l3
True
```

### comment:1 Changed 11 years ago by burcin

• Component changed from calculus to coercion
• Milestone set to sage-4.5.3
• Owner changed from burcin to robertwb

This is more of a problem with the equality checking rules in Sage and the coercion system than symbolics, so I'm changing the component to coercion.

If the arguments compare equal when coerced to a common parent, Sage returns `True` for the equality. In this case, the coercion goes to the `UnsignedInfinityRing`, where `+Infinity` is mapped to `unsigned_infinity`.

```sage: UnsignedInfinityRing.has_coerce_map_from(InfinityRing)
True
sage: Infinity
+Infinity
sage: UnsignedInfinityRing.coerce(Infinity)
Infinity
```

BTW, isn't there an inconsistency in the capitalization of `Infinity`. Shouldn't it be lowercase according to Python conventions?

### comment:2 Changed 9 years ago by tscrim

Sometimes it's `infinity` and others its `Infinity`. At the very least this should be consistent. Also there are other issues with infinity: #11506 #9547.

### comment:3 Changed 8 years ago by jdemeyer

• Milestone changed from sage-5.11 to sage-5.12

### comment:4 Changed 8 years ago by zimmerma

• Status changed from new to needs_review

in Sage 5.11 we get:

```sage: l1=limit(1/x, x=0, dir='right'); l1
+Infinity
sage: l2=limit(1/x, x=0, dir='left'); l2
-Infinity
sage: l3=limit(1/x, x=0); l3
Infinity
sage: bool(l1==l2), bool(l2==l3), bool(l3==l1)
(False, False, False)
```

however the objects returned are in SR and not in the `infinity` class:

```sage: type(l1), l1.parent()
(sage.symbolic.expression.Expression, Symbolic Ring)
sage: p1=+Infinity
sage: type(p1), p1.parent()
(sage.rings.infinity.PlusInfinity, The Infinity Ring)
```

I propose to close that ticket, and open a new one about the above issue (or add it to an existing ticket).

Paul

### comment:5 Changed 8 years ago by zimmerma

or add it to an existing ticket

I've added a comment in #14857

Paul

### comment:6 Changed 7 years ago by ncohen

• Status changed from needs_review to needs_info

No patch to review on this ticket...

Paul : when you want to close a ticket, you should set its milestone to wontfix/duplicate, say why on a comment, and change the status to `positive_review` so that the release manager will see it.

Nathann

### comment:7 Changed 7 years ago by zimmerma

• Resolution set to fixed
• Status changed from needs_info to closed

in Sage 6.0 we get:

```sage: l1=limit(1/x, x=0, dir='above')
sage: l3=limit(1/x, x=0)
sage: bool(l1==l3)
False
```

thus the issue is fixed now, and I change the status to "fixed".

Paul

### comment:8 Changed 7 years ago by zimmerma

sorry when changing to "fixed" (which made more sense to me than invalid or wontfix) the status was changed automatically to "closed"...

Paul

### comment:9 Changed 7 years ago by tscrim

• Milestone changed from sage-6.1 to sage-duplicate/invalid/wontfix

I also verified that it works in `6.1.beta2`.

Note: See TracTickets for help on using tickets.