[sage-support] Re: random questions
On Fri, Mar 28, 2008 at 9:05 AM, kcrisman [EMAIL PROTECTED] wrote: [...] Or I could make an init.sage file and put it in, right? It could be useful to put a sample of the sort of commands which live in that kind of file on the Wiki FAQ, or even a blank file with suggestions commented out in the actual distribution. +1 For now, here's mine. This allows me to reach python extensions installed with apt-get. [EMAIL PROTECTED]:~/.sage$ cat init.sage import sys sys.path += ['/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/var/lib/python-support/python2.5'] Best, -- Hector --~--~-~--~~~---~--~~ 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: random questions
Your best is to use Sage's actual polynomial objects instead of symbolic expressions (if you're just interested in polynomial expressions). sage: R.y = ZZ[] sage: a = y^5 - y - 12 sage: a.roots(RR) [(1.68758384186451, 1)] sage: a.roots(CC) [(1.68758384186451, 1), (0.472524075221555 + 1.59046294160722*I, 1), (0.472524075221555 - 1.59046294160722*I, 1), (-1.31631599615381 + 0.922151856490895*I, 1), (-1.31631599615381 - 0.922151856490895*I, 1)] If you want to use symbolic expressions, you can use the .find_root() method. sage: a = x^5 - x - 12 sage: a.find_root(0,2) 1.6875838418645157 Ah, I knew there had to be a method! As usual, I'm looking for the easiest interface, and this is very nice. Sage on startup predefines i in the same way it predefines x. (This is in sage.all_cmdline and sage.all_notebook.) Here's what's going on: sage: j = I() sage: abs(1+j) sqrt(2) Hmm. So sage: z=1+i nonetheless is interpreted as symbolic until further notice? That's useful to know. A followup would be to ask if any of those functions have functional notation; there are lots of functions for CC, but they mostly seem to use object notation. What methods did you have in mind? Just the usual - everything! :) But upon further experimentation I find that I must have been not trying the right things yesterday, because arg works functionally, and the behavior that log(i) returns log(I) is consistent with log(2) returning log(2), symbolically, as above. Sorry for asking that - I must have been too tired last night to try everything. 3. I remember that at some point implicit coefficient multiplication was implemented, e.g. Implicit multiplication is turned off by default. You can turn it on: sage: implicit_multiplication(True) sage: 2x 2*x --Mike Or I could make an init.sage file and put it in, right? It could be useful to put a sample of the sort of commands which live in that kind of file on the Wiki FAQ, or even a blank file with suggestions commented out in the actual distribution. Thanks! --~--~-~--~~~---~--~~ 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: random questions
Hello, 1. The solve wrapper of maxima does some nice stuff symbolically, but of course it can't handle everything, like sage: solve(x^5-x-12,x) [0 == x^5 - x - 12] which makes sense! But I poked around a little for a numerical approximation of solutions command and didn't find it. This probably means I just didn't look in the right places - any ideas? I understand Mathematica calls this sort of thing nsolve, but I really don't know. Your best is to use Sage's actual polynomial objects instead of symbolic expressions (if you're just interested in polynomial expressions). sage: R.y = ZZ[] sage: a = y^5 - y - 12 sage: a.roots(RR) [(1.68758384186451, 1)] sage: a.roots(CC) [(1.68758384186451, 1), (0.472524075221555 + 1.59046294160722*I, 1), (0.472524075221555 - 1.59046294160722*I, 1), (-1.31631599615381 + 0.922151856490895*I, 1), (-1.31631599615381 - 0.922151856490895*I, 1)] If you want to use symbolic expressions, you can use the .find_root() method. sage: a = x^5 - x - 12 sage: a.find_root(0,2) 1.6875838418645157 2. How far does Sage recognize complex numbers a priori? For instance, sage: abs(1+i) sqrt(2) but pretty much anything else doesn't seem to recognize it, as indeed Sage on startup predefines i in the same way it predefines x. (This is in sage.all_cmdline and sage.all_notebook.) Here's what's going on: sage: j = I() sage: abs(1+j) sqrt(2) A followup would be to ask if any of those functions have functional notation; there are lots of functions for CC, but they mostly seem to use object notation. What methods did you have in mind? 3. I remember that at some point implicit coefficient multiplication was implemented, e.g. Implicit multiplication is turned off by default. You can turn it on: sage: implicit_multiplication(True) sage: 2x 2*x --Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---