[sage-support] Re: eigenvectors of a 2x2 matrix
I'm not sure this is the best answer, but you could do: A = matrix(SR,[[a,b],[c,d]]) v1,v2 = A.eigenvalues() show((A-v1).left_kernel().basis()[0]) show((A-v2).left_kernel().basis()[0]) Perhaps part of the issue is that these do not have to be distinct. -M. Hampton On Feb 27, 5:39 pm, harven wrote: > Dear all, > > I try to find the eigenvectors of a general 2x2 matrix using > > var('a,b,c,d');show(Matrix(2,2,[a,b,c,d]).eigenvalues()); > show(Matrix([[a,b],[c,d]]).eigenvectors_left()) > > The eigenvalues are ok, but I get an error for the eigenvectors. > What am I doing wrong here ? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: animations of raytraces of 3d plots.
#7298 depends on #7297, "spkg's for libogg and libtheora". I tried to review that and got stuck/frustrated with compilation problems. I encourage someone else to give it a try. I think it might be easier on linux than OS X (I usually do development work on OS X, especially for notebook related work). -Marshall On Feb 27, 3:08 pm, Jason Grout wrote: > On 02/18/2010 07:14 AM, Marshall Hampton wrote: > > > I recommend using ffmpeg for stuff like that, it will do a better job > > than animate as long as animate is just using imagemagick. You need > > to save the image files with sequential names. I can post an example > > if you are interested. > > Someone might be interested in reviewing #7298: use html5 video tag for > animations: > > "The attached patch adds support for creating Ogg Theora videos from > animation objects. > > The resulting video files are embedded into the notebook using the html5 > video tag. " > > Thanks, > > Jason -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] finding out how to import a built-in (say, vector)
On Feb 27, 2010, at 6:22 PM, Dima Pasechnik wrote: In a sage function I need to use Sage's built-in types, say, vector. E,g, def foo(bar): from import vector as v a=v(bar) How do I find out from where it has to be imported? (I haven't come up with anything better than running a grep on devel/ sage/sage/*/*.py* looking for vector and import) Is this from a Python script? If so the safest way is to do "from sage.all import vector as v" as there is sensitivity in the order things are imported. In the library, you'll have to see where it's defined, or do something like "from sage.modules.all import vector as v" if you're using it from a non sage.modules package. Usually you don't want to be too specific, or that created unneeded dependancies (the current order things get imported in is a mess...). The easiest way to see is to do sage: vector.__module__ 'sage.modules.free_module_element' - Robert -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] finding out how to import a built-in (say, vector)
In a sage function I need to use Sage's built-in types, say, vector. E,g, def foo(bar): from import vector as v a=v(bar) How do I find out from where it has to be imported? (I haven't come up with anything better than running a grep on devel/ sage/sage/*/*.py* looking for vector and import) Thanks, Dima -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] eigenvectors of a 2x2 matrix
Dear all, I try to find the eigenvectors of a general 2x2 matrix using var('a,b,c,d');show(Matrix(2,2,[a,b,c,d]).eigenvalues()); show(Matrix([[a,b],[c,d]]).eigenvectors_left()) The eigenvalues are ok, but I get an error for the eigenvectors. What am I doing wrong here ? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: Comparing Factorizations and Polynomials
I'm not suggesting multiplying it back out, but that if comparing to a polynomial and the factorization has only one term, compare the polynomial to that single term. I didn't know about the is_irreducible() function, lol. Guess that would have worked best for what I needed. I think the code that would do what I was suggested would be to add this before 431: if isinstance(other, Polynomial): if len(self) == 1 and self[0][1] == 1: return cmp(self[0][0], other) Anyways thanks for the tip about is_irreducible(). -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Letting users access Sage via HTTP
Hi Sam'l, On Sun, Feb 28, 2010 at 9:19 AM, Sam'l B wrote: >Can anyone point me to the part of the Fine Manual which describes > how to set up Sage to let users not on the Sage server access via HTTP (I.e. > 'http://192.168.1.99:8000') ? ? Start the Sage command line interface and issue this command notebook(interface="", secure=True) For more information about fine tuning options to the command notebook(), issue the command notebook? to get documentation on that particular command. If you want more documentation, the command notebook?? would give you both the docstring as well as the source code of the command. Depending on your system and the version of Sage you use, the command notebook(interface="", secure=True) would take a while to successfully start a network accessible notebook interface. This is due to the software used for generating RSA private keys. If your system has openssl and you use Sage 4.3.2 or 4.3.3, you don't have to wait long for the private key generation process to finish. This is because openssl is very fast at such cryptographic tasks. However, if your system don't have openssl, then the command notebook(interface="", secure=True) would default to using certtool (or something similar), which takes ages to generate RSA private keys. -- Regards Minh Van Nguyen -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Letting users access Sage via HTTP
Many thanks. On 02/27/2010 02:27 PM, David Joyner wrote: On Sat, Feb 27, 2010 at 5:19 PM, Sam'l B wrote: Can anyone point me to the part of the Fine Manual which describes how to set up Sage to let users not on the Sage server access via HTTP (I.e. 'http://192.168.1.99:8000') ? ? I think it is easier if you just type notebook? at the command line. TIA Sam'l B. -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Letting users access Sage via HTTP
On Sat, Feb 27, 2010 at 5:19 PM, Sam'l B wrote: > Can anyone point me to the part of the Fine Manual which describes > how to set up Sage to let users not on the Sage server access via HTTP (I.e. > 'http://192.168.1.99:8000') ? ? I think it is easier if you just type notebook? at the command line. > > TIA > > Sam'l B. > > -- > To post to this group, send email to sage-support@googlegroups.com > To unsubscribe from this group, send email to > sage-support+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-support > URL: http://www.sagemath.org > -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] install problem on osx 10.4
On Feb 27, 2010, at 1:19 PM, harven wrote: dear all, I try to install sage on a intel mac running osx 10.4.11. I didn't find a binary for 10.4 on the website although it is stated that 10.4 is supported. So I tried with the disk image sage-4.3.3- OSX-32bit-10.5- i386-Darwin.dmg I followed the install instructions but when I try to start sage, I get in the terminal -- | Sage Version 4.3.3, Release Date: 2010-02-21 | | Type notebook() for the GUI, and license() for information.| -- /Applications/sage/local/bin/sage-sage: line 214: 694 Bus error "$SAGE_ROOT/local/bin/"sage-location logout [Process completed] Any hint ? Try installing from source. Until recently I had 10.4.11 and it always worked for me (though took 3 hours or so). It's much easier than it sounds. Download from http://sagemath.org/download-source.html , then in the terminal do cd ~/Desktop # or wherever you placed the sage-4.3.3.tar tar xvf sage-4.3.3.tar cd sage-4.3.3 make If you need more detailed instructions, feel free to ask. - Robert -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Letting users access Sage via HTTP
Can anyone point me to the part of the Fine Manual which describes how to set up Sage to let users not on the Sage server access via HTTP (I.e. 'http://192.168.1.99:8000') ? ? TIA Sam'l B. -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] install problem on osx 10.4
dear all, I try to install sage on a intel mac running osx 10.4.11. I didn't find a binary for 10.4 on the website although it is stated that 10.4 is supported. So I tried with the disk image sage-4.3.3-OSX-32bit-10.5- i386-Darwin.dmg I followed the install instructions but when I try to start sage, I get in the terminal -- | Sage Version 4.3.3, Release Date: 2010-02-21 | | Type notebook() for the GUI, and license() for information.| -- /Applications/sage/local/bin/sage-sage: line 214: 694 Bus error "$SAGE_ROOT/local/bin/"sage-location logout [Process completed] Any hint ? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: animations of raytraces of 3d plots.
On 02/18/2010 07:14 AM, Marshall Hampton wrote: I recommend using ffmpeg for stuff like that, it will do a better job than animate as long as animate is just using imagemagick. You need to save the image files with sequential names. I can post an example if you are interested. Someone might be interested in reviewing #7298: use html5 video tag for animations: "The attached patch adds support for creating Ogg Theora videos from animation objects. The resulting video files are embedded into the notebook using the html5 video tag. " Thanks, Jason -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: Comparing Factorizations and Polynomials
If you look at the source code (line 400 of sage/structure/ factorization.py) you can see how Sage compares a Factorization object with something else: (1) If the other thing is not a Factorization it will give false; else (2) it compares the expansions of both (i.e. multiplies them out & then compares); else (3) compares the factorizations term by term. You are suggestion that when a Factorization is compared with something which is not a Factorization, the Factorization is first multiplied out and then the result is compared with the other thing. That has some merits that I can see, and would be easy to implement. But of course, if this was implemented then in both your examples expand(fac_f)==f would return True. You could always use p.is_irreducible instead! John Cremona On Feb 27, 1:56 am, Nathaniel Troutman wrote: > I'm new to sage and was introduced to it this semester in my > Cryptography course as being a python friendly alternative to Pari/GP. > So playing around with it I was factoring polynomials over GF(2) and > trying to make a quick function to generate random polynomials and > return if they were reducible, without me actually visually inspecting > the factorization. For the sake of giving an example I'll just define > a couple of polynomials: > > sage: R. = PolynomialRing(GF(2)) > sage: p = x^30 + x^21 + 1 > sage: q = x^30 + x^14 + 1 > sage: fac_p = factor(p); fac_p > x^30 + x^21 + 1 > sage: fac_q = factor(q); fac_q > (x^15 + x^7 + 1)^2 > > Now here is the interesting bit: > > sage: fac_q == q # should return False > False > sage: fac_p == p # would expect True > False > > What!? But p is irreducible, its factorization should be itself. After > much digging around and thinking about things from a programmers > perspective rather than a mathematics perspective the idea that > factorizations are lists of factors and why comparing a factorization > to a polynomial doesn't work. However, I would contend that the > comparison does in fact make intuitive sense. So, perhaps comparison > testing for Factorizations and Polynomials should be a bit more > "intelligent" or at least provide some easy way of comparing them in > the intuitive sense of compare. After all this does work: > > sage: fac_p[0][0] == p > True > > And that would only hold true (as far as I know) if the polynomial was > irreducible. -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: how to find solutions with fsolve
On Feb 26, 11:20 pm, Jose Guzman wrote: > This probably has not much to do with Sage, but I need some help. I do not fully get your example and I might be wrong, but I have the feeling you are looking for the inverse survival function, i.e. binom.isf(...) [i'm only sure that 1-binom.cdf == binom.sf and a survival function has something to do with reliability ] h -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Re: sage 4.3.3 fortan compilation problem
Hi, On Sat, Feb 27, 2010 at 8:51 PM, bourbabis wrote: > Everything seems correct. So I've thought, Sage doesn't succeed to > locate the fortan compiler and thus I must explicitly set the two > environment variables. Or is it a problem of gfortran version ? It looks to me your system already has the version of gfortran corresponding to your version of gcc and g++. And that same version is OK for compiling Sage. At the very start of the compilation process, a configure script is run to determine prerequisites. If your version of gfortran was not suitable or the script could not locate your system's gfortran, the script would have halted with an error message and the build process would stop there. The build process on your system got to the stage of installing the Fortran spkg, which suggests to me that you have necessary prerequisites for compiling Sage. All I was suggesting in my previous post is that you leave the Fortran environment variables alone. Just untar the Sage source tarball, cd to the resulting directory, and issue "make". That's it. If you previously set those environment variables, then you might want to consider first unsetting them: unset SAGE_FORTRAN unset SAGE_FORTRAN_LIB Do this before the untar step. If the above steps still don't build Sage for you, something else is wrong. -- Regards Minh Van Nguyen -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Hold symbolic expressions
Hi Robert, On Fri, 26 Feb 2010 17:14:22 -0800 (PST) "ma...@mendelu.cz" wrote: > Holding symbolic expressions has been requested several times here. > For example [1]-][4]. Is there something new in this topic? Now or in > near future? Here is another related post: http://groups.google.com/group/sage-devel/t/ea7d28ba9bb9e195/ca3bee98bcdcdcbb I really don't have much time to add new features to pynac these days, so I cannot make any promises. I'd be glad to help anyone who wants to start working on pynac though. Cheers, Burcin -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: sage 4.3.3 fortan compilation problem
Thanks for replying. I don't understand. "gfortran" is already installed and fully functional, I've checked it before typing "make". See what the following bash commands (->) return. -> dpkg -l | grep fortran ii gfortran-4.3 4.3.2-1.1 The GNU Fortran 95 compiler ii libgfortran3 4.3.2-1.1 Runtime library for GNU Fortran applications -> /usr/bin/gfortran-4.3 -v Utilisation des specs internes. Target: i486-linux-gnu Configuré avec: ../src/configure -v --with-pkgversion='Debian 4.3.2-1.1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs -- enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable- shared --with-system-zlib --libexecdir=/usr/lib --without-included- gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/ usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu -- enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable- targets=all --enable-cld --enable-checking=release --build=i486-linux- gnu --host=i486-linux-gnu --target=i486-linux-gnu Modèle de thread: posix gcc version 4.3.2 (Debian 4.3.2-1.1) -> ldd /usr/lib/libgfortran.so.3 linux-gate.so.1 => (0xb7eee000) libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7dfa000) libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7c9f000) /lib/ld-linux.so.2 (0xb7eef000) Everything seems correct. So I've thought, Sage doesn't succeed to locate the fortan compiler and thus I must explicitly set the two environment variables. Or is it a problem of gfortran version ? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Re: how to find solutions with fsolve
Dear Jason, first of all, thank you very much for your kind help and time. Could you post a self-contained example that gives the error you get below? here my running example. I got to solve it late last night... >>> from scipy.stats import binom >>> from scipy.optimize import fsolve >>> def mybinom(N): >>> returns the probability of finding 40 or more successes in a population of N samples >>>return 1-binom(N, 0.15).cdf(40) >>> mybinom(200) # I know the value should be around 200 (solved by brute-force) >>> 0.02199927 >>> fsolve(lambda N: mybinom(N)-0.020, 100) >>> 199.5458489705228 a float value of N=199.54 does not make much sense for a binomial experiment. I am new here but it seems that fsolve changes depending on the starting estimation parameter. >>> int(round(fsolve(lambda N: mybinom(N) - 0.02, 100))) >>> 200 >>> int(round(fsolve(lambda N: mybinom(N) - 0.02, 90))) >>> 199 .. is there any optimize better method to get an integer? I did not get find_root() to work :/ It seems like your mathematica code got cut off in the definition of g. Sage has a find_root command. See http://www.sagemath.org/doc/reference/sage/numerical/optimize.html#sage.numerical.optimize.find_root However, I think it depends on the function being continuous. I assume that's why the mathematica code appears to find the root of an interpolated function? Exactly, this is how the mathematica code solve it, but I became a big fan of Sage! Thank you very much! Jose. -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org