Re: [sage-support] QQbar coercion question

2016-10-24 Thread Jeroen Demeyer
On 2016-10-24 17:54, Nils Bruin wrote: Pow is not *that* special. It is more special than you think. Currently, powering does not go through the coercion framework at all. So actions won't get looked up... Of course, this could be changed. However, the *default* implementation of all

Re: [sage-support] QQbar coercion question

2016-10-24 Thread Nils Bruin
On Sunday, October 23, 2016 at 11:33:21 PM UTC-7, Ralf Stephan wrote: > > > Since you say pow is special we can fix this for the special case > exponent in QQbar. Useful? > Pow is not *that* special. Sage does have the notion of "actions" in the coercion framework. The map discovery framework

Re: [sage-support] QQbar coercion question

2016-10-24 Thread Ralf Stephan
Please review https://trac.sagemath.org/ticket/21754 On Monday, October 24, 2016 at 8:44:35 AM UTC+2, vdelecroix wrote: > > On 24 October 2016 at 08:33, Ralf Stephan > wrote: > > On Monday, October 24, 2016 at 8:03:37 AM UTC+2, vdelecroix wrote: > >> > >> Something like

Re: [sage-support] QQbar coercion question

2016-10-24 Thread Vincent Delecroix
On 24 October 2016 at 08:33, Ralf Stephan wrote: > On Monday, October 24, 2016 at 8:03:37 AM UTC+2, vdelecroix wrote: >> >> Something like this. But then it is not possible to do anything with >> this expression (like numerical approximation)... > > > Since you say pow is

Re: [sage-support] QQbar coercion question

2016-10-24 Thread Ralf Stephan
On Monday, October 24, 2016 at 8:03:37 AM UTC+2, vdelecroix wrote: > > Something like this. But then it is not possible to do anything with > this expression (like numerical approximation)... > Since you say pow is special we can fix this for the special case exponent in QQbar. Useful? --

Re: [sage-support] QQbar coercion question

2016-10-24 Thread Vincent Delecroix
On 24 October 2016 at 07:58, Ralf Stephan wrote: > On Sunday, October 23, 2016 at 6:33:30 PM UTC+2, vdelecroix wrote: >> >> But it would be better with SR(2) ^ SR(QQbar(3).sqrt() + >> QQbar(2).sqrt()) working > > > You mean this? > sage: SR(2).power(SR(QQbar(3).sqrt() +

Re: [sage-support] QQbar coercion question

2016-10-23 Thread Ralf Stephan
On Sunday, October 23, 2016 at 6:33:30 PM UTC+2, vdelecroix wrote: > > But it would be better with SR(2) ^ SR(QQbar(3).sqrt() + > QQbar(2).sqrt()) working > You mean this? sage: SR(2).power(SR(QQbar(3).sqrt() + QQbar(2).sqrt()), hold=True) 2^3.146264369941973? -- You received this message

Re: [sage-support] QQbar coercion question

2016-10-23 Thread Vincent Delecroix
But it would be better with SR(2) ^ SR(QQbar(3).sqrt() + QQbar(2).sqrt()) working -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [sage-support] QQbar coercion question

2016-10-23 Thread Jeroen Demeyer
On 2016-10-23 10:33, Vincent Delecroix wrote: In general, pow(a, b) should only depend on parent(a) and parent(b) and not the actual values of a and b. This is how behave all arithmetic operations. +1 I don't see it as a problem that 2^QQbar(1) fails. -- You received this message because you

Re: [sage-support] QQbar coercion question

2016-10-23 Thread Vincent Delecroix
On 23 October 2016 at 08:05, Ralf Stephan wrote: > On Saturday, October 22, 2016 at 6:28:58 PM UTC+2, vdelecroix wrote: >> >> ... The behavior of any operation in Sage is that >> the parent of op(a, b) should only depend on the operator op, >> parent(a) and parent(b). Powers

Re: [sage-support] QQbar coercion question

2016-10-23 Thread Ralf Stephan
On Saturday, October 22, 2016 at 6:28:58 PM UTC+2, vdelecroix wrote: > > ... The behavior of any operation in Sage is that > the parent of op(a, b) should only depend on the operator op, > parent(a) and parent(b). Powers are a bit special but not enough to > use conversion instead of coercion.

Re: [sage-support] QQbar coercion question

2016-10-22 Thread Vincent Delecroix
On 22 October 2016 at 19:08, John Cremona wrote: > On 22 October 2016 at 17:28, Vincent Delecroix > <20100.delecr...@gmail.com> wrote: >> On 22 October 2016 at 16:10, Ralf Stephan wrote: >>> On Saturday, October 22, 2016 at 4:04:55 PM UTC+2, John

Re: [sage-support] QQbar coercion question

2016-10-22 Thread John Cremona
On 22 October 2016 at 17:28, Vincent Delecroix <20100.delecr...@gmail.com> wrote: > On 22 October 2016 at 16:10, Ralf Stephan wrote: >> On Saturday, October 22, 2016 at 4:04:55 PM UTC+2, John Cremona wrote: >>> >>> So Ralf, do you want to catch the case where the exponent in

Re: [sage-support] QQbar coercion question

2016-10-22 Thread Vincent Delecroix
On 22 October 2016 at 16:10, Ralf Stephan wrote: > On Saturday, October 22, 2016 at 4:04:55 PM UTC+2, John Cremona wrote: >> >> So Ralf, do you want to catch the case where the exponent in QQbar is >> actually rational and then do what QQbar already knows how to do >> (raise

Re: [sage-support] QQbar coercion question

2016-10-22 Thread Ralf Stephan
On Saturday, October 22, 2016 at 4:04:55 PM UTC+2, John Cremona wrote: > > So Ralf, do you want to catch the case where the exponent in QQbar is > actually rational and then do what QQbar already knows how to do > (raise to a rational power), returning an element of QQbar; and raise > an

Re: [sage-support] QQbar coercion question

2016-10-22 Thread William Stein
On Sat, Oct 22, 2016 at 6:11 AM, John Cremona wrote: > On 22 October 2016 at 09:37, Ralf Stephan wrote: >> sage: 2*(QQbar(1)) >> 2 >> sage: 2^(QQbar(1)) >> ... >> TypeError: no canonical coercion from Algebraic Field to Rational Field >> >> Why does the

Re: [sage-support] QQbar coercion question

2016-10-22 Thread Ralf Stephan
I see, you're thinking algebraically not computationally. The latter view would try to convert to QQ, and only then try to coerce, in order to catch the rational case first and not give an error where none is expected. On Saturday, October 22, 2016 at 3:11:50 PM UTC+2, John Cremona wrote: > > On

Re: [sage-support] QQbar coercion question

2016-10-22 Thread John Cremona
On 22 October 2016 at 09:37, Ralf Stephan wrote: > sage: 2*(QQbar(1)) > 2 > sage: 2^(QQbar(1)) > ... > TypeError: no canonical coercion from Algebraic Field to Rational Field > > Why does the one work, the other not? Is it a bug? I don't see that as a bug. Any product of an

[sage-support] QQbar coercion question

2016-10-22 Thread Ralf Stephan
sage: 2*(QQbar(1)) 2 sage: 2^(QQbar(1)) ... TypeError: no canonical coercion from Algebraic Field to Rational Field Why does the one work, the other not? Is it a bug? Regards, -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe