[sage-support] Intended or unintended recursion?
Hi. The following programme looks simple: sage: def posible_values(row,found,maxum): ...result=found ...if row==[]: row=[1] ...if result==[]: result=found=row #Recursion: intended or unintended? ...if max(row)maxum: ... for k in found: ... for p in row: ... if k*p maxum: ...if k*p not in result: result.append(k*p) ...return result ... sage: print posible_values([2,3,5],[],100) [2, 3, 5, 4, 6, 10, 8, 12, 20, 16, 24, 40, 32, 48, 80, 64, 96, 9, 15, 18, 30, 36, 60, 72, 27, 45, 54, 90, 81, 25, 50, 75] To me is the possibility of recursion this way a great plus, but in all documents I could not find any reference. So is this intended in Python/SAGE or is the above example just bad programming? Roland --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: upgrade
On Sun, Aug 24, 2008 at 3:20 PM, Bin Zhang [EMAIL PROTECTED] wrote: William Stein wrote: Try sage: hg_scripts.pull() sage: hg_scripts.merge() and possibly sage: hg_scripts.updae() sage: hg_scripts.merge() cd /home/zhang/src/sage-3.1.1/local/bin hg merge abort: repo has 3 heads - please merge with an explicit rev It says repo has 3 heads, please merge, so you have to explicitly merge. Do hg_sage.heads() to see a list of heads, then do sage: hg_sage.merge(one_of_the_head_numbers) sage: hg_scripts.update() cd /home/zhang/src/sage-3.1.1/local/bin hg update abort: crosses branches (use 'hg merge' or 'hg update -C') then restart sage. On Sun, Aug 24, 2008 at 2:42 AM, Bin Zhang [EMAIL PROTECTED] wrote: Hi, I have upgraded my sage 3.0.6 to 3.1.1 using sage -upgrade. It seems to me it did not upgrade sage-banner: ./sage -- | SAGE Version 3.0.6, Release Date: 2008-07-30 | | Type notebook() for the GUI, and license() for information.| -- sage: version() 'SAGE Version 3.1.1, Release Date: 2008-08-17' Best regards, Bin -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: numerically solving a polynomial system of equations
There is a matlab/octave interface to it. Look at the following reference on http://www.math.uic.edu/~jan/ I don't know more about this since I am also at the moment collecting information on how to solve a large system of polynomial equations. Yun Guan and Jan Verschelde: PHClab: A MATLAB/Octave interface to PHCpack. The abstract and paper . Take a look at the Poster. In IMA Volume 148: Software for Algebraic Geometry, edited by Michael E. Stillman, Nobuki Takayama, and Jan Verschelde. Pages 15-32, Springer- Verlag, 2008. Bhalchandra Thatte On Aug 24, 10:29 pm, mabshoff [EMAIL PROTECTED] dortmund.de wrote: On Aug 24, 2:22 pm, William Stein [EMAIL PROTECTED] wrote: On Sun, Aug 24, 2008 at 2:03 PM, Joshua Kantor [EMAIL PROTECTED] wrote: 1. I would recommend looking at phcpack, it is designed to exploit the special nature of large polynomial systems, however, supposedly I believe it is sometimes difficult to compile, I've never used it but ^ It is written in ADA. And building the GNU Ada compiler from sources is a giant pain unless you have the GNU Ada compiler to bootstrap. I did build some phcpack binaries for x86-64 Linux and it has a tendency to segfault when run on say Debian if the binary was build on a FC8 box and vice versa. I mainly wanted an Itanium binary, but cross compiling the ada toolchain was just plainly not worth it for it. So in conclusion: great code if you can use a binary that works, if you need to build from sources it plainly sucks. The lesson learned here is not to use exotic languages since the (alleged) benefit from using Ada is far outweight by the fact that the practicality of building the code :) SNIP William Stein Cheers, Michael Associate Professor of Mathematics University of Washingtonhttp://wstein.org --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: numerically solving a polynomial system of equations
On Aug 25, 1:21 am, iSAGE [EMAIL PROTECTED] wrote: There is a matlab/octave interface to it. Look at the following reference onhttp://www.math.uic.edu/~jan/ I don't know more about this since I am also at the moment collecting information on how to solve a large system of polynomial equations. Yun Guan and Jan Verschelde: PHClab: A MATLAB/Octave interface to PHCpack. The abstract and paper . Take a look at the Poster. In IMA Volume 148: Software for Algebraic Geometry, edited by Michael E. Stillman, Nobuki Takayama, and Jan Verschelde. Pages 15-32, Springer- Verlag, 2008. Bhalchandra Thatte There is also a quite sophisticated interface in Sage, but as long as the code is written in Ada there is a zero percent chance that that code will become standard in Sage. The optional package we have is a bunch of binaries since Ada support is usually not available. Note that at least until recently there was not even a 64 bit x86-64 ot Itanium binary on Verschelde's website. Cheers, Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: square of an inequality
From: Stan Schymanski [EMAIL PROTECTED] I think it would be very nice to include a solve algorithm for inequalities. To my knowledge, Mathematica does not do this, either. Or at least, I did not find out how to do it in Mathematica after 4 years of use. For example, In[1]:= Reduce[x + y = 3 x = 0 y = 0, {x, y}, Integers] Out[1]= (x == 0 y == 0) || (x == 0 y == 1) || (x == 0 y == 2) || (x == 0 y == 3) || (x == 1 y == 0) || (x == 1 y == 1) || (x == 1 y == 2) || (x == 2 y == 0) || (x == 2 y == 1) || (x == 3 y == 0) Alec --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Intended or unintended recursion?
Dear John, Tnx! But it looks alike. Just add a print command and see how the list found increases and the variable k picks up the new added numbers to the list result. sage: def posible_values(row,found,maxum): ...result=found ...if row==[]: row=[1] ...if result==[]: result=found=row #Recursion: intended or unintended? ...if max(row)maxum: ... for k in found: ... print k=,k,found, found ... for p in row: ... if k*p maxum: ...if k*p not in result: result.append(k*p) ...return result ... sage: print posible_values([2,5],[],10) k= 2 found [2, 5] k= 5 found [2, 5, 4, 8] k= 4 found [2, 5, 4, 8] k= 8 found [2, 5, 4, 8] [2, 5, 4, 8] To me this is recursion look-a-like. Roland On 25 aug, 11:22, John Cremona [EMAIL PROTECTED] wrote: This does not look recursive to me, since possible_values() does not call itself. John 2008/8/25 Rolandb [EMAIL PROTECTED]: Hi. The following programme looks simple: sage: def posible_values(row,found,maxum): ... result=found ... if row==[]: row=[1] ... if result==[]: result=found=row #Recursion: intended or unintended? ... if max(row)maxum: ... for k in found: ... for p in row: ... if k*p maxum: ... if k*p not in result: result.append(k*p) ... return result ... sage: print posible_values([2,3,5],[],100) [2, 3, 5, 4, 6, 10, 8, 12, 20, 16, 24, 40, 32, 48, 80, 64, 96, 9, 15, 18, 30, 36, 60, 72, 27, 45, 54, 90, 81, 25, 50, 75] To me is the possibility of recursion this way a great plus, but in all documents I could not find any reference. So is this intended in Python/SAGE or is the above example just bad programming? Roland --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] assignments and functions
Dear all, This subject has been used before, but I was not able to add a reply to it, probably because it is too old. So, here it is again. I wondered how python handles assigned variables in function definitions. For example, I would like to define an existing symbolic function as a python function in order to do automated calculations with it. I define y=a*x^2+b*x, then do a def f(x): return y, but f(x) does not evaluate if I assign values to a or b. However, if I do a def g(x): return a*x^2+b*x, g(x) evaluates using assigned values for a and b. Is there a way to avoid the need to type out the equation in the def g(x): return ... statement? I hope the example below clarifies what I mean. Cheers, Stan -- | SAGE Version 3.1.1, Release Date: 2008-08-17 | | Type notebook() for the GUI, and license() for information.| -- sage: var('a b x') (a, b, x) sage: y=a*x^2+b*x sage: def f(x): : return y : sage: f(x) a*x^2 + b*x sage: a=3 sage: f(x) a*x^2 + b*x sage: def g(x): : return a*x^2+b*x : sage: g(x) 3*x^2 + b*x sage: b=5 sage: g(x) 3*x^2 + 5*x sage: f(x) a*x^2 + b*x sage: def h(x): : return y.subs(locals()) : sage: h(x) a*x^2 + b*x sage: g(x) 3*x^2 + 5*x Only g(x) does what I wanted, but this one was defined by writing out the function. How can I pass a symbolic function to python that is stored in y? --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: assignments and functions
Dear Stan On Aug 25, 11:59 am, Stan Schymanski [EMAIL PROTECTED] wrote: I wondered how python handles assigned variables in function definitions. As much as i understood a recent thread on sage-devel, several people would like to have a powerful substitution mechanism in Sage. Concerning your problem: In the definition of h, you use y.subs(locals()). But i think this can not work, because locals() refers to the current name space (or what is the word for it?). So, unless you define a and b *inside* the definition of h, it wouldn't work. However, you define a and b in the *global* name space. So, the following does work: sage: var('a b x') (a, b, x) sage: y=a*x^2+b*x sage: def h(x): : return y.subs(globals()) : sage: h(x) a*x^2 + b*x sage: a=2 sage: h(x) 2*x^2 + b*x sage: b=3 sage: h(x) 2*x^2 + 3*x Cheers Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Issues wrt sage 3.1.1 on linux
Hi Michael, OK, I'll run all the tests that failed with -long option, to see if that works. Sounds like pretty nice systems you've got to work on. Yeah, I should probably do the big upgrade. I'll look into that. Cheers And Thanks for the Help! Doug Nadworny On Aug 24, 6:04 pm, mabshoff [EMAIL PROTECTED] dortmund.de wrote: On Aug 24, 4:55 pm, doug5y [EMAIL PROTECTED] wrote: PS What systems are you running sage on? Just interested. Dual Core 2.4GHz Core2 with 4 GB Ram for my laptop, 16 core 64 GB box for development (sage.math) :) Cheers, DN You can also run the tests with -long added, that way there is a rather long timeout, but some of the tests need more memory and will run longer - up to 15 minutes probably in your case. Cheers, Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: assignments and functions
Dear Simon, Thanks a lot for that! I haven't noticed the difference between subs(locals()) and subs(globals()). This helps a lot. Stan On Aug 25, 1:13 pm, Simon King [EMAIL PROTECTED] wrote: Dear Stan On Aug 25, 11:59 am, Stan Schymanski [EMAIL PROTECTED] wrote: I wondered how python handles assigned variables in function definitions. As much as i understood a recent thread on sage-devel, several people would like to have a powerful substitution mechanism in Sage. Concerning your problem: In the definition of h, you use y.subs(locals()). But i think this can not work, because locals() refers to the current name space (or what is the word for it?). So, unless you define a and b *inside* the definition of h, it wouldn't work. However, you define a and b in the *global* name space. So, the following does work: sage: var('a b x') (a, b, x) sage: y=a*x^2+b*x sage: def h(x): : return y.subs(globals()) : sage: h(x) a*x^2 + b*x sage: a=2 sage: h(x) 2*x^2 + b*x sage: b=3 sage: h(x) 2*x^2 + 3*x Cheers Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] finding minima and maxima: not working properly?
It seems that the find_minimum_on_interval and find_maximum_on_interval functions do not work properly. I found some posts about this and a ticket (http://trac.sagemath.org/sage_trac/ ticket/2607). Are there any alternatives built into sage that would allow the numerical search for extreme values in a given interval? Here is another example of something going horribly wrong (I actually get that 'cannot coerce type...' message a lot when I try the find_maximum... function): - | SAGE Version 3.1.1, Release Date: 2008-08-17 | | Type notebook() for the GUI, and license() for information.| -- sage: find_minimum_on_interval(-x^2,-1,1) (-0.9992595132459, -0.99962976) sage: find_maximum_on_interval(-x^2,-1,1) --- TypeError Traceback (most recent call last) /Users/sschym/Downloads/Free/sage-3.1.1/ipython console in module() /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/numerical/optimize.py in find_maximum_on_interval(f, a, b, tol, maxfun) 116 117 return -f(z) -- 118 minval, x = find_minimum_on_interval(g, a=a, b=b, tol=tol, maxfun=maxfun) 119 return -minval, x 120 /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/numerical/optimize.py in find_minimum_on_interval(f, a, b, tol, maxfun) 158 a = float(a); b = float(b) 159 import scipy.optimize -- 160 xmin, fval, iter, funcalls = scipy.optimize.fminbound(f, a, b, full_output=1, xtol=tol, maxfun=maxfun) 161 return fval, xmin 162 /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/scipy/optimize/optimize.py in fminbound(func, x1, x2, args, xtol, maxfun, full_output, disp) 1307 si = numpy.sign(rat) + (rat == 0) 1308 x = xf + si*max([abs(rat), tol1]) - 1309 fu = func(x,*args) 1310 num += 1 1311 fmin_data = (num, x, fu) /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/numerical/optimize.py in g(z) 115 116 -- 117 return -f(z) 118 minval, x = find_minimum_on_interval(g, a=a, b=b, tol=tol, maxfun=maxfun) 119 return -minval, x /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/calculus/calculus.py in __call__(self, *args, **kwargs) 4607 new_ops.append( op ) 4608 else: - 4609 new_ops.append( op(*[args[i] for i in indices]) ) 4610 except ValueError: 4611 new_ops.append( op ) /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/calculus/calculus.py in __call__(self, *args, **kwargs) 4613 #Check to see if all of the new_ops are symbolic constants 4614 #If so, then we should return a symbolic constant. - 4615 new_ops = map(SR, new_ops) 4616 is_constant = all(map(lambda x: isinstance(x, SymbolicConstant), new_ops)) 4617 if is_constant: /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/calculus/calculus.py in __call__(self, x) 449 msg, s, pos = err.args 450 raise TypeError, %s: %s !!! %s % (msg, s[:pos], s[pos:]) -- 451 return self._coerce_impl(x) 452 453 def _coerce_impl(self, x): /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/calculus/calculus.py in _coerce_impl(self, x) 501 return self(x._sage_()) 502 else: -- 503 raise TypeError, cannot coerce type '%s' into a SymbolicExpression.%type(x) 504 505 def _repr_(self): TypeError: cannot coerce type 'class 'sage.calculus.equations.SymbolicEquation'' into a SymbolicExpression. sage: --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: assignments and functions
sage: def h(x): : return y.subs(globals()) Oops, this is probably not what you want, becaus h(3) would not give the expected result. This may be better: sage: var('a b x') (a, b, x) sage: def h(x): : return y.subs(locals()).subs(globals()) : sage: a=2 sage: b=3 sage: h(x) 2*x^2 + 3*x sage: var('a b x') (a, b, x) sage: h(4) 4*b + 16*a sage: var('z') z sage: x=1 sage: h(z) a*z^2 + b*z Explanation: x is defined in the local name space of the function h. Hence, subs(locals()) replaces x by z (and not by 1!) in the last example. And then, the remaining contents of y are substitutet. Yours Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Bugs in DiGraph ?
adrian wrote: I now get it, when I said {1:{1:'hola'}... it understood {1: {1:list('hola') and hence treated hola as a list. I don't recall reading that one should input as a list if one selects multiedges, at least I don't recall seeing an example with that notation. This is, I think a little bit of a tricky thing, since the notation works for regular graphs. At least I know what to do now. But I don't know if the behavior here is intended. Probably it works like that to have a short way of entering several edges with one level. Or the authors did not intend it to work that way, in which case it could be fixed. One example with that behavior in the documentation would be great. Thanks a bunch. -Adrian. Do you have a trac account? Would you like to post an example you think makes the documentation clearer? If you don't have a trac account, you can get one by emailing mabshoff (see the instructions on http://wiki.sagemath.org/TracGuidelines ) or you can just reply here and give the input and output of a command to go into the EXAMPLES section of the documentation. You can precede that command with an explanation, too. Thanks, Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: finding minima and maxima: not working properly?
On Mon, Aug 25, 2008 at 5:57 AM, Stan Schymanski [EMAIL PROTECTED] wrote: It seems that the find_minimum_on_interval and find_maximum_on_interval functions do not work properly. I found some posts about this and a ticket (http://trac.sagemath.org/sage_trac/ ticket/2607). Are there any alternatives built into sage that would allow the numerical search for extreme values in a given interval? Here is another example of something going horribly wrong (I actually get that 'cannot coerce type...' message a lot when I try the find_maximum... function): If you call _fast_float_ as illustrated below on your functions, find_* will work, and also be much much faster: sage: find_maximum_on_interval((-x^2)._fast_float_(x),-1,1) (-7.7037197775489434e-34, -2.77555756156e-17) sage: find_minimum_on_interval((-x^2)._fast_float_(x),-1,1) (-0.9992595132459, -0.99962976) find_* doesn't do this already since (1) _fast_float_ was written after find_*, and (2) nobody has had the time to change find_* to use _fast_float_. - | SAGE Version 3.1.1, Release Date: 2008-08-17 | | Type notebook() for the GUI, and license() for information.| -- sage: find_minimum_on_interval(-x^2,-1,1) (-0.9992595132459, -0.99962976) sage: find_maximum_on_interval(-x^2,-1,1) --- TypeError Traceback (most recent call last) /Users/sschym/Downloads/Free/sage-3.1.1/ipython console in module() /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/numerical/optimize.py in find_maximum_on_interval(f, a, b, tol, maxfun) 116 117 return -f(z) -- 118 minval, x = find_minimum_on_interval(g, a=a, b=b, tol=tol, maxfun=maxfun) 119 return -minval, x 120 /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/numerical/optimize.py in find_minimum_on_interval(f, a, b, tol, maxfun) 158 a = float(a); b = float(b) 159 import scipy.optimize -- 160 xmin, fval, iter, funcalls = scipy.optimize.fminbound(f, a, b, full_output=1, xtol=tol, maxfun=maxfun) 161 return fval, xmin 162 /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/scipy/optimize/optimize.py in fminbound(func, x1, x2, args, xtol, maxfun, full_output, disp) 1307 si = numpy.sign(rat) + (rat == 0) 1308 x = xf + si*max([abs(rat), tol1]) - 1309 fu = func(x,*args) 1310 num += 1 1311 fmin_data = (num, x, fu) /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/numerical/optimize.py in g(z) 115 116 -- 117 return -f(z) 118 minval, x = find_minimum_on_interval(g, a=a, b=b, tol=tol, maxfun=maxfun) 119 return -minval, x /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/calculus/calculus.py in __call__(self, *args, **kwargs) 4607 new_ops.append( op ) 4608 else: - 4609 new_ops.append( op(*[args[i] for i in indices]) ) 4610 except ValueError: 4611 new_ops.append( op ) /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/calculus/calculus.py in __call__(self, *args, **kwargs) 4613 #Check to see if all of the new_ops are symbolic constants 4614 #If so, then we should return a symbolic constant. - 4615 new_ops = map(SR, new_ops) 4616 is_constant = all(map(lambda x: isinstance(x, SymbolicConstant), new_ops)) 4617 if is_constant: /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/calculus/calculus.py in __call__(self, x) 449 msg, s, pos = err.args 450 raise TypeError, %s: %s !!! %s % (msg, s[:pos], s[pos:]) -- 451 return self._coerce_impl(x) 452 453 def _coerce_impl(self, x): /Users/sschym/Downloads/Free/sage-3.1.1/local/lib/python2.5/site- packages/sage/calculus/calculus.py in _coerce_impl(self, x) 501 return self(x._sage_()) 502 else: -- 503 raise TypeError, cannot coerce type '%s' into a SymbolicExpression.%type(x) 504 505 def _repr_(self): TypeError: cannot coerce type 'class 'sage.calculus.equations.SymbolicEquation'' into a SymbolicExpression. sage: -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at
[sage-support] slider gives floating point values?
Hi, Just upgraded to SAGE 3.1.1. The sliders have suddenly started producing floating-point values; that is, num_approx=slider(1,5,default=2,label=Number of steps) gives me a slider whose initial value is 2.00200400802, and that when I slide from left to right can give me values such as 1.3 etc. I think this is due to a recent bugfix. Typing step_size=1 produces the old, desired behavior, but according to the documentation step_size=1 is the default. What is the expected future behavior? thanks! john perry --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Hypergeometric sum
On Sat, Aug 23, 2008 at 1:08 PM, Alec Mihailovs [EMAIL PROTECTED] wrote: What is your point? Actually, I meant that more about Maplesoft. Sage support is usually good in this group, just wasn't very good in this thread. I see. Thanks for pointing this out and explaining further. Since you like watching this sort of thing, I think it would be great if you could continue to keep an eye on what happens regarding the quality of support in the Sage forums, and when you see something amiss, or notice that we're really doing a bad job, gently let us know.There really isn't anybody involved in the Sage project who systematically does this, and I think you're unusually talented as spotting this sort of problem. E.g., if you notice a question that goes unanswered for *days* on sage-support, maybe you could post sorry that we haven't responded to your question -- hey does anybody have an idea about how to answer this person's question? Thanks! -- William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Issues wrt sage 3.1.1 on linux
PS What systems are you running sage on? Just interested. Cheers, DN On Aug 24, 5:34 pm, mabshoff [EMAIL PROTECTED] dortmund.de wrote: On Aug 24, 3:36 pm, doug5y [EMAIL PROTECTED] wrote: Hello, Hi Doug, I upgraded my sage 3.0.6 installation using the command : sage - upgrade. Every thing seemed to go well. I then did sage --testall with the result : -- The following tests failed: sage -t devel/sage/sage/graphs/graph_generators.py sage -t devel/sage/sage/calculus/calculus.py sage -t devel/sage/sage/combinat/root_system/ weyl_characters.py Total time for all tests: 11051.6 seconds Could you post the output from the failures? Your system seems to be a slow one and all three of the above could have simply timed out. Is there any way to get more detailed info wrt to these failures? Maybe correct them in some way? The output of uname -a is : uname -a Linux yamnuska 2.6.25.14-69.fc8 #1 SMP Mon Aug 4 14:20:24 EDT 2008 i686 athlon i386 GNU/Linux TIA, Doug Nadworny Cheers, Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: slider gives floating point values?
Just upgraded to SAGE 3.1.1. The sliders have suddenly started producing floating-point values; that is, num_approx=slider(1,5,default=2,label=Number of steps) gives me a slider whose initial value is 2.00200400802, and that when I slide from left to right can give me values such as 1.3 etc. I think this is due to a recent bugfix. Yes. Actually the change corrected seemingly arbitrary behavior with sliders when two different forms of slider input produced different results. Typing step_size=1 produces the old, desired behavior, but according to the documentation step_size=1 is the default. What is the expected future behavior? In the future, sliders should be continuous by default, that is, having as many possible values as the width of the slider allows. This is a documentation bug and thank you for pointing it out. Igor Tolkov --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: slider gives floating point values?
On Mon, Aug 25, 2008 at 11:18 AM, Igor Tolkov [EMAIL PROTECTED] wrote: Just upgraded to SAGE 3.1.1. The sliders have suddenly started producing floating-point values; that is, num_approx=slider(1,5,default=2,label=Number of steps) gives me a slider whose initial value is 2.00200400802, and that when I slide from left to right can give me values such as 1.3 etc. I think this is due to a recent bugfix. Yes. Actually the change corrected seemingly arbitrary behavior with sliders when two different forms of slider input produced different results. Typing step_size=1 produces the old, desired behavior, but according to the documentation step_size=1 is the default. What is the expected future behavior? In the future, sliders should be continuous by default, that is, having as many possible values as the width of the slider allows. This is a documentation bug and thank you for pointing it out. Don't you think a slider between 1 and 5 should at least start at 1 and end at 5? William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Latex of a product of polynomials with simplification
On Sat, Aug 23, 2008 at 12:50 PM, daveloeffler [EMAIL PROTECTED] wrote: How to get the Latex expression of fg without expanding the product ? ie (1 + t + 2 t^{2}) (1+t) . Can't one use the Factorization class to do this? I tried fg = Factorization([(f,1), (g,1)]) and then you can print fg to latex. (I guess the point is that the Factorization class doesn't enforce that the factors are irreducible.) Cool, that's a great idea! William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: slider gives floating point values?
On Aug 25, 2:12 pm, William Stein [EMAIL PROTECTED] wrote: On Mon, Aug 25, 2008 at 11:18 AM, Igor Tolkov [EMAIL PROTECTED] wrote: Just upgraded to SAGE 3.1.1. The sliders have suddenly started producing floating-point values; that is, num_approx=slider(1,5,default=2,label=Number of steps) gives me a slider whose initial value is 2.00200400802, and that when I slide from left to right can give me values such as 1.3 etc. I think this is due to a recent bugfix. Yes. Actually the change corrected seemingly arbitrary behavior with sliders when two different forms of slider input produced different results. Typing step_size=1 produces the old, desired behavior, but according to the documentation step_size=1 is the default. What is the expected future behavior? In the future, sliders should be continuous by default, that is, having as many possible values as the width of the slider allows. This is a documentation bug and thank you for pointing it out. Don't you think a slider between 1 and 5 should at least start at 1 and end at 5? William That doesn't happen with either of the constructions I gave; how does this arise? john perry --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Plotting and constant functions
Mike Witt wrote: On 08/21/2008 06:55:48 PM, Joel B. Mohler wrote: On Thursday 21 August 2008 01:58:23 pm Mike Witt wrote: I'm looking for a work-around for the situation where I would normally call parametric_plot (or plot, for that matter) with a function, and in some particular case that function turns out to evaluate to a constant. For example: sage: def f(a,b): return e^(a+b*I) : sage: parametric_plot([real(f(x,1)),imag(f(x,1))], -pi, pi) Works as expected sage: parametric_plot([real(f(x,-1)),imag(f(x,-1))], -pi, pi) Works as expected sage: parametric_plot([real(f(x,0)),imag(f(x,0))], -pi, pi) Gives a page full of errors, which I interpret to mean that there was a problem plotting because imag(f(x,0)) evaluates to a constant. I believe that this is the same issue described in: http://trac.sagemath.org/sage_trac/ticket/2410 I'm the person that entered the trac ticket and the point of that trac ticket is precisely the (mis-)functionality you are describing. I'm truly mystified by the other responses in this thread. To me, this is an obvious bug... -- Joel Thanks Joel. I was beginning to wonder if I was nuts. Just to summarize what I've found out so far. The work-arounds suggested by David Joyner, Mike Hansen, and Carl Witty all work under certain assumptions, but none of the three provides a completely general fix as far as I can see. Using a combination of the techniques I am able to do what I want. But I am for whatever it's worth I'd certainly like to add my vote that tickets #2409 and #2410 should get attention. This issue with parametric_plot is certainly *very* confusing to a newcomer. Here's yet another method: sage: from sage.ext.fast_eval import fast_float sage: plot(fast_float(1), -1, 2) sage: parametric_plot((fast_float(1),t),-12,12) Now, why in the world the plot functions aren't calling fast_float, I don't know. I thought that's what they did. I'm looking into it for a few minutes, at least. Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: [sage-devel] Re: missing imports for experimental module for Sage
On Mon, Aug 25, 2008 at 9:15 PM, William Stein [EMAIL PROTECTED] wrote: On Mon, Aug 25, 2008 at 10:33 AM, Philippe Saade [EMAIL PROTECTED] wrote: On Mon, Aug 25, 2008 at 6:45 PM, William Stein [EMAIL PROTECTED] wrote: i'am testing a Python module i wrote and placed it in one of the pathes visited by Sage's Python while importing. I try to do the necessary imports at the beginning of my module but it seem's to be an endless quest. What do you think the necessary imports are? Could you be way more precise? I wrote few classes to plot graphs in a special way. All the code worked fine if placed in a cell at the beginning of the worksheet. As far as it makes a very long cell, it is boring for the reader so i thought i could place all this in an external file and use : from FooBar import * but, naturally, the Sage commands i use in that file are unkown in the Module namespace. I started adding many import statements, one for each unknown command. But vector computation seemed to be needing a lot of imports. That's why i'am asking for advice. (and if it sounds like support, i am again on the wrong list...:-[) Yes, this is definitely for sage-support not sage-devel. You should put from sage.all import * at the top of your file. William Thanks for your help. I tried with your import. It didn't work immediately because i had in fact used ^ instead of ** in a computation with vectors. I changed it it it worked fine. A tried more selective imports but it goes to far for me today. So i'll keep with from sage.all import * Philippe --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Plotting and constant functions
Jason Grout wrote: Mike Witt wrote: On 08/21/2008 06:55:48 PM, Joel B. Mohler wrote: On Thursday 21 August 2008 01:58:23 pm Mike Witt wrote: I'm looking for a work-around for the situation where I would normally call parametric_plot (or plot, for that matter) with a function, and in some particular case that function turns out to evaluate to a constant. For example: sage: def f(a,b): return e^(a+b*I) : sage: parametric_plot([real(f(x,1)),imag(f(x,1))], -pi, pi) Works as expected sage: parametric_plot([real(f(x,-1)),imag(f(x,-1))], -pi, pi) Works as expected sage: parametric_plot([real(f(x,0)),imag(f(x,0))], -pi, pi) Gives a page full of errors, which I interpret to mean that there was a problem plotting because imag(f(x,0)) evaluates to a constant. I believe that this is the same issue described in: http://trac.sagemath.org/sage_trac/ticket/2410 I'm the person that entered the trac ticket and the point of that trac ticket is precisely the (mis-)functionality you are describing. I'm truly mystified by the other responses in this thread. To me, this is an obvious bug... -- Joel Thanks Joel. I was beginning to wonder if I was nuts. Just to summarize what I've found out so far. The work-arounds suggested by David Joyner, Mike Hansen, and Carl Witty all work under certain assumptions, but none of the three provides a completely general fix as far as I can see. Using a combination of the techniques I am able to do what I want. But I am for whatever it's worth I'd certainly like to add my vote that tickets #2409 and #2410 should get attention. This issue with parametric_plot is certainly *very* confusing to a newcomer. Here's yet another method: sage: from sage.ext.fast_eval import fast_float sage: plot(fast_float(1), -1, 2) sage: parametric_plot((fast_float(1),t),-12,12) Now, why in the world the plot functions aren't calling fast_float, I don't know. I thought that's what they did. I'm looking into it for a few minutes, at least. Okay, apparently no one has had time to implement it. Calling fast_float will solve the issue, as it is solved in parametric_plot3d, for example. The new ticket is #3952. I've also posted a patch on #2410 which corrects a bug in the exception handling so that you get an sensible exception instead of the nonsensical indexing exception that you get now. Thanks, Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] order in adding plots to plots
Hi, sorry for the attatched image but it might help to understand to problem. I wrote a procedure to draw (nicely ?) a multiedged digraph (I know that some good work is coming soon from E. Kirkman but i need something NOW... :-( Does anybody know why lines always get on top of polygons ? Philippe --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~--- inline: sage0.png
[sage-support] Re: numerically solving a polynomial system of equations
On Aug 24, 12:16 pm, Michael [EMAIL PROTECTED] wrote: I have a polynomial system of 50 equations in 50 unknowns. I would like to numerically solve this system (I'm interested in complex zeros). Seems to me that if I use sage's solve, it will sttempt to solve these algebraically. Are there any funcitons in sage for solving a polynomial or non-linear system numerically. Other people have suggested phcpack, but not explained how to use it. The following may or may not work for you (it depends on your processor architecture and operating system); but if it does work, it's actually quite easy. First, install phc, by typing at the command line: sage -i phc-2.3.39.p0 Then, from within Sage, you can do things like this: sage: from sage.interfaces.phc import phc sage: R2.x,y = PolynomialRing(QQ,2) sage: start_sys = [x^6-y^2,y^5-1] sage: sol = phc.blackbox(start_sys, R2) sage: len(sol.solutions()) 30 sage: sol.solutions()[0] # display the first solution [0.309016994374947 + 0.951056516295154*I, 0.104528463267653 + 0.994521895368273*I] Carl --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: numerically solving a polynomial system of equations
On Mon, Aug 25, 2008 at 5:32 PM, Carl Witty [EMAIL PROTECTED] wrote: On Aug 24, 12:16 pm, Michael [EMAIL PROTECTED] wrote: I have a polynomial system of 50 equations in 50 unknowns. I would like to numerically solve this system (I'm interested in complex zeros). Seems to me that if I use sage's solve, it will sttempt to solve these algebraically. Are there any funcitons in sage for solving a polynomial or non-linear system numerically. Other people have suggested phcpack, but not explained how to use it. The following may or may not work for you (it depends on your processor architecture and operating system); but if it does work, it's actually quite easy. First, install phc, by typing at the command line: sage -i phc-2.3.39.p0 Then, from within Sage, you can do things like this: sage: from sage.interfaces.phc import phc sage: R2.x,y = PolynomialRing(QQ,2) sage: start_sys = [x^6-y^2,y^5-1] sage: sol = phc.blackbox(start_sys, R2) sage: len(sol.solutions()) 30 sage: sol.solutions()[0] # display the first solution [0.309016994374947 + 0.951056516295154*I, 0.104528463267653 + 0.994521895368273*I] I installed phc into the public sage notebook servers, so you can try the above at https://sage.math.washington.edu:8102 -- William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: order in adding plots to plots
On Mon, Aug 25, 2008 at 3:00 PM, Philippe Saade [EMAIL PROTECTED] wrote: Hi, sorry for the attatched image but it might help to understand to problem. I wrote a procedure to draw (nicely ?) a multiedged digraph (I know that some good work is coming soon from E. Kirkman but i need something NOW... :-( Does anybody know why lines always get on top of polygons ? This is not implemented yet. It's high on somebody's list to fix, I think. William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---