[sage-support] Re: create a subdiagonal matrix quickly

2009-06-21 Thread rickhg12hs

On Jun 20, 10:18 pm, Robert Bradshaw rober...@math.washington.edu
wrote:
 sage: n = 10
 sage: m = block_matrix([0, zero_matrix(1,1), identity_matrix(n), 0])
 sage: m.subdivide() # get rid of the block divisions
 sage: m
 [0 0 0 0 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0 0]
 [0 1 0 0 0 0 0 0 0 0 0]
 [0 0 1 0 0 0 0 0 0 0 0]
 [0 0 0 1 0 0 0 0 0 0 0]
 [0 0 0 0 1 0 0 0 0 0 0]
 [0 0 0 0 0 1 0 0 0 0 0]
 [0 0 0 0 0 0 1 0 0 0 0]
 [0 0 0 0 0 0 0 1 0 0 0]
 [0 0 0 0 0 0 0 0 1 0 0]
 [0 0 0 0 0 0 0 0 0 1 0]

 You can also use this to get anything you want on the sub-diagonal  
 (or pretty much anywhere).

 sage: m = block_matrix([0, zero_matrix(1,1), diagonal_matrix([10, 20,  
 30, 40]), 0]); m.subdivide(); m
 [ 0  0  0  0  0]
 [10  0  0  0  0]
 [ 0 20  0  0  0]
 [ 0  0 30  0  0]
 [ 0  0  0 40  0]

Very nice - I didn't know about block_matrix.  In addition, it seems
block_matrix has an optional argument subdivide.

sage: n = 10
sage: m = block_matrix([0, zero_matrix(1,1), identity_matrix(n),
0],subdivide=False)
sage: m
[0 0 0 0 0 0 0 0 0 0 0]
[1 0 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0 0 0 0]
[0 0 0 1 0 0 0 0 0 0 0]
[0 0 0 0 1 0 0 0 0 0 0]
[0 0 0 0 0 1 0 0 0 0 0]
[0 0 0 0 0 0 1 0 0 0 0]
[0 0 0 0 0 0 0 1 0 0 0]
[0 0 0 0 0 0 0 0 1 0 0]
[0 0 0 0 0 0 0 0 0 1 0]

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: create a subdiagonal matrix quickly

2009-06-21 Thread Jason Grout

rickhg12hs wrote:
 On Jun 20, 10:18 pm, Robert Bradshaw rober...@math.washington.edu
 wrote:
 sage: n = 10
 sage: m = block_matrix([0, zero_matrix(1,1), identity_matrix(n), 0])
 sage: m.subdivide() # get rid of the block divisions
 sage: m
 [0 0 0 0 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0 0]
 [0 1 0 0 0 0 0 0 0 0 0]
 [0 0 1 0 0 0 0 0 0 0 0]
 [0 0 0 1 0 0 0 0 0 0 0]
 [0 0 0 0 1 0 0 0 0 0 0]
 [0 0 0 0 0 1 0 0 0 0 0]
 [0 0 0 0 0 0 1 0 0 0 0]
 [0 0 0 0 0 0 0 1 0 0 0]
 [0 0 0 0 0 0 0 0 1 0 0]
 [0 0 0 0 0 0 0 0 0 1 0]

 You can also use this to get anything you want on the sub-diagonal  
 (or pretty much anywhere).

 sage: m = block_matrix([0, zero_matrix(1,1), diagonal_matrix([10, 20,  
 30, 40]), 0]); m.subdivide(); m
 [ 0  0  0  0  0]
 [10  0  0  0  0]
 [ 0 20  0  0  0]
 [ 0  0 30  0  0]
 [ 0  0  0 40  0]
 
 Very nice - I didn't know about block_matrix.  In addition, it seems
 block_matrix has an optional argument subdivide.
 
 sage: n = 10
 sage: m = block_matrix([0, zero_matrix(1,1), identity_matrix(n),
 0],subdivide=False)
 sage: m
 [0 0 0 0 0 0 0 0 0 0 0]
 [1 0 0 0 0 0 0 0 0 0 0]
 [0 1 0 0 0 0 0 0 0 0 0]
 [0 0 1 0 0 0 0 0 0 0 0]
 [0 0 0 1 0 0 0 0 0 0 0]
 [0 0 0 0 1 0 0 0 0 0 0]
 [0 0 0 0 0 1 0 0 0 0 0]
 [0 0 0 0 0 0 1 0 0 0 0]
 [0 0 0 0 0 0 0 1 0 0 0]
 [0 0 0 0 0 0 0 0 1 0 0]
 [0 0 0 0 0 0 0 0 0 1 0]
 


I should mention that these methods are all nice for this problem, but 
they also end up copying an awful lot of zeros.  I think it would be way 
more efficient in general to make a zero matrix, then set the right 
diagonal by hand using a for loop.

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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: How to doctest a pyx file?

2009-06-21 Thread Simon King

Hi!

On 20 Jun., 22:10, gsw georgswe...@googlemail.com wrote:
 If you wish, we could discuss this topic further and in depth on sage-
 devel (where it belongs), just open a thread there.

In the first place, I thought it was a support problem, because I
thought that testing any text file should be simple (and used to
work), and I simple wasn't aware how it works.

Anyway: 
http://groups.google.com/group/sage-devel/browse_thread/thread/3f9c8660ed742303

Cheers,
   Simon

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: create a subdiagonal matrix quickly

2009-06-21 Thread Rajeev Singh

 I should mention that these methods are all nice for this problem, but
 they also end up copying an awful lot of zeros.  I think it would be way
 more efficient in general to make a zero matrix, then set the right
 diagonal by hand using a for loop.


Don't you think using a sparse matrix would be a better thing to do in such
situations?

Rajeev

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] how to controll precision when show'ing formulas?

2009-06-21 Thread Jurgis Pralgauskis

hello,

I am constructing simple interact
http://sagenb.org/home/pub/592/

in published worksheet, interact seems not to function
so I give the picture..
http://ftp.akl.lt/users/jurgis/etc/formule_show_precision--how.png

I want that
show(function) would give me just 1 precision digit after comma
how could I achieve this?

now I use html which is quite unconfortable

thanks in advance
-- 
Jurgis Pralgauskis
Don't worry, be happy and make things better ;)

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Sage Installation on Mac OS X 10.5.7

2009-06-21 Thread quark123

1. I am running Mac OS X 10.5.7.
2. I downloaded sage-4.0.1-OSX10.5.PowerPC-PowerMacIntosh-Darwin.dmg
3. When I run the Unix Executable file sage using Terminal, I get the
following error:

/Applications/sage-4.0.1-OSX10.5-PowerPC-PowerMacintosh-Darwin/sage/
local/bin/sage-sage: line 198:   407 Illegal instruction sage-
ipython $@ -i


4. What do I have to do?

Thanks.

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Install problem for Sage

2009-06-21 Thread lim

Hi

I encountered the IO Error: [Errno 30] (last line of the the below
quoted message) while installing Sage.  Can anyone out there please
help?
--
| Sage Version 4.0.1, Release Date: 2009-06-06   |
| Type notebook() for the GUI, and license() for information.|
--
The SAGE install tree may have moved.
Regenerating Python.pyo and .pyc files that hardcode the install PATH
(please wait at
most a few minutes)...
Do not interrupt this.
Traceback (most recent call last):
  File /Volumes/sage-4.0.1-OSX10.5-Intel-i386-Darwin/sage/local/bin/
sage-location, line 181, in module
update_library_files(R)
  File /Volumes/sage-4.0.1-OSX10.5-Intel-i386-Darwin/sage/local/bin/
sage-location, line 128, in update_library_files
open(LIB + F,'w').write(H)
IOError: [Errno 30] Read-only file system: '/Volumes/sage-4.0.1-
OSX10.5-Intel-i386-Darwin/sage/local/lib/libcord.la'



--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Install problem for Sage

2009-06-21 Thread William Stein

2009/6/21 lim pete...@net-yan.com:

 Hi

 I encountered the IO Error: [Errno 30] (last line of the the below
 quoted message) while installing Sage.  Can anyone out there please
 help?

Try starting Sage from the terminal and typing

cd /Volumes/sage-4.0.1-OSX10.5-Intel-i386-Darwin/sage
sudo ./sage

William

 --
 | Sage Version 4.0.1, Release Date: 2009-06-06                       |
 | Type notebook() for the GUI, and license() for information.        |
 --
 The SAGE install tree may have moved.
 Regenerating Python.pyo and .pyc files that hardcode the install PATH
 (please wait at
 most a few minutes)...
 Do not interrupt this.
 Traceback (most recent call last):
  File /Volumes/sage-4.0.1-OSX10.5-Intel-i386-Darwin/sage/local/bin/
 sage-location, line 181, in module
    update_library_files(R)
  File /Volumes/sage-4.0.1-OSX10.5-Intel-i386-Darwin/sage/local/bin/
 sage-location, line 128, in update_library_files
    open(LIB + F,'w').write(H)
 IOError: [Errno 30] Read-only file system: '/Volumes/sage-4.0.1-
 OSX10.5-Intel-i386-Darwin/sage/local/lib/libcord.la'



 




-- 
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 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Install problem for Sage

2009-06-21 Thread lim

Hi William

I was asked for password after typing su ./sage.  What shall I
response?

P Lim


On Jun 21, 9:00 pm, William Stein wst...@gmail.com wrote:
 2009/6/21 lim pete...@net-yan.com:



  Hi

  I encountered the IO Error: [Errno 30] (last line of the the below
  quoted message) while installing Sage.  Can anyone out there please
  help?

 Try starting Sage from the terminal and typing

     cd /Volumes/sage-4.0.1-OSX10.5-Intel-i386-Darwin/sage
     sudo ./sage

 William





  --
  | Sage Version 4.0.1, Release Date: 2009-06-06                       |
  | Type notebook() for the GUI, and license() for information.        |
  --
  The SAGE install tree may have moved.
  Regenerating Python.pyo and .pyc files that hardcode the install PATH
  (please wait at
  most a few minutes)...
  Do not interrupt this.
  Traceback (most recent call last):
   File /Volumes/sage-4.0.1-OSX10.5-Intel-i386-Darwin/sage/local/bin/
  sage-location, line 181, in module
     update_library_files(R)
   File /Volumes/sage-4.0.1-OSX10.5-Intel-i386-Darwin/sage/local/bin/
  sage-location, line 128, in update_library_files
     open(LIB + F,'w').write(H)
  IOError: [Errno 30] Read-only file system: '/Volumes/sage-4.0.1-
  OSX10.5-Intel-i386-Darwin/sage/local/lib/libcord.la'

 --
 William Stein
 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 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Sage Installation on Mac OS X 10.5.7

2009-06-21 Thread gsw



On 21 Jun., 15:01, William Stein wst...@gmail.com wrote:
 2009/6/21 quark123 alexwo...@gmail.com:



  1. I am running Mac OS X 10.5.7.
  2. I downloaded sage-4.0.1-OSX10.5.PowerPC-PowerMacIntosh-Darwin.dmg
  3. When I run the Unix Executable file sage using Terminal, I get the
  following error:

  /Applications/sage-4.0.1-OSX10.5-PowerPC-PowerMacintosh-Darwin/sage/
  local/bin/sage-sage: line 198:   407 Illegal instruction     sage-
  ipython $@ -i

  4. What do I have to do?

  Thanks.

 Do you have a G4 or a G5?
 Your option are either build from source or wait for us to produce a binary
 that works on your hardware.

 William


As soon as the ...G4... Mac OS X binary for Sage 4.0.2 has been
mirrored out, please download and test it, and report back. It has
OSX10.4 in its name, but should work fine on OS X 10.5. Since it is
built on a 550MHz PowerBook, it always quite a little longer than th
other builds. (It is done by now, but I have yet to test it, to upload
it, and then it has to be put on the server.)

Cheers,
gsw


@William:
I'll open a trac ticket for issuing a better error message ...



 --
 William Stein
 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 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: how to controll precision when show'ing formulas?

2009-06-21 Thread Dan Drake
On Sun, 21 Jun 2009 at 12:15PM +0300, Jurgis Pralgauskis wrote:
 
 hello,
 
 I am constructing simple interact
 http://sagenb.org/home/pub/592/
 
 in published worksheet, interact seems not to function
 so I give the picture..
 http://ftp.akl.lt/users/jurgis/etc/formule_show_precision--how.png
 
 I want that
 show(function) would give me just 1 precision digit after comma
 how could I achieve this?

You can use Python's string formatting:
http://docs.python.org/library/stdtypes.html#string-formatting

To get floating-point numbers to display with one decimal point, do
something like this:

sage: '%.2f' % pi
'3.14'
sage: '%.1f' % pi
'3.1'
sage: '%.6f' % pi
'3.141593'

See the Python documentation I linked to above for more details.

Dan

-- 
---  Dan Drake dr...@kaist.edu
-  KAIST Department of Mathematical Sciences
---  http://mathsci.kaist.ac.kr/~drake


signature.asc
Description: Digital signature