[sage-support] Generating functions slow in Sage?
Some of you may want to know about this question: http://stackoverflow.com/questions/25570037/best-language-to-do-some-annoying-generating-function-computations excerpt: The computation relies on a few ingredients. 1. The first is that I need to be able to compute characters of the symmetric group in an efficient manner. 2. The next thing is that I need to arrange these into a generating function. This will end up being a generating function in many, many variables, although it will be truncated to a finite degree. 3. Finally, I need to take the formal logarithm (which will be a generating function in the same number of variables, of the same degree) of this and to extract a specific coefficient. I have coded this before in Maple, but I don't have access to Maple any more. I was thinking of doing so in Sage, but step 1 seems not to be well implemented (although there is a workaround, but it doesn't seem to be very efficient). Furthermore, I'm pretty sure that while steps 2 and 3 are fine in principle, they are very, very slow in Sage. -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: apparent numerical integration bug in sage
f1(x)=1/sqrt(x^3+2) f2(x)=1/sqrt(x^4+2) r1=RR(integrate(f1(x),(x,1,10^(10 r2=RR(integrate(f2(x),(x,1,10^(10 s1=RR(integrate(f1(x),(x,1,10^(11 s2=RR(integrate(f2(x),(x,1,10^(11 Note that probably using something like sage: numerical_integral(f2,1,10^8) (0.8815690504421161, 3.309409685784312e-09) would be better here, since Sage isn't doing the symbolic integration in any case (Maxima is fairly weak on this kind of integral). The integrals to 10^(10) are being evaluated more or less correctly, as is the integral of f1 to 10^(11), but the integral of f2 to 10^(11) is wrong by about seven orders of magnitude. sage: numerical_integral(f2,1,10^8) (0.8815690504421161, 3.309409685784312e-09) sage: numerical_integral(f2,1,10^9) (0.8815690594421439, 2.7280605832086615e-08) sage: numerical_integral(f2,1,10^10) (0.8815690603426408, 6.194229607849825e-07) sage: numerical_integral(f2,1,4.5*10^10) (0.8815690604198958, 2.5079492928729825e-11) sage: numerical_integral(f2,1,10^11) (2.3214916598860602e-07, 4.5569931705290324e-07) Yeah, that is annoying. Something similar happens with our other standard numerical integration procedure: sage: f2.nintegrate(x,1,100) (0.8815680604421181, 1.6586910832421555e-12, 819, 0) sage: f2.nintegrate(x,1,1000) (-1.02652395e-07, 9.9265675869388e-15, 861, 5) Interestingly, going to infinity avoids this: sage: numerical_integral(f2,1,oo) (0.8815690604419927, 5.603223703062511e-08) Or use sage: numerical_integral(f2,10^10,10^11) (9.001e-11, 9.99200722162641e-25) This uses the Gnu Scientific Library. Perhaps this is a limitation of how it is constructed. But I have a feeling someone else who knows more about the internals of quadrature methods will have more info, so for now I've opened http://trac.sagemath.org/ticket/16905 for this bug. Thank you! -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] monomials of polynomial_zz_pex.Polynomial_ZZ_pEX
Dears members, How I will be able to extract the monomials of univariate polynomial ring P of type polynomial_zz_pex.Polynomial_ZZ_pEX? K = GF(2^128,'t') PR.X = PolynomialRing(K,X) P = PR.random_element() -- - MSc. Juan del Carmen Grados Vásquez Laboratório Nacional de Computação Científica Tel: +55 21 97633 3228 (http://www.lncc.br/) http://juaninf.blogspot.com - -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] monomials of polynomial_zz_pex.Polynomial_ZZ_pEX
Dear Juan, Here is an example, {{{ sage: K = GF(2^128,'t') sage: PR.X = PolynomialRing(K,X) sage: P = PR.random_element() sage: P[0] # constant coeff (in X) ... sage: P[10] # coeff of degree 10 ... }}} But be careful, if the polynomial P has degree less than 10 then the code P[10] will raise an exception. Vincent -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: apparent numerical integration bug in sage
On 2014-08-29, kcrisman kcris...@gmail.com wrote: sage: numerical_integral(f2,1,10^8) (0.8815690504421161, 3.309409685784312e-09) sage: numerical_integral(f2,1,10^9) (0.8815690594421439, 2.7280605832086615e-08) sage: numerical_integral(f2,1,10^10) (0.8815690603426408, 6.194229607849825e-07) sage: numerical_integral(f2,1,4.5*10^10) (0.8815690604198958, 2.5079492928729825e-11) sage: numerical_integral(f2,1,10^11) (2.3214916598860602e-07, 4.5569931705290324e-07) This uses the Gnu Scientific Library. Perhaps this is a limitation of how it is constructed. But I have a feeling someone else who knows more about the internals of quadrature methods will have more info, so for now I've opened http://trac.sagemath.org/ticket/16905 for this bug. Thank you! Sage punts numerical integrals to QUADPACK or a translation of it, right? QUADPACK is based on Gauss-Kronrod rules which are essentially Gaussian integration + an efficient refinement scheme. To determine whether to refine the estimate, the integrand is evaluated at some points. The difficulty with 1/sqrt(x^4 + 2) is that it is nearly zero for much of the interval (1, 10^11). If it is close enough to zero at the evaluation points, the refinement heuristic can be fooled. Probably other quadrature methods can be fooled in a similar way. I guess this is a bug in the sense that the result is far from correct even though the code is a correct implementation of the method. I wonder what other heuristic could be invented -- maybe since we can see that integrals on shorter intervals are much larger and the integrand is nonnegative, the integral on the whole interval must be at least that large -- perhaps that can be formalized. I am trying the examples with QUADPACK functions in Maxima -- I find that quad_qags(f2, x, 1, 10^11) fails (with error=5, integral is probably divergent or slowly convergent) but quad_qag(f2, x, 1, 10^11, 4) succeeds, likewise quad_qagi(f2, x, 1, inf) succeeds. If Sage is indeed calling QUADPACK, perhaps at least the error number can be reported? For what it's worth, Robert Dodier -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] a bug with region_plot -- please help!
Dear all, Let's draw two discs with region_plot: sage: disc1= region_plot(lambda x, y : x^2+y^2 1, (x, -1, 1), (y, -1, 1)) sage: disc2= region_plot(lambda x, y : (x-0.7)^2+(y-0.7)^2 0.5, (x, -2, 2), (y, -2, 2) ) If we plot them separately, no problem. However if we try sage: disc1 + disc2 then one of the discs disappears almost entirely ! This is sage 6.2 on a MacBook. Does anyone know if there's a workaround? I've been writing some code to draw (filled) hyperbolic triangles in the unit disc model (sage knows how to do the upper half plane model). It was working fine with region_plot when I was drawing the triangles individually. Then I wrote up some code to draw a tiling (quite a lot of time, as you can imagine!), and was really disappointed to see the end result all scrambled because of this bug! should I use something other than region_plot? thanks! Pierre -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: a bug with region_plot -- please help!
PS the tilings work fine in the upper half-plane, using hyperbolic_triangle. It looks as though whoever wrote hyperbolic_triangle did not rely on region_plot. On what, then? trying hyperbolic_triangle?? was pretty useless, it told me that hyperbolic_triangle relies on HyperbolicTriangle, whose definition I don't know how to find. On Friday, August 29, 2014 7:19:32 PM UTC+2, Pierre wrote: Dear all, Let's draw two discs with region_plot: sage: disc1= region_plot(lambda x, y : x^2+y^2 1, (x, -1, 1), (y, -1, 1)) sage: disc2= region_plot(lambda x, y : (x-0.7)^2+(y-0.7)^2 0.5, (x, -2, 2), (y, -2, 2) ) If we plot them separately, no problem. However if we try sage: disc1 + disc2 then one of the discs disappears almost entirely ! This is sage 6.2 on a MacBook. Does anyone know if there's a workaround? I've been writing some code to draw (filled) hyperbolic triangles in the unit disc model (sage knows how to do the upper half plane model). It was working fine with region_plot when I was drawing the triangles individually. Then I wrote up some code to draw a tiling (quite a lot of time, as you can imagine!), and was really disappointed to see the end result all scrambled because of this bug! should I use something other than region_plot? thanks! Pierre -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] Re: a bug with region_plot -- please help!
Salut Pierre! Let's draw two discs with region_plot: sage: disc1= region_plot(lambda x, y : x^2+y^2 1, (x, -1, 1), (y, -1, 1)) sage: disc2= region_plot(lambda x, y : (x-0.7)^2+(y-0.7)^2 0.5, (x, -2, 2), (y, -2, 2) ) If we plot them separately, no problem. However if we try sage: disc1 + disc2 I confirm the bug on sage.6.4.beta2. PS the tilings work fine in the upper half-plane, using hyperbolic_triangle. It looks as though whoever wrote hyperbolic_triangle did not rely on region_plot. On what, then? trying hyperbolic_triangle?? was pretty useless, it told me that hyperbolic_triangle relies on HyperbolicTriangle, whose definition I don't know how to find. To track further the code you can use the magic import_statements inside Sage which tells you where to find a class/function {{{ sage: import_statements('HyperbolicTriangle') from sage.plot.hyperbolic_triangle import HyperbolicTriangle sage: HyperbolicTriangle?? }}} It appears that it uses BezierPaths. One work around would be to use directly matplotlib which is much more tested/supported/complete than Sage graphics. Personnally, I am using Sage graphics only when I have a complex object like a graph. If I just want to play with discs/lines/regions I use directly matplotlib (http://matplotlib.org/) or even Pillow (https://pillow.readthedocs.org). Both of them are shipped with Sage. Good luck, Vincent -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Generating functions slow in Sage?
On 2014-08-29, kcrisman kcris...@gmail.com wrote: Some of you may want to know about this question: http://stackoverflow.com/questions/25570037/best-language-to-do-some-annoying-generating-function-computations excerpt: The computation relies on a few ingredients. 1. The first is that I need to be able to compute characters of the symmetric group in an efficient manner. do you mean that the following http://www.sagemath.org/doc/reference/combinat/sage/combinat/sf/sf.html#sage.combinat.sf.sf.SymmetricFunctions (scroll down to Representation theory of the symmetric group) is slow? 2. The next thing is that I need to arrange these into a generating function. This will end up being a generating function in many, many variables, although it will be truncated to a finite degree. 3. Finally, I need to take the formal logarithm (which will be a generating function in the same number of variables, of the same degree) of this and to extract a specific coefficient. I have coded this before in Maple, but I don't have access to Maple any more. I was thinking of doing so in Sage, but step 1 seems not to be well implemented (although there is a workaround, but it doesn't seem to be very efficient). Furthermore, I'm pretty sure that while steps 2 and 3 are fine in principle, they are very, very slow in Sage. -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Solving system of nonlinear equations
Hello - I'm an experienced developer but new to Sage. I've stumbled into a somewhat complex system of equations and I'm trying to solve them under certain conditions. I have a system of equations: var('x y h k r t d') eq1 = x^2 + y^2 == d^2 eq2 = y == tan(t) * x eq3 = (x-h)^2 + (y-k)^2 == r^2 eq4 = -1 * r k r eq5 = -1 * r h r I'm trying to solve these equations in two ways: 1. I'd like to pass in a set of values for t and d for a given r and approximate h and k. I'm expecting around 30-50 values and some will be less accurate than others so I need a way to cull bad values. 2. I'd like to pass in t, h, k, r and get the possible values for d (there can be two, if I'm not mistaken) Can anyone point me at the functions that I can use to solve these equations or have any suggestions for the solutions? I appreciate the help. Chris -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Solving system of nonlinear equations
On Friday, August 29, 2014 6:46:39 PM UTC+2, Chris Corio wrote: Can anyone point me at the functions that I can use to solve these equations or have any suggestions for the solutions? I appreciate the help. Sage's solve is explicit, I don't know if it gives you a solution. What you probably actually need is a numerical approximation. There is http://www.sagemath.org/doc/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.minimize_constrained although SLSQP in SciPy http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.fmin_slsqp.html is maybe best for you. In eq1 to eq3, subtract the right hand side from the left hand side, as lambda functions, and that list is eqcons. The bounds on k and h are in bounds. Also, set the objective function function to lambda : 1, what does count are the constraints. That's a general answer, I hope I really understood what you want. Make sure to check which version of scipy there is in Sage and which one the documentation refers to. It could be outdated. -- H -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] Solving system of nonlinear equations
Hello Chris, 2014-08-29 18:46 UTC+02:00, Chris Corio chris.co...@gmail.com: somewhat complex system of equations and I'm trying to solve them under certain conditions. I have a system of equations: var('x y h k r t d') eq1 = x^2 + y^2 == d^2 eq2 = y == tan(t) * x eq3 = (x-h)^2 + (y-k)^2 == r^2 eq4 = -1 * r k r eq5 = -1 * r h r I'm trying to solve these equations in two ways: 1. I'd like to pass in a set of values for t and d for a given r and approximate h and k. I'm expecting around 30-50 values and some will be less accurate than others so I need a way to cull bad values. 2. I'd like to pass in t, h, k, r and get the possible values for d (there can be two, if I'm not mistaken) Can anyone point me at the functions that I can use to solve these equations or have any suggestions for the solutions? I appreciate the help. A first step is to use the method `.subs` (for substitute) of symbolic expressions as in the following {{{ sage: var('x y h k r t d') (x, y, h, k, r, t, d) sage: eq1 = x^2 + y^2 == d^2 sage: eq2 = y == tan(t) * x sage: eq3 = (x-h)^2 + (y-k)^2 == r^2 sage: eq4 = -1 * r k r sage: eq5 = -1 * r h r sage: eqs = [eq1,eq2,eq3,eq4,eq5] sage: for (r0,t0,d0) in [(1,2,3),(4,5,6)]: : sub_eqs = [eq.subs(r=r0,t=t0,d=d0) for eq in eqs] : print sub_eqs : [x^2 + y^2 == 9, y == x*tan(2), (h - x)^2 + (k - y)^2 == 1, -1 k, -1 h] [x^2 + y^2 == 36, y == x*tan(5), (h - x)^2 + (k - y)^2 == 16, -4 k, -4 h] }}} Vincent -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: apparent numerical integration bug in sage
On Friday, August 29, 2014 7:15:27 PM UTC+2, Robert Dodier wrote: QUADPACK ... I've tried this in mpmath's quad. I think it works there, but maybe I've overlooked the actual problem. sage: import mpmath as mp sage: f1 = lambda _ : 1. / mp.sqrt(_^3 + 2) sage: f2 = lambda _ : 1. / mp.sqrt(_^4 + 2) sage: mp.quad(f1, [1, 10^9]) mpf('1.8280370240753521') sage: mp.quad(f1, [1, 10^10]) mpf('1.8280802692664053') sage: mp.quad(f1, [1, 4.5 * 10^10]) mpf('1.8280908397677311') sage: mp.quad(f1, [1, 10^11]) mpf('1.8280939410898087') sage: mp.quad(f1, [1, 10^12]) mpf('1.8280982294340853') sage: mp.quad(f2, [1, 10^9]) mpf('0.88156905940188868') sage: mp.quad(f2, [1, 10^10]) mpf('0.88156905993967871') sage: mp.quad(f2, [1, 4.5 * 10^10]) mpf('0.88156905860896162') sage: mp.quad(f2, [1, 10^11]) mpf('0.88156905640783767') -- H -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] Re: a bug with region_plot -- please help!
To track further the code you can use the magic import_statements inside Sage which tells you where to find a class/function {{{ sage: import_statements('HyperbolicTriangle') from sage.plot.hyperbolic_triangle import HyperbolicTriangle sage: HyperbolicTriangle?? }}} It appears that it uses BezierPaths. I see. In turn the filling property is inherited from the BezierPath class. I've had a look at the code but I can hardly understand anything. One work around would be to use directly matplotlib which is much more tested/supported/complete than Sage graphics. Personnally, I am using Sage graphics only when I have a complex object like a graph. If I just want to play with discs/lines/regions I use directly matplotlib (http://matplotlib.org/) or even Pillow (https://pillow.readthedocs.org). Both of them are shipped with Sage. well yes, i should probably learn this one day, but i have a lot of code already with sage plots everywhere, so... an auxilliary question: does anyone know a quick-and-dirty way of converting a sage plot to an array of pixels? (something understandable like foo[i,j] is an RGB value or something). And also how to save such an array into jpg or something? i could drawy everything in the upper half plane, get the pixels values, and use a moebius transformation then... not so elegant but it would work... -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] backward substitution during solving polynomial equation
I want to solve polynomial equations and in order to do so, I do something like: sage: R.x,y = PolynomialRing(QQ, order='lex') sage: I = R.ideal([x*y-1, x^2-y^2]) sage: I.groebner_basis() [x - y^3, y^4 - 1] Now I have to take the equation with only one variable, find the solutions for it (over so QQ or so) and use each of the possible solitions in the equation with the two variables and solve again and so on. What is the Sage command to do this operation, i.e., backwards substituting to find a solution? (solve seems to be very much an overkill and it is not that transparent in what it does...) Daniel -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] Re: a bug with region_plot -- please help!
To track further the code you can use the magic import_statements inside Sage which tells you where to find a class/function {{{ sage: import_statements('HyperbolicTriangle') from sage.plot.hyperbolic_triangle import HyperbolicTriangle sage: HyperbolicTriangle?? }}} Or search_src(foo) is often very helpful. It appears that it uses BezierPaths. I see. In turn the filling property is inherited from the BezierPath class. I've had a look at the code but I can hardly understand anything. I'll look at this - it's almost certainly a zorder issue. -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] Re: a bug with region_plot -- please help!
It appears that it uses BezierPaths. I see. In turn the filling property is inherited from the BezierPath class. I've had a look at the code but I can hardly understand anything. I will note that someone didn't actually doctest _hyperbolic_arc, grr! I'll look at this - it's almost certainly a zorder issue. I mean the original problem, sorry. -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: a bug with region_plot -- please help!
On Friday, August 29, 2014 1:19:32 PM UTC-4, Pierre wrote: Dear all, Let's draw two discs with region_plot: sage: disc1= region_plot(lambda x, y : x^2+y^2 1, (x, -1, 1), (y, -1, 1)) sage: disc2= region_plot(lambda x, y : (x-0.7)^2+(y-0.7)^2 0.5, (x, -2, 2), (y, -2, 2) ) If we plot them separately, no problem. However if we try sage: disc1 + disc2 then one of the discs disappears almost entirely ! This is sage 6.2 on a MacBook. If you do disc2 + disc1 you will see some of what is going on. If you change disc1= region_plot(lambda x, y : x^2+y^2 1, (x, -1, 1), (y, -1, 1), incol='red', outcol='orange') you will really start having fun :) I hadn't seen the plots yet when I said zorder - this is more of a cancellation thing going on with two uses of matplotlib and will take a little more thought, because probably we are somewhat abusing things by using contourf twice in the same subplot. -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: a bug with region_plot -- please help!
This is now http://trac.sagemath.org/ticket/16907 -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Question About Finite Field propertie in polynomial ring
Hello, Let be the field q = 2 K.t = GF(q^n) and the Polynomial Ring PR = PolynomialRing(K,X) Let be a random monomial of PR for example P = t*X^(q^a). Is there any method in sage to reduce X degree of polynomial P, such that equivalent polynomial is t*X^(q^b) where b = mod(P.degree(X)-1,n) Does the following do what you want? sage: n = 5; q = 2^n sage: K.t = FiniteField(q) sage: PR.X = PolynomialRing(K) sage: Q.Xbar = PR.quotient(X^q - X) sage: t*Xbar^(2*q) t*Xbar^2 Peter -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] backward substitution during solving polynomial equation
(solve seems to be very much an overkill and it is not that transparent in what it does...) Definitely! And I won't even believe the output... I want to solve polynomial equations and in order to do so, I do something like: sage: R.x,y = PolynomialRing(QQ, order='lex') sage: I = R.ideal([x*y-1, x^2-y^2]) sage: I.groebner_basis() [x - y^3, y^4 - 1] What is the Sage command to do this operation, i.e., backwards substituting to find a solution? One possibility (I do not think there is a ready made function) sage: sage: R.x,y = PolynomialRing(QQ, order='lex') sage: sage: I = R.ideal([x*y-1, x^2-y^2]) sage: sage: I.groebner_basis() [x - y^3, y^4 - 1] sage: f1, f2 = I.groebner_basis() sage: Ry.y = PolynomialRing(QQ) sage: Rx.x = PolynomialRing(QQbar) sage: roots_y = Ry(f2).roots(QQbar) sage: print roots_y [(-1, 1), (1, 1), (-1*I, 1), (1*I, 1)] sage: for r,_ in roots_y: :for s,_ in Rx(f1.subs(y=r)).roots(QQbar): :print (s,r) (-1, -1) (1, 1) (1*I, -1*I) (-1*I, 1*I) Vincent -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: apparent numerical integration bug in sage
Sage punts numerical integrals to QUADPACK or a translation of it, What does GSL use? I forgot that Scipy also has quadrature, in addition to Maxima... wealth of riches. right? QUADPACK is based on Gauss-Kronrod rules which are essentially Gaussian integration + an efficient refinement scheme. To determine whether to refine the estimate, the integrand is evaluated at some points. The difficulty with 1/sqrt(x^4 + 2) is that it is nearly zero for much of the interval (1, 10^11). If it is close enough to zero at the evaluation points, the refinement heuristic can be fooled. Probably other quadrature methods can be fooled in a similar way. I guess this is a bug in the sense that the result is far from correct even though the code is a correct implementation of the method. I wonder what other heuristic could be invented -- maybe since we can see that integrals on shorter intervals are much larger and the integrand is nonnegative, the integral on the whole interval must be at least that large -- perhaps that can be formalized. I am trying the examples with QUADPACK functions in Maxima -- I find that quad_qags(f2, x, 1, 10^11) fails (with error=5, integral is probably divergent or slowly convergent) but quad_qag(f2, x, 1, 10^11, 4) succeeds, likewise quad_qagi(f2, x, 1, inf) succeeds. If Sage is indeed calling QUADPACK, perhaps at least the error number can be reported? That would be the nintegrate() method on symbolic expressions, and indeed sage: f2.nintegrate(x,1,100) (0.8815680604421181, 1.6586910832421555e-12, 819, 0) sage: f2.nintegrate(x,1,1000) (-1.02652395e-07, 9.9265675869388e-15, 861, 5) so the 5 in the latter is the error code, which we even document as - ``5`` - integral is probably divergent or slowly convergent Also, gp seems to handle it. sage: gp.eval('intnum(x=1,1000,1/sqrt(x^4+2))') '0.88156906043147435374520375967552406680' sage: gp.eval('intnum(x=1,1,1/sqrt(x^4+2))') '0.88156906044791138558085421922579474969' Harald, thanks. I think now we have six or seven ways to do quadrature in Sage! According to https://www.gnu.org/software/gsl/manual/html_node/Numerical-Integration.html#Numerical-Integration GSL does indeed reimplement QUADPACK, so I'm not sure what we should do here. -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: apparent numerical integration bug in sage
On 2014-08-29, kcrisman kcris...@gmail.com wrote: sage: gp.eval('intnum(x=1,1000,1/sqrt(x^4+2))') '0.88156906043147435374520375967552406680' sage: gp.eval('intnum(x=1,1,1/sqrt(x^4+2))') '0.88156906044791138558085421922579474969' Hmm, what method does PARI/GP use? The documentation for intnum doesn't seem to mention any algorithms. ... I just looked at the source code (intnum.c) and I can't tell what's going on. There is some code for Romberg's method (intnumromb) but it's not called from intnum. Harald, thanks. I think now we have six or seven ways to do quadrature in Sage! Yes, but most of them are QUADPACK, right? best Robert Dodier -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: apparent numerical integration bug in sage
Hello Robert, Hmm, what method does PARI/GP use? The documentation for intnum doesn't seem to mention any algorithms. ... I just looked at the source code (intnum.c) and I can't tell what's going on. There is some code for Romberg's method (intnumromb) but it's not called from intnum From the PARI user's manual, chapter 3: Starting with version 2.2.9 the ``double exponential'' univariate integration method is implemented in intnum and its variants. Romberg integration is still available under the name intnumromb, but superseded. Peter -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.