Ask Your Question

Revision history [back]

When you write sqrt(8.0), Sage calls the sqrt method of the floating-point number 8.0 (an element of RR). Hence you get a floating-point number. As you noticed, the sqrt method for integers returns elements of the symbolic ring.

When you write 80.0 / pi, Sage uses coercion (look at the manual for more details about this important concept in Sage) : it first searches for the common parent between floating-point 8.0 and symbolic \pi, which is the symbolic ring, it transforms the two elements in this parent, and does the division there. So, in that case,8.0is first transformed into a symbolic8.0|and then divided by the symbolicpi`, which results in an element of the symbolic ring.

If you want the division between two floating-point numbers, and get a floating-point number, you can use the floating-point number version of $pi$, which is RR.pi():

sage: 8.0 / RR.pi()
2.54647908947033

When you write sqrt(8.0), Sage calls the sqrt method of the floating-point number 8.0 (an element of RR). Hence you get a floating-point number. As you noticed, the sqrt method for integers returns elements of the symbolic ring.

When you write 80.0 / pi, Sage uses coercion (look at the manual for more details about this important concept in Sage) : it first searches for the common parent between floating-point 8.0 and symbolic \pipi, which is the symbolic ring, it transforms the two elements in this parent, and does the division there. So, in that case,case, 8.0 is first transformed into a symbolicsymbolic 8.0| and then divided by the symbolicpi`, symbolic \pi, which results in an element of the symbolic ring.

If you want the division between two floating-point numbers, and get a floating-point number, you can use the floating-point number version of $pi$, which is RR.pi():

sage: 8.0 / RR.pi()
2.54647908947033

When you write sqrt(8.0), Sage calls the sqrt method of the floating-point number 8.0 (an element of RR). Hence you get a floating-point number. As you noticed, the sqrt method for integers returns elements of the symbolic ring.

When you write 80.0 / pi, Sage uses coercion (look at the manual for more details about this important concept in Sage) : it first searches for the common parent between floating-point 8.0 and symbolic pi, which is the symbolic ring, it transforms the two elements in this parent, and does the division there. So, in that case, 8.0 is first transformed into a symbolic 8.0|8.0 and then divided by the symbolic \pipi, which results in an element of the symbolic ring.

If you want the division between two floating-point numbers, and get a floating-point number, you can use the floating-point number version of $pi$, $pi$, which is RR.pi():isRR.pi()`:

sage: 8.0 / RR.pi()
2.54647908947033

When you write sqrt(8.0), Sage calls the sqrt method of the floating-point number 8.0 (an element of RR). Hence you get a floating-point number. As you noticed, the sqrt method for integers returns elements of the symbolic ring.

When you write 80.0 / pi, Sage uses coercion (look at the manual for more details about this important concept in Sage) : it first searches for the common parent between floating-point 8.0 and symbolic pi, which is the symbolic ring, it transforms the two elements in this parent, and does the division there. So, in that case, 8.0 is first transformed into a symbolic 8.0 and then divided by the symbolic pi, which results in an element of the symbolic ring.

If you want the division between two floating-point numbers, and get a floating-point number, you can use the floating-point number version of $pi$, $pi$, which isRR.pi()`:is RR.pi():

sage: 8.0 / RR.pi()
2.54647908947033

When you write sqrt(8.0), Sage calls the sqrt method of the floating-point number 8.0 (an element of RR). Hence you get a floating-point number. As you noticed, noticed in your first example, the sqrt method for integers returns elements of the symbolic ring.

When you write 80.0 / pi, Sage uses coercion (look at the manual for more details about this important concept in Sage) : it first searches for the common parent between floating-point 8.0 and symbolic pi, which is the symbolic ring, it transforms the two elements in this parent, and does the division there. So, in that case, 8.0 is first transformed into a symbolic 8.0 and then divided by the symbolic pi, which results in an element of the symbolic ring.

If you want the division between two floating-point numbers, and get a floating-point number, you can use the floating-point number version of $pi$, which is RR.pi():

sage: 8.0 / RR.pi()
2.54647908947033

When you write sqrt(8.0), Sage calls the sqrt method of the floating-point number 8.0 (an element of RR). Hence you get a floating-point number. As you noticed in your first example, the sqrt method for integers returns elements of the symbolic ring.

When you write 80.0 / pi, Sage uses coercion (look at the manual for more details about this important concept in Sage) : it first searches for the common parent between floating-point 8.0 and symbolic pi, which is the symbolic ring, it transforms the two elements in this parent, and does the division there. So, in that case, 8.0 is first transformed into a symbolic 8.0 and then divided by the symbolic pi, which results in an element of the symbolic ring.

If you want the division between two floating-point numbers, and get a floating-point number, you can use the floating-point number version of $pi$, which is RR.pi():

sage: 8.0 / RR.pi()
2.54647908947033

When you write sqrt(8.0), Sage calls the sqrt method of the floating-point number 8.0 (an element of RR). Hence you get a floating-point number. As you noticed in your first example, the sqrt method for (non square) integers returns elements of the symbolic ring.

When you write 80.0 / pi, Sage uses coercion (look at the manual for more details about this important concept in Sage) : it first searches for the common parent between floating-point 8.0 and symbolic pi, which is the symbolic ring, it transforms the two elements in this parent, and does the division there. So, in that case, 8.0 is first transformed into a symbolic 8.0 and then divided by the symbolic pi, which results in an element of the symbolic ring.

If you want the division between two floating-point numbers, and get a floating-point number, you can use the floating-point number version of $pi$, which is RR.pi():

sage: 8.0 / RR.pi()
2.54647908947033

When you write sqrt(8.0), Sage calls the sqrt method of the floating-point number 8.0 (an element of RR). Hence you get a floating-point number. As you noticed in your first example, the sqrt method for (non square) integers returns elements of the symbolic ring.ring SR.

When you write 80.0 / pi, Sage uses coercion (look at the manual for more details about this important concept in Sage) : it first searches for the common parent between floating-point 8.0 and symbolic pi, which is the symbolic ring, it transforms the two elements in this parent, and does the division there. So, in that case, 8.0 is first transformed into a symbolic 8.0 and then divided by the symbolic pi, which results in an element of the symbolic ring.

If you want the division between two floating-point numbers, and get a floating-point number, you can use the floating-point number version of $pi$, which is RR.pi():

sage: 8.0 / RR.pi()
2.54647908947033

Note that pi is nothing else than SR.pi(), you can redefine pi = RR.pi() if you want to type things more easily.

When you write sqrt(8.0), Sage calls the sqrt method of the floating-point number 8.0 (an element of RR). Hence you get a floating-point number. As you noticed in your first example, the sqrt method for (non square) integers returns elements of the symbolic ring SR.

When you write 80.0 / pi, Sage uses coercion (look at the manual for more details about this important concept in Sage) : it first searches for the common parent between floating-point 8.0 and symbolic pi, which is the symbolic ring, it transforms the two elements in this parent, and does the division there. So, in that case, 8.0 is first transformed into a symbolic 8.0 and then divided by the symbolic pi, which results in an element of the symbolic ring.

If you want the division between two floating-point numbers, and get a floating-point number, you can use the floating-point number version of $pi$, $\pi$, which is RR.pi():

sage: 8.0 / RR.pi()
2.54647908947033

Note that pi is nothing else than SR.pi(), you can redefine pi = RR.pi() if you want to type things more easily.