Re: [sage-devel] Re: Piecewise affine functions
Though it sounds like you only need piecewise functions of a single real variable, I would suggest to make the ticket for piecewise linear (or polynomial) functions of several variables. The current implementation of piecewise in Sage is tied to the general symbolics in the symbolic ring. Instead, the new class would make piecewise functions elements of a separate parent. In my applications, I would need the parents to be in different categories. In the first application, it would be either in the category of vector spaces. In the second application, I would like to give this parent the category of an inverse semigroup: multiplication would be composition and inverse would be the functional inverse. On Thursday, October 25, 2018 at 3:05:31 PM UTC-7, Xavier Caruso wrote: > > Le vendredi 19 octobre 2018, Matthias Koeppe a écrit : > > Ticket (for piecewise linear functions, polyhedral domains) at > > https://trac.sagemath.org/ticket/26512 > > Thanks for opening this ticket. > > I went through your code. > I guess that what I need is essentialy the classes "FastLinearFunction" > and "FastPiecewise" (except that the latter doesn't implement composition > and inverse but I can probably do it by myself, at least for piecewise > linear functions). > > However, it's still not clear to me how we should integrate this in the > current distribution of Sage. Your class "FastPiecewise" inherits from > sage.functions.piecewise_old.PiecewisePolynomial which is deprecated now. > Moreover, we cannot just use sage.functions.piecewise.Piecewise instead > since its design is different from yours (e.g. your __add__ corresponds > to piecewise_add, etc.) > > --Xavier > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Report for critical bug on CoCalc
On Fri, Oct 26, 2018 at 11:58 AM Maestro CaID wrote: > > Please i want to report a critical bug, Because it's dangereuse if public see > it, That's why i'm looking for an email to send the details of this bug to > the support team privately. h...@sagemath.com >Thanks, > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- William (http://wstein.org) -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Report for critical bug on CoCalc
Please i want to report a critical bug, Because it's dangereuse if public see it, That's why i'm looking for an email to send the details of this bug to the support team privately. Thanks, -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Re: number field: exactness of result of abs
On Friday, October 26, 2018 at 9:07:58 AM UTC-7, Daniel Krenn wrote: > > What my troubles are, is that by using abs my computation gets inexact, > which I want to avoid at all cost. > (So I think I just have to treat CyclotomicFields etc. special) > > Yes, that indicates you are probably more interested in a relative norm than in an absolute value, if exactness matters for you. The right target to take values in would probably be (if K is a cyclotomic field): K.maximal_totally_real_subfield() For arbitrary number fields with a complex embedding, the associated real field might not be a subfield (for that you need the corresponding complex conjugation to be an element of the automorphism group over Q). -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Bug with NumberField
Le 26/10/2018 à 16:04, John Cremona a écrit : On Fri, 26 Oct 2018 at 13:07, 'Paul Mercat' via sage-devel < sage-devel@googlegroups.com> wrote: Hi ! I have a strange bug with NumberField: when I do sage: pi = x^7 - 2*x^6 + x^3 - 2*x^2 + 2*x - 1 sage: b = pi.roots(ring=QQbar)[3][0] sage: pi = b.minpoly() sage: K = NumberField(pi, 'b', embedding=b) it works well. But if I execute it a second time, then it never terminates! Do you have a explanation and a correction to this problem ? How strange. The first 3 lines are fine the second time. So is the number field construction when you leave out the embedding. When a number field is constructed it is cached so that a new construction returns the same object, and not a copy, where possible. In your case that means checking that the embeddings are the same, which means checking that two elements of QQbar are the same. That can be expensive. If you do b1 = pi.roots(ring=QQbar)[3][0] b2 = pi.roots(ring=QQbar)[3][0] and then b1==b2 it also takes ages. I cannot remember the algorithm here but it does not look optimal; it may be working effectively in a field of degree 7*6 or possibly 7!. I note that d=b1-b2 d==0 yields True immediately. There is a shortcut for this kind of issues in qqbar.py implemented with the function (line 2158) def cmp_elements_with_same_minpoly(a, b, p) Apparently this is avoided in the present situation... Vincent -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Re: number field: exactness of result of abs
Thank you for your detailed explaination. On 2018-10-25 11:09, John Cremona wrote: > Personally I cannot think of a reason why one would want this abs() to > be returned as an algebraic number, since the whole point of absolute > values in algebraic number theory is that they like in some completion > (RR, CC, Qp or an extension of Qp). One could try to special-case > cyclotomic fields -- which makes sense *only* because they have an > automorphism of order 2 which can be identified with complex conjugation > -- but a function whose return values had a parent which depended on the > input would surely not be useful. What my troubles are, is that by using abs my computation gets inexact, which I want to avoid at all cost. (So I think I just have to treat CyclotomicFields etc. special) Daniel -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Bug with NumberField
Thank you. So the bug is with the test of equality in QQbar, not with NumberField. Do you know how to solve this problem with QQbar ? I tried to look at where is the error, and it looks like there is an infinite loop: /Users/mercatp/sage-8.2/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_compiled.pyx in sage.rings.polynomial.polynomial_compiled.abc_pd.eval (build/cythonized/sage/rings/polynomial/polynomial_compiled.c:6599)()506 507 cdef int eval(abc_pd self, object vars, object coeffs) except -2:--> 508 pd_eval(self.left, vars, coeffs)509 pd_eval(self.right, vars, coeffs)510 self.value = self.left.value * self.right.value + coeffs[self.index] /Users/mercatp/sage-8.2/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_compiled.pyx in sage.rings.polynomial.polynomial_compiled.pd_eval (build/cythonized/sage/rings/polynomial/polynomial_compiled.c:3574)()352 cdef inline int pd_eval(generic_pd pd, object vars, object coeffs) except -2: 353 if pd.value is None:--> 354 pd.eval(vars, coeffs)355 pd.hits += 1356 But I don't know how to avoid this loop, because I don't know what do this code... Paul Le vendredi 26 octobre 2018 16:04:57 UTC+2, John Cremona a écrit : > > > > On Fri, 26 Oct 2018 at 13:07, 'Paul Mercat' via sage-devel < > sage-...@googlegroups.com > wrote: > >> Hi ! >> >> I have a strange bug with NumberField: when I do >> >> sage: pi = x^7 - 2*x^6 + x^3 - 2*x^2 + 2*x - 1 >> sage: b = pi.roots(ring=QQbar)[3][0] >> sage: pi = b.minpoly() >> sage: K = NumberField(pi, 'b', embedding=b) >> >> it works well. But if I execute it a second time, then it never >> terminates! >> Do you have a explanation and a correction to this problem ? >> > > How strange. The first 3 lines are fine the second time. So is the > number field construction when you leave out the embedding. > > When a number field is constructed it is cached so that a new construction > returns the same object, and not a copy, where possible. In your case that > means checking that the embeddings are the same, which means checking that > two elements of QQbar are the same. That can be expensive. > > If you do > b1 = pi.roots(ring=QQbar)[3][0] > b2 = pi.roots(ring=QQbar)[3][0] > > and then > > b1==b2 > > it also takes ages. I cannot remember the algorithm here but it does not > look optimal; it may be working effectively in a field of degree 7*6 or > possibly 7!. I note that > > d=b1-b2 > d==0 > > yields True immediately. > > John > > >> >> Thank, >> Paul >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sage-devel" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to sage-devel+...@googlegroups.com . >> To post to this group, send email to sage-...@googlegroups.com >> . >> Visit this group at https://groups.google.com/group/sage-devel. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Bug with NumberField
On Fri, 26 Oct 2018 at 13:07, 'Paul Mercat' via sage-devel < sage-devel@googlegroups.com> wrote: > Hi ! > > I have a strange bug with NumberField: when I do > > sage: pi = x^7 - 2*x^6 + x^3 - 2*x^2 + 2*x - 1 > sage: b = pi.roots(ring=QQbar)[3][0] > sage: pi = b.minpoly() > sage: K = NumberField(pi, 'b', embedding=b) > > it works well. But if I execute it a second time, then it never terminates! > Do you have a explanation and a correction to this problem ? > How strange. The first 3 lines are fine the second time. So is the number field construction when you leave out the embedding. When a number field is constructed it is cached so that a new construction returns the same object, and not a copy, where possible. In your case that means checking that the embeddings are the same, which means checking that two elements of QQbar are the same. That can be expensive. If you do b1 = pi.roots(ring=QQbar)[3][0] b2 = pi.roots(ring=QQbar)[3][0] and then b1==b2 it also takes ages. I cannot remember the algorithm here but it does not look optimal; it may be working effectively in a field of degree 7*6 or possibly 7!. I note that d=b1-b2 d==0 yields True immediately. John > > Thank, > Paul > > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Bug with NumberField
Hi ! I have a strange bug with NumberField: when I do sage: pi = x^7 - 2*x^6 + x^3 - 2*x^2 + 2*x - 1 sage: b = pi.roots(ring=QQbar)[3][0] sage: pi = b.minpoly() sage: K = NumberField(pi, 'b', embedding=b) it works well. But if I execute it a second time, then it never terminates! Do you have a explanation and a correction to this problem ? Thank, Paul -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.