[sage-devel] Question about solving equations involving the absolute value
Hi, i'm using sage in a course and we came up with some problems concerning the absolute value and the solve-function. We started to solving the equation abs(abs(x-2)-1)==4 for real x. But even easier equations makes problems: solve(abs(x)==5,x) Is there a reason why sage isn't able to give a useful answer to this? And even using abs_symbolic gives no result. How can i reformulate my equation, so that sage is able to solve it? What i found out myself: if i use sqrt(x^2) as a substitute for the absolute value, it works. But it would be much nicer if one could use just abs (without further thinking). -MRK- -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Problem with matrix rank?
I discussed the following issue with @IRC: sage: rank(matrix(2,[1.5,1.75,-1.5,-1.75])) 2 gives a wrong answer. Multiplying with a full rank matrix also gives unexpected results: sage: rank( matrix(2,2,[1,0,0,1]) * matrix(2,[1.5,1.75,-1.5,-1.75]) ) 2 sage: rank( matrix(2,2,[1,0,1,1]) * matrix(2,[1.5,1.75,-1.5,-1.75]) ) 1 And even more serious: multiplying with another rank one matrix: sage: rank( matrix(2,2,[1,0,1,0]) * matrix(2,[1.5,1.75,-1.5,-1.75]) ) 2 I think this is something that should be fixed. -vgermrk- -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
[sage-devel] Re: Bug in srange
It's now #4746 (http://trac.sagemath.org/sage_trac/ticket/4746) -MRK- --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@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-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-devel] Bug in srange
There's something really buggy in the "srange"-function. One can produce almost every (wrong) behavior concerning the endpoint of the returned list. Here are some examples: sage: srange(0.5,1.1,0.1,include_endpoint=False) [0.500, 0.600, 0.700, 0.800, 0.900, 1.00, 1.10] sage: srange(0.5,1,0.1,include_endpoint=False) [0.500, 0.600, 0.700, 0.800, 0.900] sage: srange(0.5,0.9,0.1,include_endpoint=False) [0.500, 0.600, 0.700, 0.800] sage: srange(0,1.1,0.1,include_endpoint=True) [0.000, 0.100, 0.200, 0.300, 0.400, 0.500, 0.600, 0.700, 0.800, 0.900, 1.00, 1.10, 1.20] sage: srange(0,0.2,0.1,include_endpoint=True) [0.000, 0.100, 0.200] sage: srange(0,0.3,0.1,include_endpoint=True) [0.000, 0.100, 0.200] -MRK- --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@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-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-devel] Re: your opinions about 0.digits()
I wrote a patch, which fixes the issue (#2232) and adds a padto- parameter (as suggested). Feel free to review :-) http://trac.sagemath.org/sage_trac/ticket/2232 -vgermrk- --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@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-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-devel] your opinions about 0.digits()
Hi! I want to hear your opinions about a little problem. The following bug is already reported as #2232: "1.digits(16,'0123456789abcdef')" returns "['1']" but "0.digits(16,'0123456789abcdef')" returns "[]" (and not "['0']" as i wish) So i started looking at the code to fix this little problem. But it looks like this was (maybe) intended, because the docstring says something like "0 has 0 digits", and so in particular "0.digits(base=10)" returns "[]". And here is my question: Should "0.digits(base=10)" return "[]" or "[0]" (which i prefer, but i'm here to get your opinions) Clearly i can just fix my first problem ("0.digits(16,'0123456789abcdef')") and let "0.digits(base=10)" as it is, but i think this is inconsistent or inconsequent. -vgermrk- --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@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-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-devel] Bring back the XOR
Since the preparser replaces "^" with "**" (which is good!), i want a way to access the python-buildin-XOR again. I suggested in IRC that the preparser should also replace "xor" with "^", so that one can do "5 xor 3". But since i did not convince everybody (on IRC), let's discuss here about it. So what do you think? -vgermrk- --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@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-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-devel] Re: integer digits method
On 2 Mrz., 04:17, "Joel B. Mohler" <[EMAIL PROTECTED]> wrote: > Hi, > > I'd like discussion > on:http://trac.sagemath.org/sage_trac/ticket/2232http://trac.sagemath.org/sage_trac/ticket/2170 > I made comments in both of those last tickets. I think the first is invalid I don't think so! (Ok, i reported this bug, so maybe i'm not objective enough ;-) I posted a comment to your comment on #2232, but i will repeat it here: You're right that you should use ".str" if you just want to get the string representation of a number in a given base. But the digits function can do more. It can take any indexable object as source for the digits. So i think this is really a bug which should be fixed, because since sage: 1.digits(11,'pleasefixme') ['l'] this sage: 0.digits(11,'pleasefixme') should return ['p'] (what it currently does not! It returns [] ) --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@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-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-devel] Re: Sage 2.10.1 released
The build fails on my notebook (Intel(R) Pentium(R) M processor 1400MHz), Ubuntu 7.10 (2.6.22-14-generic). I compiled older versions of sage a few times before on this machine, but this time i get errors. Thanks in advance for any help. The full install.log is at http://homepage.rub.de/michael.kallweit/install.log.tar.gz Here are the last lines: STAGE 2-1-5: GEMV TUNE make -f Makefile INSTALL_LOG/dMVRES pre=d 2>&1 | ./xatlas_tee INSTALL_LOG/dMVTUNE.LOG make[3]: *** [build] Fehler 255 make[3]: Verlasse Verzeichnis '/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build' make[2]: *** [build] Fehler 2 make[2]: Verlasse Verzeichnis '/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build' make[2]: Betrete Verzeichnis '/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build/lib' rm -f libatlas.so liblapack.so make libatlas.so liblapack.so libf77blas.so libcblas.so liblapack.so make[3]: Betrete Verzeichnis '/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build/lib' ld -melf_i386 -shared -soname libatlas.so -o libatlas.so \ --whole-archive libatlas.a --no-whole-archive -lc -lm ld -melf_i386 -shared -soname liblapack.so -o liblapack.so --whole- archive \ liblapack.a --no-whole-archive make[3]: *** Keine Regel vorhanden, um das Target >>libf77blas.a<<, benötigt von >>libf77blas.so<<, zu erstellen. Schluss. make[3]: Verlasse Verzeichnis '/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build/lib' make[2]: *** [shared] Fehler 2 make[2]: Verlasse Verzeichnis '/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build/lib' make[2]: Betrete Verzeichnis '/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build' mkdir -p /home/mrk/sage-2.10.1/local/include/atlas chmod 0755 /home/mrk/sage-2.10.1/local/include/atlas make -f Make.top install_inc INSTdir=/home/mrk/sage-2.10.1/local/ include make[3]: Betrete Verzeichnis '/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build' cp /home/mrk/sage-2.10.1/spkg/build/atlas-3.8.p11/ATLAS-build/../src/ ATLAS//include/cblas.h /home/mrk/sage-2.10.1/local/include/. cp /home/mrk/sage-2.10.1/spkg/build/atlas-3.8.p11/ATLAS-build/../src/ ATLAS//include/clapack.h /home/mrk/sage-2.10.1/local/include/. chmod 0644 /home/mrk/sage-2.10.1/local/include/cblas.h /home/mrk/ sage-2.10.1/local/include/clapack.h cp /home/mrk/sage-2.10.1/spkg/build/atlas-3.8.p11/ATLAS-build/include/ * /home/mrk/sage-2.10.1/local/include/atlas/. chmod 0644 /home/mrk/sage-2.10.1/local/include/atlas/* make[3]: Verlasse Verzeichnis '/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build' make -f Make.top install_lib INSTdir=/home/mrk/sage-2.10.1/local/lib make[3]: Betrete Verzeichnis '/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build' cp /home/mrk/sage-2.10.1/spkg/build/atlas-3.8.p11/ATLAS-build/lib/ libatlas.a /home/mrk/sage-2.10.1/local/lib/. cp /home/mrk/sage-2.10.1/spkg/build/atlas-3.8.p11/ATLAS-build/lib/ libcblas.a /home/mrk/sage-2.10.1/local/lib/. cp /home/mrk/sage-2.10.1/spkg/build/atlas-3.8.p11/ATLAS-build/lib/ liblapack.a /home/mrk/sage-2.10.1/local/lib/. chmod 0644 /home/mrk/sage-2.10.1/local/lib/libatlas.a /home/mrk/ sage-2.10.1/local/lib/liblapack.a \ /home/mrk/sage-2.10.1/local/lib/libcblas.a cp /home/mrk/sage-2.10.1/spkg/build/atlas-3.8.p11/ATLAS-build/lib/ libf77blas.a /home/mrk/sage-2.10.1/local/lib/. cp: Aufruf von stat für "/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build/lib/libf77blas.a" nicht möglich: No such file or directory make[3]: [install_lib] Fehler 1 (ignoriert) chmod 0644 /home/mrk/sage-2.10.1/local/lib/libf77blas.a chmod: Zugriff auf "/home/mrk/sage-2.10.1/local/lib/libf77blas.a" nicht möglich: No such file or directory make[3]: [install_lib] Fehler 1 (ignoriert) cp /home/mrk/sage-2.10.1/spkg/build/atlas-3.8.p11/ATLAS-build/lib/ libptcblas.a /home/mrk/sage-2.10.1/local/lib/. cp: Aufruf von stat für "/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build/lib/libptcblas.a" nicht möglich: No such file or directory make[3]: [install_lib] Fehler 1 (ignoriert) cp /home/mrk/sage-2.10.1/spkg/build/atlas-3.8.p11/ATLAS-build/lib/ libptf77blas.a /home/mrk/sage-2.10.1/local/lib/. cp: Aufruf von stat für "/home/mrk/sage-2.10.1/spkg/build/ atlas-3.8.p11/ATLAS-build/lib/libptf77blas.a" nicht möglich: No such file or directory make[3]: [install_lib] Fehler 1 (ignoriert) chmod 0644 /home/mrk/sage-2.10.1/local/lib/libptcblas.a /home/mrk/ sage-2.10.1/local/lib/libptf77blas.a chmod: Zugriff auf "/home/mrk/sage-2.10.1/local/lib/libptcblas.a" nicht möglich: No such file or directory chmod: Zugriff auf "/home/mrk/sage-2.10.1/local/lib/libptf77blas.a" nicht möglich: No such file or directory make[3]: [install_lib] Fehler 1 (ignoriert) cp /home/mrk/sage-2.10.1/spkg/build/atlas-3.8.p11/ATLAS-build/lib/ libatlas.so /home/mrk/sage-2.10.1/local/lib/. cp /home/mrk/sage-2.10.1/spkg/build/atlas-3.8.p11/ATLAS-build/lib/ libcblas.so /home/mrk/sage-2.10.1/local/lib/. cp: Aufruf von stat für "/home/mrk/sage-2.10.1/spk
[sage-devel] Re: Partitioning a list
Let me be the first of many ;-) to say that's maybe more efficient to use a temporary variable for the padding: def partition(v,n,pad=0): t=(v+[pad]*(n-len(v)%n)) return [t[i:i+n] for i in range(0,len(v),n)] -vgermrk- On 24 Jan., 09:46, vgermrk <[EMAIL PROTECTED]> wrote: > Let me be the first of many (i like this game :-) to give you > (hopefully) the final solution: > > def partition(v,n,pad=0): > return [(v+[pad]*(n-len(v)%n))[i:i+n] for i in range(0,len(v),n)] > > -vgermrk- > > On 24 Jan., 01:34, Jason Grout <[EMAIL PROTECTED]> wrote: > > > [EMAIL PROTECTED] wrote: > > > > On Wed, 23 Jan 2008, William Stein wrote: > > > >> On Jan 23, 2008 4:12 PM, Jason Grout <[EMAIL PROTECTED]> wrote: > > >>> Does anyone know the best way to partition a list into sublists of a > > >>> specific length, similar to the Partition command in Mathematica? I'm > > >>> thinking of something like: > > > >>> sage: partition([1,2,3,4],2) > > >>> [[1,2],[3,4]] > > >>> sage: partition([1,2,3,4,5],2,pad=0) > > >>> [[1,2],[3,4],[5,0]] > > > >>> It seems like this is a problem that python would have solved millions > > >>> of years ago, but I can't find anything when searching online. I can > > >>> whip it up quickly, but I'm sure it's already been invented, which is > > >>> why I'm asking. > > >> Let me be the first of many to post a one liner: > > > >> sage: def partition(v, n): > > >> ... return [v[n*i:n*i+n] for i in range(len(v)//n)] > > > >> sage: partition([1,2,3,4],2) > > >> [[1, 2], [3, 4]] > > > > Let me be the first of many to post a counterexample: > > > sage: partition([1,2,3,4,5],2) > > > [[1, 2], [3, 4]] > > > > and a fix: > > > > sage: def partition(v,n): > > > ... return [v[i:i+n] for i in range(0,len(v),n)] > > > sage: partition([1,2,3,4,5],2) > > > [[1, 2], [3, 4], [5]] > > > And let me be the first of many to say that that was the solution that I > > finally found as I continued to search. Is there a nice, fast function > > that provides some of the pretty extensive functionality of the > > Partition function in Mathematica? Or how about even just a default > > padding, as in my example? > > > Seehttp://reference.wolfram.com/mathematica/ref/Partition.html > > > Or is it time to write such a function? :) > > > As it is, the one-liner above is all I need for now. > > > Thanks, > > > Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@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-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-devel] Re: Partitioning a list
Let me be the first of many (i like this game :-) to give you (hopefully) the final solution: def partition(v,n,pad=0): return [(v+[pad]*(n-len(v)%n))[i:i+n] for i in range(0,len(v),n)] -vgermrk- On 24 Jan., 01:34, Jason Grout <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > On Wed, 23 Jan 2008, William Stein wrote: > > >> On Jan 23, 2008 4:12 PM, Jason Grout <[EMAIL PROTECTED]> wrote: > >>> Does anyone know the best way to partition a list into sublists of a > >>> specific length, similar to the Partition command in Mathematica? I'm > >>> thinking of something like: > > >>> sage: partition([1,2,3,4],2) > >>> [[1,2],[3,4]] > >>> sage: partition([1,2,3,4,5],2,pad=0) > >>> [[1,2],[3,4],[5,0]] > > >>> It seems like this is a problem that python would have solved millions > >>> of years ago, but I can't find anything when searching online. I can > >>> whip it up quickly, but I'm sure it's already been invented, which is > >>> why I'm asking. > >> Let me be the first of many to post a one liner: > > >> sage: def partition(v, n): > >> ... return [v[n*i:n*i+n] for i in range(len(v)//n)] > > >> sage: partition([1,2,3,4],2) > >> [[1, 2], [3, 4]] > > > Let me be the first of many to post a counterexample: > > sage: partition([1,2,3,4,5],2) > > [[1, 2], [3, 4]] > > > and a fix: > > > sage: def partition(v,n): > > ... return [v[i:i+n] for i in range(0,len(v),n)] > > sage: partition([1,2,3,4,5],2) > > [[1, 2], [3, 4], [5]] > > And let me be the first of many to say that that was the solution that I > finally found as I continued to search. Is there a nice, fast function > that provides some of the pretty extensive functionality of the > Partition function in Mathematica? Or how about even just a default > padding, as in my example? > > Seehttp://reference.wolfram.com/mathematica/ref/Partition.html > > Or is it time to write such a function? :) > > As it is, the one-liner above is all I need for now. > > Thanks, > > Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@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-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-devel] Re: Partitioning a list
Let me be the first of many (i like this game :-) to give you (hopefully) the final solution: sage: def partition(v,n,pad=0): ...return [(v+[pad]*(n-len(v)%n))[i:i+n] for i in range(0,len(v),n)] -vgermrk- On 24 Jan., 01:34, Jason Grout <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > On Wed, 23 Jan 2008, William Stein wrote: > > >> On Jan 23, 2008 4:12 PM, Jason Grout <[EMAIL PROTECTED]> wrote: > >>> Does anyone know the best way to partition a list into sublists of a > >>> specific length, similar to the Partition command in Mathematica? I'm > >>> thinking of something like: > > >>> sage: partition([1,2,3,4],2) > >>> [[1,2],[3,4]] > >>> sage: partition([1,2,3,4,5],2,pad=0) > >>> [[1,2],[3,4],[5,0]] > > >>> It seems like this is a problem that python would have solved millions > >>> of years ago, but I can't find anything when searching online. I can > >>> whip it up quickly, but I'm sure it's already been invented, which is > >>> why I'm asking. > >> Let me be the first of many to post a one liner: > > >> sage: def partition(v, n): > >> ... return [v[n*i:n*i+n] for i in range(len(v)//n)] > > >> sage: partition([1,2,3,4],2) > >> [[1, 2], [3, 4]] > > > Let me be the first of many to post a counterexample: > > sage: partition([1,2,3,4,5],2) > > [[1, 2], [3, 4]] > > > and a fix: > > > sage: def partition(v,n): > > ... return [v[i:i+n] for i in range(0,len(v),n)] > > sage: partition([1,2,3,4,5],2) > > [[1, 2], [3, 4], [5]] > > And let me be the first of many to say that that was the solution that I > finally found as I continued to search. Is there a nice, fast function > that provides some of the pretty extensive functionality of the > Partition function in Mathematica? Or how about even just a default > padding, as in my example? > > Seehttp://reference.wolfram.com/mathematica/ref/Partition.html > > Or is it time to write such a function? :) > > As it is, the one-liner above is all I need for now. > > Thanks, > > Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@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-devel URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-devel] Re: Block matrices?
On 9 Jan., 08:25, "Mike Hansen" <[EMAIL PROTECTED]> wrote: > It was my impression that he didn't want a matrix with matrix entries, > but instead wanted the matrix whose entries were given by the entries > of the submatrices. > > --Mike That's right. I should make myself more clearer next time. --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@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-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Block matrices?
Is there a way to construct block matrices in SAGE? Not just the "block_sum", "augment" and "stack" functions. As an example, let A, B, C, D be matrices and i want to construct a matrix like E=[[A,B],[C,D]] Such a feature would be very nice. -vgermrk- --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@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-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---