ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 13 Jan 2020 23:24:53 +0100Unable to convert string to rational when plus sign is addedhttps://ask.sagemath.org/question/49537/unable-to-convert-string-to-rational-when-plus-sign-is-added/This looks like a bug. The code
QQ('+1')
gives the exception
> TypeError: unable to convert '+1' to a
> rational
This happens with any positive rational, not just 1.
Also, this does not happen with neither
ZZ('+1')
nor
PolynomialRing(QQ,names='x')('+1')
Is this actually a bug? If it is, can someone investigate it and write a trac ticket? I'm quite new to Sagemath and Python and quite unskilled yet to do it properly. Thank you!Jose BroxMon, 13 Jan 2020 23:24:53 +0100https://ask.sagemath.org/question/49537/Weird behaviour/bug with pi and rational exponentshttps://ask.sagemath.org/question/46390/weird-behaviourbug-with-pi-and-rational-exponents/When I type this:
print numerical_approx((4/pi())^(2/1))
print numerical_approx((4/3.14159265358979)^(2/1))
I get
sage: 3.90303389783585e2585827972
1.62113893827741
(note the letter "e" in the 1st line)
This happens on my notebook, on the COCALC server there is a crash.
Has anyone else seen this ? What is the problem there ?kenJ0428Sun, 28 Apr 2019 15:50:23 +0200https://ask.sagemath.org/question/46390/Listing fractionshttps://ask.sagemath.org/question/40928/listing-fractions/Hi, I would like to request help in listing rational numbers. For motivation, the command
> [x for x in IntegerRange(1,10)]
outputs the integers from 1 through 9. Is there a similar command for listing out rational numbers a/b with a and b in the range (x1,y1) and (x2,y2), respectively.
For instance, if a is in range (1,3) and b is in (4,6), I want to return
> [1/4, 1/5, 1/2, 2/5]
On a related note, how can one impose a gcd(x,y)==1 in the following list?
> [(x,y) for x in IntegerRange(1,10) for
> y in IntegerRange(1,10)]ajbFri, 02 Feb 2018 05:03:13 +0100https://ask.sagemath.org/question/40928/