[sage-support] autoeval in sagecell

2013-09-07 Thread davidp
I am wondering why only the first cell in the following is automatically 
evaluated:

http://people.reed.edu/~davidp/211/sage/sagecell/tangent_plane.html

I have autoeval set to 'True' and notice that if I add

div class=computescript type=text/x-sage
1+1
/script/div

at the end, it is automatically evaluated.

Thanks in advance for any suggestions.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Re: 3d graphics display problem

2013-07-30 Thread davidp
Fixed: I removed the .jmol directory from my home directory (allowing a new 
one to be formed the next time I ran jmol).  I thought I had tried that 
already.

On Thursday, July 25, 2013 4:15:37 PM UTC-7, davidp wrote:

 In the following, I expect p+s to be a picture of a plane with the word 
 'hello' embedded at its center.  Instead, I get the word 'hello' in the 
 corner of the frame (where the number -1) might be expected.  Further, it 
 prints a number 2 way outside of the frame, and the axes labels are all in 
 the wrong order.  It is as if there is an off-by-one error in some labeling 
 code somewhere.  When I print p+s+t, I get 'hello' embedded in the center 
 as expected, and 'goodbye' is shifted to the corner of the frame now.

 ---
 sage: var('x y')
 (x, y)
 sage: p = plot3d(1,(x,-1,1),(y,-1,1))
 sage: s = text3d('hello',(0,0,1))  # hello appears in the wrong place
 sage: p + s

 sage: t = text3d('goodbye',(0,0,1))  # same coordinates as s
 sage: p + s + t   # hello now appears in the right place, but goodbye does 
 not
 

 I am running sage-5.10 under Ubuntu 13.04 on a laptop.  The *same* setup 
 on my desktop does not produce this error.  I tried re-installing sage, 
 removing my old .sage, .jmol, and .java directories.  Same problem. 
  Further, when I try the same code after logging in as guest on my laptop, 
 the code runs with no problem.  Any suggestions would be appreciated.

 Thanks.





-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] width of lines in plot legend

2013-07-27 Thread davidp
Is there a way to increase the linewidth of lines appearing in the legend 
of a plot without changing the linewidth in the plot, itself?

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] legends for 3d graphics

2013-07-25 Thread davidp
I am using Sage to plot an arrangement of planes in 3-space.  Each plane 
has its own color, and I would like a legend in the plot that associates 
the equation of each plane with its color.  This experiment seems to 
indicate that legends are not available for 3d graphics:

---
sage: p = plot3d(x^2,(x,-1,1),(y,-1,1),legend_label='0')
sage: q = plot3d(x^2+y^2,(x,-1,1),(y,-1,1),legend_label='1')
sage: c = p+q
sage: c.legend(true)
---
AttributeErrorTraceback (most recent call last)
ipython-input-28-744abb0d6c3b in module()
 1 c.legend(true)

AttributeError: 'Graphics3dGroup' object has no attribute 'legend'
---

As I rotate the 3d-object, I would like for the legend would stay in one 
place.

Any suggestions?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] legends for 3d graphics

2013-07-25 Thread davidp
Cool!

On Thursday, July 25, 2013 10:58:56 AM UTC-7, William wrote:

 On Thu, Jul 25, 2013 at 9:16 AM, davidp davi...@gmail.com javascript: 
 wrote: 
  I am using Sage to plot an arrangement of planes in 3-space.  Each plane 
 has 
  its own color, and I would like a legend in the plot that associates the 
  equation of each plane with its color.  This experiment seems to 
 indicate 
  that legends are not available for 3d graphics: 
  
  
 --- 
  sage: p = plot3d(x^2,(x,-1,1),(y,-1,1),legend_label='0') 
  sage: q = plot3d(x^2+y^2,(x,-1,1),(y,-1,1),legend_label='1') 
  sage: c = p+q 
  sage: c.legend(true) 
  
 --- 
  AttributeErrorTraceback (most recent call 
 last) 
  ipython-input-28-744abb0d6c3b in module() 
   1 c.legend(true) 
  
  AttributeError: 'Graphics3dGroup' object has no attribute 'legend' 
  
 --- 
  
  As I rotate the 3d-object, I would like for the legend would stay in one 
  place. 
  
  Any suggestions? 

 This won't help you today, but an REU student -- Renford Alexander -- 
 is working fulltime right now on Three.js-based 3d graphics rendering 
 for https://cloud.sagemath.com.  He showed me some demos yesterday of 
 drawing text in 3d, the looked pretty useful.  In particular, he draws 
 arbitrary text on a 2d html5 canvas, then puts the canvas element in 
 the 3d scenes as a sprite.This functionality should come to 
 https://cloud.sagemath.com within a month, hopefully. 

  -- William 

  
  Thanks. 
  
  -- 
  You received this message because you are subscribed to the Google 
 Groups 
  sage-support group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to sage-support...@googlegroups.com javascript:. 
  To post to this group, send email to 
  sage-s...@googlegroups.comjavascript:. 

  Visit this group at http://groups.google.com/group/sage-support. 
  For more options, visit https://groups.google.com/groups/opt_out. 
  
  



 -- 
 William Stein 
 Professor of Mathematics 
 University of Washington 
 http://wstein.org 


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] 3d graphics display problem

2013-07-25 Thread davidp
In the following, I expect p+s to be a picture of a plane with the word 
'hello' embedded at its center.  Instead, I get the word 'hello' in the 
corner of the frame (where the number -1) might be expected.  Further, it 
prints a number 2 way outside of the frame, and the axes labels are all in 
the wrong order.  It is as if there is an off-by-one error in some labeling 
code somewhere.  When I print p+s+t, I get 'hello' embedded in the center 
as expected, and 'goodbye' is shifted to the corner of the frame now.

---
sage: var('x y')
(x, y)
sage: p = plot3d(1,(x,-1,1),(y,-1,1))
sage: s = text3d('hello',(0,0,1))  # hello appears in the wrong place
sage: p + s

sage: t = text3d('goodbye',(0,0,1))  # same coordinates as s
sage: p + s + t   # hello now appears in the right place, but goodbye does 
not


I am running sage-5.10 under Ubuntu 13.04 on a laptop.  The *same* setup on 
my desktop does not produce this error.  I tried re-installing sage, 
removing my old .sage, .jmol, and .java directories.  Same problem. 
 Further, when I try the same code after logging in as guest on my laptop, 
the code runs with no problem.  Any suggestions would be appreciated.

Thanks.



-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] graphs: unexpected behavior from depth_first_search after relabeling

2013-07-20 Thread davidp
sage: g = graphs.CycleGraph(4)
sage: list(g.depth_first_search(0))
[0, 3, 2, 1]
sage: g.relabel([0,3,2,1])
sage: list(g.depth_first_search(0))
[0, 1, 2, 3]

I was expecting to get [0,3,2,1]  again after relabeling.

Dave

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] sage is filling up my directory with files

2013-04-24 Thread davidp
I just installed Sage 5.8 and am running it from the command line.  For 
some reason, it is filling up my directory with what looks like temporary 
files, e.g., threshold.sageJmarTS.py,  threshold.sageR9Gfg9, and on and 
on.  (I  attached code contained in a file called 'threshold.sage'.  I get 
the same behavior from other attached files.)  These files remain in the 
directory after i quit Sage.  Could someone tell me what's wrong?

Thanks,
Dave  

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] Re: sage is filling up my directory with files

2013-04-24 Thread davidp
I think this problem has to do with attaching a file.  I noticed that 
attach has been deprecated.  Using either 'attach' or '%attach' seems to 
cause the proliferation of extra files.  The 'load' command or '%runfile' 
does not seem to have this behavior.  The problem with the 'attach' command 
seems like a bug to me.  Shouldn't these extra files be stored in some tmp 
file in the sage directory that get erased at the end of the session, or 
something like that?

Thanks,
Dave

On Wednesday, April 24, 2013 8:53:56 AM UTC-7, davidp wrote:

 I just installed Sage 5.8 and am running it from the command line.  For 
 some reason, it is filling up my directory with what looks like temporary 
 files, e.g., threshold.sageJmarTS.py,  threshold.sageR9Gfg9, and on and 
 on.  (I  attached code contained in a file called 'threshold.sage'.  I get 
 the same behavior from other attached files.)  These files remain in the 
 directory after i quit Sage.  Could someone tell me what's wrong?

 Thanks,
 Dave  


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Re: sage is filling up my directory with files

2013-04-24 Thread davidp
I have been using attach and load for years, too, with no problem.  I just 
checked by attaching a file containing only a simple function called 
'hello' that prints 'hello world' when called.  I have the same problem.

Thanks,
Dave

On Wednesday, April 24, 2013 2:18:24 PM UTC-7, Dan Drake wrote:

 I've used attach and load for years without ever encountering this 
 problem. So there must be something about the code in your 
 threshold.sage file. Without seeing it, it's not likely we can help you. 

 On Wed, 24 Apr 2013 at 10:57AM -0700, davidp wrote: 
  I think this problem has to do with attaching a file.  I noticed that 
  attach has been deprecated.  Using either 'attach' or '%attach' seems 
 to 
  cause the proliferation of extra files.  The 'load' command or 
 '%runfile' 
  does not seem to have this behavior.  The problem with the 'attach' 
 command 
  seems like a bug to me.  Shouldn't these extra files be stored in some 
 tmp 
  file in the sage directory that get erased at the end of the session, or 
  something like that? 
  
  Thanks, 
  Dave 
  
  On Wednesday, April 24, 2013 8:53:56 AM UTC-7, davidp wrote: 
   
   I just installed Sage 5.8 and am running it from the command line. 
  For 
   some reason, it is filling up my directory with what looks like 
 temporary 
   files, e.g., threshold.sageJmarTS.py,  threshold.sageR9Gfg9, and on 
 and 
   on.  (I  attached code contained in a file called 'threshold.sage'.  I 
 get 
   the same behavior from other attached files.)  These files remain in 
 the 
   directory after i quit Sage.  Could someone tell me what's wrong? 
   
   Thanks, 
   Dave   
   
  


 Dan 

 -- 
 ---  Dan Drake 
 -  http://math.pugetsound.edu/~ddrake 
 --- 


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] Re: sage is filling up my directory with files

2013-04-24 Thread davidp
Yes!  This looks right.

Thanks,
Dave

On Wednesday, April 24, 2013 2:30:09 PM UTC-7, John H Palmieri wrote:



 On Wednesday, April 24, 2013 8:53:56 AM UTC-7, davidp wrote:

 I just installed Sage 5.8 and am running it from the command line.  For 
 some reason, it is filling up my directory with what looks like temporary 
 files, e.g., threshold.sageJmarTS.py,  threshold.sageR9Gfg9, and on and 
 on.  (I  attached code contained in a file called 'threshold.sage'.  I get 
 the same behavior from other attached files.)  These files remain in the 
 directory after i quit Sage.  Could someone tell me what's wrong?

 Thanks,
 Dave  


 I think this is the problem reported here: 
 http://trac.sagemath.org/sage_trac/ticket/14149. There does not seem to 
 be a fix right now.

 -- 
 John
  


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] Re: labels on the frame of a 3d plot

2012-08-31 Thread davidp
I am still interested in this question, in case anyone happens to know the 
answer.

On Thursday, August 18, 2011 4:19:54 PM UTC-7, davidp wrote:

 Is there a way to turn off the labels on the frame in a 3d plot?  I 
 was hoping something like this might work: 

 var('x y') 
 plot3d(sin(x*y),(x,-2,2),(y,-2,2)).show(labels=false) 

 I know that I can set frame=false to get rid of the frame entirely, 
 but that is not what I am looking for.  Is there something like 
 plot.options for 3d graphic object? 

 Dave

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
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.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] ubuntu 12.04 + sage 5.1 + libgfortran

2012-07-28 Thread davidp
I just made a clean install of ubuntu 12.04 on my thinkpad and installed 
sage from 
*sage-5.1-linux-64bit-ubuntu_12.04_lts-x86_64-Linux.tar.lzma*http://boxen.math.washington.edu/home/sagemath/sage-mirror/linux/64bit/sage-5.1-linux-64bit-ubuntu_12.04_lts-x86_64-Linux.tar.lzma,
 
and have a problem, apparently with libgfortran (see below).  Any help 
would be appreciated.

Thanks!

xyzzy sage
--
| Sage Version 5.1, Release Date: 2012-07-09 |
| Type notebook() for the browser-based notebook interface.|
| Type help() for help.|
--
sage: plot(x^2,(x,0,1))
---
ImportError   Traceback (most recent call last)

/home/davidp/ipython console in module()

/usr/local/sage/local/lib/python2.7/site-packages/IPython/Prompts.pyc in 
__call__(self, arg)
550 
551 # and now call a possibly user-defined print mechanism
-- 552 manipulated_val = self.display(arg)
553 
554 # user display hooks can change the variable to be 
stored in

/usr/local/sage/local/lib/python2.7/site-packages/IPython/Prompts.pyc in 
_display(self, arg)
576 return IPython.generics.result_display(arg)
577 except TryNext:
-- 578 return self.shell.hooks.result_display(arg)
579 
580 # Assign the default display method:

/usr/local/sage/local/lib/python2.7/site-packages/IPython/hooks.pyc in 
__call__(self, *args, **kw)
139 #print prio,prio,cmd,cmd #dbg
140 try:
-- 141 ret = cmd(*args, **kw)
142 return ret
143 except ipapi.TryNext, exc:

/usr/local/sage/local/lib/python2.7/site-packages/sage/misc/displayhook.pyc 
in result_display(ip_self, obj)
150 # IPython's default result_display() uses the 
IPython.genutils.Term.cout stream.
151 # See also local/lib/python2.6/site-packages/IPython/hooks.py.
-- 152 print_obj(IPython.genutils.Term.cout, obj)
153 
154 def displayhook(obj):

/usr/local/sage/local/lib/python2.7/site-packages/sage/misc/displayhook.pyc 
in print_obj(out_stream, obj)
142 if _check_tall_list_and_print(out_stream, obj):
143 return
-- 144 print out_stream, `obj`
145 
146 def result_display(ip_self, obj):

/usr/local/sage/local/lib/python2.7/site-packages/sage/structure/sage_object.so 
in sage.structure.sage_object.SageObject.__repr__ 
(sage/structure/sage_object.c:1496)()

/usr/local/sage/local/lib/python2.7/site-packages/sage/plot/graphics.pyc in 
_repr_(self)
801 
802 if SHOW_DEFAULT:
-- 803 self.show()
804 return ''
805 else:

/usr/local/sage/local/lib/python2.7/site-packages/sage/misc/decorators.pyc 
in wrapper(*args, **kwds)
454 kwds[self.name + options] = suboptions
455 
-- 456 return func(*args, **kwds)
457 
458 #Add the options specified by @options to the signature of 
the wrapped

/usr/local/sage/local/lib/python2.7/site-packages/sage/plot/graphics.pyc in 
show(self, **kwds)
   1513 else:
   1514 kwds.setdefault('filename', 
sage.misc.misc.tmp_filename() + '.png')
- 1515 self.save(**kwds)
   1516 os.system('%s %s 2/dev/null 1/dev/null '
   1517   % (sage.misc.viewer.browser(), 
kwds['filename']))

/usr/local/sage/local/lib/python2.7/site-packages/sage/misc/decorators.pyc 
in wrapper(*args, **kwds)
454 kwds[self.name + options] = suboptions
455 
-- 456 return func(*args, **kwds)
457 
458 #Add the options specified by @options to the signature of 
the wrapped

/usr/local/sage/local/lib/python2.7/site-packages/sage/plot/graphics.pyc in 
save(self, filename, **kwds)
   2245 SageObject.save(self, filename)
   2246 else:
- 2247 figure = self.matplotlib(**options)
   2248 # You can output in PNG, PS, EPS, PDF, or SVG format, 
depending on the file extension.
   2249 # matplotlib looks at the file extension to see what 
the renderer should be.

/usr/local/sage/local/lib/python2.7/site-packages/sage/plot/graphics.pyc in 
matplotlib(self, filename, xmin, xmax, ymin, ymax, figsize, figure, sub, 
axes, axes_labels, fontsize, frame, verify, aspect_ratio, gridlines, 
gridlinesstyle, vgridlinesstyle, hgridlinesstyle, show_legend, 
legend_options, axes_pad, ticks_integer, tick_formatter, ticks)
   1720 axes = self.__show_axes
   1721 
- 1722 from matplotlib.figure import Figure
   1723 from matplotlib import rcParams
   1724 self.fontsize(fontsize)

/usr

[sage-support] Re: ubuntu 12.04 + sage 5.1 + libgfortran

2012-07-28 Thread davidp
I had tried that, then got a further error, so I backtracked.  After 
reading your advice, I tried again, and everything worked.  

Thanks.   


On Saturday, July 28, 2012 1:00:57 PM UTC-7, P Purkayastha wrote:

 On 07/29/2012 03:29 AM, davidp wrote: 
  I just made a clean install of ubuntu 12.04 on my thinkpad and installed 
  sage from *sage-5.1-linux-64bit-ubuntu_12.04_lts-x86_64-Linux.tar.lzma* 
  
 http://boxen.math.washington.edu/home/sagemath/sage-mirror/linux/64bit/sage-5.1-linux-64bit-ubuntu_12.04_lts-x86_64-Linux.tar.lzma,
  

  and have a problem, apparently with libgfortran (see below). Any help 
  would be appreciated. 
  
  Thanks! 
  
  
  ImportError: libgfortran.so.3: cannot open shared object file: No such 
  file or directory 

 You need to install libgfortran. 



-- 
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] labels on the frame of a 3d plot

2011-08-18 Thread davidp
Is there a way to turn off the labels on the frame in a 3d plot?  I
was hoping something like this might work:

var('x y')
plot3d(sin(x*y),(x,-2,2),(y,-2,2)).show(labels=false)

I know that I can set frame=false to get rid of the frame entirely,
but that is not what I am looking for.  Is there something like
plot.options for 3d graphic object?

Dave

-- 
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] drawing a graph that has only some of its edges oriented

2011-06-29 Thread davidp
Hi,

I have found the need to think about partially oriented graphs: some
edges have an orientation and others do not.  It would be natural to
draw these with arrows for directed edges and lines for undirected
edges.   What is the easiest way to do this with Sage?

Thanks,
Dave

-- 
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: drawing a graph that has only some of its edges oriented

2011-06-29 Thread davidp
My solution at the moment is to plot the graph setting save_pos=true.
Using the vertex positions determined by the plot, I create arrows for
the oriented edges.  I then plot the original plot of the graph plus
the arrows.

Dave

On Jun 29, 7:18 pm, davidp davide...@gmail.com wrote:
 Hi,

 I have found the need to think about partially oriented graphs: some
 edges have an orientation and others do not.  It would be natural to
 draw these with arrows for directed edges and lines for undirected
 edges.   What is the easiest way to do this with Sage?

 Thanks,
 Dave

-- 
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] mesh in parametric_plot3d

2010-08-28 Thread davidp
I would like to show my class a parametrized surface with mesh lines
(on Monday!).

1. The following code produces no mesh lines:

sage: var('x y')
sage: parametric_plot3d((x,x^2+y,x*y),(x,0,1),(y,
0,1),plot_points=10,mesh=true)

That seems odd to me.

2. The following code produces mesh lines, but they are very light in
color.  Is it possible to make the mesh lines thicker or to change
their color to black?

sage parametric_plot3d((x,x^2+y,x*y),(x,0,1),(y,
0,1),plot_points=10).show(mesh=true)

3. In general, I find it difficult to trace down which options are
applicable to the various plotting functions.  The documentation for
plot, plot3d, etc, list some options but not all, it seems.

I am using Sage 4.5.2 on Ubuntu 10.04.

Thanks,
Dave

-- 
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] matrix_plot

2010-08-12 Thread davidp
I am using Sage Version 4.3, Release Date: 2009-12-24.  The two plots:

matrix_plot(matrix(2,[2,2,3,3]),axes=false,frame=false)
matrix_plot(matrix(2,[1,1,3,3]),axes=false,frame=false)

look the same to me.  I tried various cmaps with the same result.  Is
there a way to set a cmap so that the plots of these matrices will be
distinct?

Thanks,
Dave

-- 
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: matrix_plot

2010-08-12 Thread davidp
Thanks.

No problem.  I wrote a function to create what I wanted using
'polygon'.  It is useful to know that colormaps were not the answer.

Dave

On Aug 12, 3:47 pm, William Stein wst...@gmail.com wrote:
 On Thu, Aug 12, 2010 at 3:38 PM, davidp dav...@reed.edu wrote:
  I am using Sage Version 4.3, Release Date: 2009-12-24.  The two plots:

  matrix_plot(matrix(2,[2,2,3,3]),axes=false,frame=false)
  matrix_plot(matrix(2,[1,1,3,3]),axes=false,frame=false)

  look the same to me.  I tried various cmaps with the same result.  Is
  there a way to set a cmap so that the plots of these matrices will be
  distinct?

 No.  I think by default the input data is scaled to be between I think
 0 and 1.  You'll have to try something besides color maps.

 William

-- 
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] missing eigenvectors

2010-08-06 Thread davidp
Sage has no trouble finding the eigenvectors of the 3x3 matrix below
but something is wrong in the 4x4 example.  Am I doing something
silly?

sage: version()
'Sage Version 4.3, Release Date: 2009-12-24'
sage: m=matrix(CC,[[1,0,I],[1,1,0],[I,0,1]])
sage: m.eigenvectors_right()
[(1.00 + 1.00*I, [
(1.00, -1.00*I, 1.00)
], 1), (1.00, [
(0, 1.00, 0)
], 1), (1.00 - 1.00*I, [
(1.00, 1.00*I, -1.00)
], 1)]
sage: n=matrix(CC,[[1,0,I,0],[1,1,0,I],[I,0,1,1],[0,I,0,2]])
sage: n.eigenvectors_right()
[(1.77621849241320 + 1.01489897201814*I, [

], 1), (1.77621849241320 - 1.01489897201814*I, [

], 1), (0.723781507586799 + 1.07181709265703*I, [

], 1), (0.723781507586799 - 1.07181709265703*I, [

], 1)]

-- 
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: missing eigenvectors

2010-08-06 Thread davidp
Thanks a lot!

Dave

On Aug 6, 7:29 pm, Jason Grout jason-s...@creativetrax.com wrote:
 On 8/6/10 11:56 AM, davidp wrote:



  Sage has no trouble finding the eigenvectors of the 3x3 matrix below
  but something is wrong in the 4x4 example.  Am I doing something
  silly?

  sage: version()
  'Sage Version 4.3, Release Date: 2009-12-24'
  sage: m=matrix(CC,[[1,0,I],[1,1,0],[I,0,1]])
  sage: m.eigenvectors_right()
  [(1.00 + 1.00*I, [
  (1.00, -1.00*I, 1.00)
  ], 1), (1.00, [
  (0, 1.00, 0)
  ], 1), (1.00 - 1.00*I, [
  (1.00, 1.00*I, -1.00)
  ], 1)]
  sage: n=matrix(CC,[[1,0,I,0],[1,1,0,I],[I,0,1,1],[0,I,0,2]])
  sage: n.eigenvectors_right()
  [(1.77621849241320 + 1.01489897201814*I, [

  ], 1), (1.77621849241320 - 1.01489897201814*I, [

  ], 1), (0.723781507586799 + 1.07181709265703*I, [

  ], 1), (0.723781507586799 - 1.07181709265703*I, [

  ], 1)]

 Short answer: use CDF, not CC.

 sage: n=matrix(CDF,[[1,0,I,0],[1,1,0,I],[I,0,1,1],[0,I,0,2]])
 sage: n.eigenvectors_right()
 [(0.723781507587 - 1.07181709266*I, [(-0.512558924324 -
 0.132091804021*I, 0.462262927873 - 0.251444224409*I, 0.585855615051,
 -0.293915958782 - 0.115371137717*I)], 1), (1.77621849241 -
 1.01489897202*I, [(0.340477754428 - 0.0450332871844*I, 0.598345310973,
 -0.38050619325 - 0.218580892372*I, -0.562226753834 - 0.123968940799*I)],
 1), (0.723781507587 + 1.07181709266*I, [(0.512558924324 -
 0.132091804021*I, -0.462262927873 - 0.251444224409*I, 0.585855615051,
 -0.293915958782 + 0.115371137717*I)], 1), (1.77621849241 +
 1.01489897202*I, [(0.340477754428 + 0.0450332871844*I, 0.598345310973,
 0.38050619325 - 0.218580892372*I, 0.562226753834 - 0.123968940799*I)], 1)]

 That will use LAPACK under the hood (via scipy).

 Medium answer: We will (very?!) soon have linear algebra over CC be very
 good, pending completion of ongoing work in wrapping ALGLIB in Sage.

 Long answer: Our generic algorithms are woefully inadequate for
 multiprecision linear algebra (we just do the textbook algorithms, which
 can have really bad roundoff error).  That is what CC employs.  In fact
 there is an error displayed to this effect the first time you try it:

 sage: n=matrix(CC,[[1,0,I,0],[1,1,0,I],[I,0,1,1],[0,I,0,2]])
 sage: n.eigenvectors_right()
 /Users/grout/sage/local/bin/sage-ipython:1: UserWarning: Using generic
 algorithm for an inexact ring, which may result in garbage from
 numerical precision issues.
    #!/usr/bin/env python
 /Users/grout/sage/local/bin/sage-ipython:1: UserWarning: Using generic
 algorithm for an inexact ring, which will probably give incorrect
 results due to numerical precision issues.
    #!/usr/bin/env python
 [(1.77621849241320 + 1.01489897201814*I, [

 ], 1), (1.77621849241320 - 1.01489897201814*I, [

 ], 1), (0.723781507586799 + 1.07181709265703*I, [

 ], 1), (0.723781507586799 - 1.07181709265703*I, [

 ], 1)]

 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] image of a complex function

2010-03-02 Thread davidp
For a class I am teaching, I would like to display an image in the
plane---say a png-file--- and show how it is transformed under a
complex function f: C -- C.  What is the best way to do this?

Thanks,
Dave

-- 
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] sage -t problems with semicolons and line breaks

2009-06-08 Thread davidp

On the file test.py, consisting of


EXAMPLES::

sage: gcd(4,6);
sage: a = {1:'a',
   2:'b'}


running sage -t produces two error messages (see below).  Is it true
that sage -t does not recognize semicolons and does not parse line
breaks correctly?  (Cutting and pasting the code in the examples into
sage produces no errors.)

Thanks,
Dave





| Sage Version 4.0.alpha0, Release Date: 2009-05-15

sage -t  test.py
**
File /home/davidp/math/sandpile/sage/sage-sandpile1.4/test.py, line
4:
sage: gcd(4,6);
Expected nothing
Got:
2
**
File /home/davidp/math/sandpile/sage/sage-sandpile1.4/test.py, line
5:
e: a = {1:'a',
Exception raised:
Traceback (most recent call last):
  File /home/davidp/download/sage-devel/local/bin/ncadoctest.py,
line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
  File /home/davidp/download/sage-devel/local/bin/
sagedoctest.py, line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example,
filename, compileflags)
  File /home/davidp/download/sage-devel/local/bin/ncadoctest.py,
line 1172, in run_one_example
compileflags, 1) in test.globs
  File doctest __main__.example_0[3], line 1
 a = {Integer(1):'a',###line 5:
e: a = {1:'a',

^
 SyntaxError: unexpected EOF while parsing
**
1 items had failures:
   2 of   4 in __main__.example_0
***Test Failed*** 2 failures.

--~--~-~--~~~---~--~~
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: problem running sage -t

2009-06-04 Thread davidp

Same problem:

sage -t  sandpile.py
Traceback (most recent call last):
  File ./sandpile.py, line 18, in module
from sandpile import *
  File /home/davidp/math/sandpile/sage/sage-sandpile1.4/sandpile.py,
line 167, in module
class Sandpile(DiGraph):
NameError: name 'DiGraph' is not defined

 [1.4 s]
exit code: 1024

--
The following tests failed:


sage -t  sandpile.py
Total time for all tests: 1.4 seconds


On Jun 4, 2:46 pm, Marshall Hampton hampto...@gmail.com wrote:
 What happens if you rename it sandpile.py?  I'm not sure that will
 help but there are some funny differences between running .py
 and .sage files.

 -Marshall

 On Jun 2, 8:35 pm, davidp dav...@reed.edu wrote:

  I would like to run the doctests in my file, sandpile.sage, but get
  the following error message:

  ++===
  xyzzy sage -t sandpile.sage
  sage -t  sandpile.sage
  /usr/local/sage-devel/local/bin/sage-preparse: File file_name is
  missing
  Traceback (most recent call last):
    File ./sandpile.py, line 18, in module
      from sandpile import *
    File /home/davidp/math/sandpile/sage/sage-sandpile1.4/sandpile.py,
  line 167, in module
      class Sandpile(DiGraph):
  NameError: name 'DiGraph' is not defined

           [1.6 s]
  exit code: 1024

  --
  The following tests failed:

          sage -t  sandpile.sage
  Total time for all tests: 1.6 seconds
  ++

  I tried adding

      from sage.graphs.graph import DiGraph

  to the file but got the same error message.

  Any suggestions?

  Thanks,
  Dave
--~--~-~--~~~---~--~~
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: fast slicing of matrix

2009-06-03 Thread davidp

Success!

sage: G = graphs.GridGraph([100,100])
sage: L = G.laplacian_matrix()
sage: L
1 x 1 sparse matrix over Integer Ring
sage: sage: time M = L[1:]
CPU times: user 21.98 s, sys: 0.01 s, total: 21.99 s
Wall time: 22.93 s
sage: sage: time N = L._delete_row_(0)
CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
Wall time: 0.01 s
sage: sage: timeit('N = L._delete_row_(0)')
25 loops, best of 3: 10.9 ms per loop

I am travelling for the next several days but will follow up on this
soon.

Thanks a lot!


On Jun 2, 10:12 pm, William Stein wst...@gmail.com wrote:
 On Tue, Jun 2, 2009 at 10:10 PM, davidp dav...@reed.edu wrote:

  I might be going down the wrong path, but is seems like I would want
  to add a

          copy_mpz_vector_init

  function to  vector_integer_sparse_c.pxi that would make a copy of an
  mpz_vector.  Is that overkill?

 That sounds like a good idea to me.

 William





  My first idea was to use add_mpz_vector_init(sum, v, w, mul), which
  sets sum equal to v + mul*w, but let mul = 0.  However
  add_mpz_vector_init returns the zero vector when mul = 0 !

  Dave

  On Jun 2, 9:06 pm, William Stein wst...@gmail.com wrote:
  On Tue, Jun 2, 2009 at 8:45 PM, davidp dav...@reed.edu wrote:

   I can't figure out how to create a new sparse matrix (see below).

   Sorry,
   Dave

  You can make a new matrix with the analogous parent but a different
  shape using the new_matrix method.

  sage: a = random_matrix(ZZ,3,4,sparse=True)
  sage: a.new_matrix(2,4)
  [0 0 0 0]
  [0 0 0 0]

  In your cython code you would write something like

  cdef Matrix_integer_sparse M = a.new_matrix(2,4)

  William

   M = Matrix_integer_sparse.__new__(Matrix_integer_sparse,
   sage.matrix.matrix_space.MatrixSpace(ZZ, self._nrows-1, self._ncols,
   sparse=True), None, None, None)

   ---
   ...
      def _delete_row_(self, Py_ssize_t row_number):
          cdef Py_ssize_t i
          cdef mpz_vector* self_row, *M_row
          cdef Matrix_integer_sparse M

          M = Matrix_integer_sparse.__new__(Matrix_integer_sparse,
   sage.matrix.matrix_space.MatrixSpace(ZZ, self._nrows-1, self._ncols,
   sparse=True), None, None, None)

   ^
   

   /usr/local/sage-devel/devel/sage-devel/sage/matrix/
   matrix_integer_sparse.pyx:221:101: Compiler crash in
   AnalyseExpressionsTransform

   ModuleNode.body = StatListNode(matrix_integer_sparse.pyx:23:0)
   StatListNode.stats[13] = StatListNode(matrix_integer_sparse.pyx:43:5)
   StatListNode.stats[0] = CClassDefNode(matrix_integer_sparse.pyx:43:5,
      as_name = u'Matrix_integer_sparse',
      base_class_module = u'matrix_sparse',
      base_class_name = u'Matrix_sparse',
      class_name = u'Matrix_integer_sparse',
      module_name = '',
      visibility = 'private')
   CClassDefNode.body = StatListNode(matrix_integer_sparse.pyx:55:4)
   StatListNode.stats[9] = DefNode(matrix_integer_sparse.pyx:216:4,
      name = u'_delete_row_',
      num_required_args = 2,
      reqd_kw_flags_cname = '0')
   File 'Nodes.py', line 360, in analyse_expressions: StatListNode
   (matrix_integer_sparse.pyx:217:8)
   File 'Nodes.py', line 2835, in analyse_expressions:
   SingleAssignmentNode(matrix_integer_sparse.pyx:221:41)
   File 'Nodes.py', line 2928, in analyse_types: SingleAssignmentNode
   (matrix_integer_sparse.pyx:221:41)
   File 'ExprNodes.py', line 2281, in analyse_types: SimpleCallNode
   (matrix_integer_sparse.pyx:221:41)
   File 'ExprNodes.py', line 3105, in analyse_types: TupleNode
   (matrix_integer_sparse.pyx:221:41,
      is_sequence_constructor = 1)
   File 'ExprNodes.py', line 2972, in analyse_types: TupleNode
   (matrix_integer_sparse.pyx:221:41,
      is_sequence_constructor = 1)
   File 'ExprNodes.py', line 2522, in analyse_types: GeneralCallNode
   (matrix_integer_sparse.pyx:221:101)

   Compiler crash traceback from this point on:
    File /usr/local/sage-devel/local/lib/python2.5/site-packages/Cython/
   Compiler/ExprNodes.py, line 2532, in analyse_types
      if hasattr(self.function, 'entry') and not
   self.function.entry.as_variable:
   AttributeError: 'NoneType' object has no attribute 'as_variable'
   Error running command, failed with status 256.
   sage: There was an error installing modified sage library code.

   On Jun 2, 7:28 pm, William Stein wst...@gmail.com wrote:
   On Tue, Jun 2, 2009 at 7:22 PM, davidp dav...@reed.edu wrote:

I tried adding a delete_row method to matrix_integer_sparse.pyx but
stopped after getting the error message:

   Just def your method -- do not cpdef it.  You can still use Cython
   code in a cpdef's method and it will be just as fast.

   Make sure that your delete row method returns a *new* matrix by the 
   way...

   William

+
Error converting Pyrex file to C

[sage-support] Re: fast slicing of matrix

2009-06-02 Thread davidp

I tried adding a delete_row method to matrix_integer_sparse.pyx but
stopped after getting the error message:

+
Error converting Pyrex file to C:

...
add_mpz_vector_init(M._matrix[i], self._matrix[i], 
(Matrix_integer_sparseright)._matrix[i], mul)
mpz_clear(mul)
return M

# added by David Perkinson
cpdef ModuleElement _delete_row_(self, Py_ssize_t row_number):
 ^


/usr/local/sage-devel/devel/sage-devel/sage/matrix/
matrix_integer_sparse.pyx:216:10: C method '_delete_row_' not
previously declared in definition part of extension type
Error running command, failed with status 256.
sage: There was an error installing modified sage library code.

++

I might have to actually read the Cython documentation!

Dave



On Jun 2, 5:43 pm, Jason Grout jason-s...@creativetrax.com wrote:
 William Stein wrote:
  On Mon, Jun 1, 2009 at 5:16 PM, davidp dav...@reed.edu wrote:
  Is there a fast way to create a submatrix?

  -

  sage: version()
  'Sage Version 4.0.alpha0, Release Date: 2009-05-15'
  sage: G = graphs.GridGraph([100,100])
  sage: L = G.laplacian_matrix()
  sage: L
  1 x 1 sparse matrix over Integer Ring
  sage: time M = L[1:,1:]
  CPU times: user 24.93 s, sys: 0.04 s, total: 24.97 s
  Wall time: 25.27 s

  

  I am just interested in deleting a single row and column of the matrix
  (not necessarily the first).

  Thanks,

  There is no fast way to do that right now.  One could easily add code
  to SAGE_ROOT/devel/sage/sage/matrix/matrix_integer_sparse.pyx that
  would provide blazingly fast deletion of a row, and reasonably fast
  deletion of a column.   Of course it would be better to implement
  arbitrary slicing in some optimized way in matrix_integer_sparse.pyx.
  I hope somebody does so.

 Just looking at the generic code, it seems that it goes through each and
 every index position in the slice, setting the new matrix entry to the
 old one.  This is obviously the wrong thing to do for sparse matrices,
 and can likely trivially be made faster.  I think all you may have to do
 is override the matrix_from_rows_and_columns for sparse matrices.

 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] problem running sage -t

2009-06-02 Thread davidp

I would like to run the doctests in my file, sandpile.sage, but get
the following error message:

++===
xyzzy sage -t sandpile.sage
sage -t  sandpile.sage
/usr/local/sage-devel/local/bin/sage-preparse: File file_name is
missing
Traceback (most recent call last):
  File ./sandpile.py, line 18, in module
from sandpile import *
  File /home/davidp/math/sandpile/sage/sage-sandpile1.4/sandpile.py,
line 167, in module
class Sandpile(DiGraph):
NameError: name 'DiGraph' is not defined

 [1.6 s]
exit code: 1024

--
The following tests failed:


sage -t  sandpile.sage
Total time for all tests: 1.6 seconds
++

I tried adding

from sage.graphs.graph import DiGraph

to the file but got the same error message.

Any suggestions?

Thanks,
Dave
--~--~-~--~~~---~--~~
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: fast slicing of matrix

2009-06-02 Thread davidp

I can't figure out how to create a new sparse matrix (see below).

Sorry,
Dave

M = Matrix_integer_sparse.__new__(Matrix_integer_sparse,
sage.matrix.matrix_space.MatrixSpace(ZZ, self._nrows-1, self._ncols,
sparse=True), None, None, None)


---
...
def _delete_row_(self, Py_ssize_t row_number):
cdef Py_ssize_t i
cdef mpz_vector* self_row, *M_row
cdef Matrix_integer_sparse M

M = Matrix_integer_sparse.__new__(Matrix_integer_sparse,
sage.matrix.matrix_space.MatrixSpace(ZZ, self._nrows-1, self._ncols,
sparse=True), None, None, None)
 
^


/usr/local/sage-devel/devel/sage-devel/sage/matrix/
matrix_integer_sparse.pyx:221:101: Compiler crash in
AnalyseExpressionsTransform

ModuleNode.body = StatListNode(matrix_integer_sparse.pyx:23:0)
StatListNode.stats[13] = StatListNode(matrix_integer_sparse.pyx:43:5)
StatListNode.stats[0] = CClassDefNode(matrix_integer_sparse.pyx:43:5,
as_name = u'Matrix_integer_sparse',
base_class_module = u'matrix_sparse',
base_class_name = u'Matrix_sparse',
class_name = u'Matrix_integer_sparse',
module_name = '',
visibility = 'private')
CClassDefNode.body = StatListNode(matrix_integer_sparse.pyx:55:4)
StatListNode.stats[9] = DefNode(matrix_integer_sparse.pyx:216:4,
name = u'_delete_row_',
num_required_args = 2,
reqd_kw_flags_cname = '0')
File 'Nodes.py', line 360, in analyse_expressions: StatListNode
(matrix_integer_sparse.pyx:217:8)
File 'Nodes.py', line 2835, in analyse_expressions:
SingleAssignmentNode(matrix_integer_sparse.pyx:221:41)
File 'Nodes.py', line 2928, in analyse_types: SingleAssignmentNode
(matrix_integer_sparse.pyx:221:41)
File 'ExprNodes.py', line 2281, in analyse_types: SimpleCallNode
(matrix_integer_sparse.pyx:221:41)
File 'ExprNodes.py', line 3105, in analyse_types: TupleNode
(matrix_integer_sparse.pyx:221:41,
is_sequence_constructor = 1)
File 'ExprNodes.py', line 2972, in analyse_types: TupleNode
(matrix_integer_sparse.pyx:221:41,
is_sequence_constructor = 1)
File 'ExprNodes.py', line 2522, in analyse_types: GeneralCallNode
(matrix_integer_sparse.pyx:221:101)

Compiler crash traceback from this point on:
  File /usr/local/sage-devel/local/lib/python2.5/site-packages/Cython/
Compiler/ExprNodes.py, line 2532, in analyse_types
if hasattr(self.function, 'entry') and not
self.function.entry.as_variable:
AttributeError: 'NoneType' object has no attribute 'as_variable'
Error running command, failed with status 256.
sage: There was an error installing modified sage library code.


On Jun 2, 7:28 pm, William Stein wst...@gmail.com wrote:
 On Tue, Jun 2, 2009 at 7:22 PM, davidp dav...@reed.edu wrote:

  I tried adding a delete_row method to matrix_integer_sparse.pyx but
  stopped after getting the error message:

 Just def your method -- do not cpdef it.  You can still use Cython
 code in a cpdef's method and it will be just as fast.

 Make sure that your delete row method returns a *new* matrix by the way...

 William





  +
  Error converting Pyrex file to C:
  
  ...
             add_mpz_vector_init(M._matrix[i], self._matrix[i], 
  (Matrix_integer_sparseright)._matrix[i], mul)
         mpz_clear(mul)
         return M

  # added by David Perkinson
     cpdef ModuleElement _delete_row_(self, Py_ssize_t row_number):
          ^
  

  /usr/local/sage-devel/devel/sage-devel/sage/matrix/
  matrix_integer_sparse.pyx:216:10: C method '_delete_row_' not
  previously declared in definition part of extension type
  Error running command, failed with status 256.
  sage: There was an error installing modified sage library code.

  ++

  I might have to actually read the Cython documentation!

  Dave

  On Jun 2, 5:43 pm, Jason Grout jason-s...@creativetrax.com wrote:
  William Stein wrote:
   On Mon, Jun 1, 2009 at 5:16 PM, davidp dav...@reed.edu wrote:
   Is there a fast way to create a submatrix?

   -

   sage: version()
   'Sage Version 4.0.alpha0, Release Date: 2009-05-15'
   sage: G = graphs.GridGraph([100,100])
   sage: L = G.laplacian_matrix()
   sage: L
   1 x 1 sparse matrix over Integer Ring
   sage: time M = L[1:,1:]
   CPU times: user 24.93 s, sys: 0.04 s, total: 24.97 s
   Wall time: 25.27 s

   

   I am just interested in deleting a single row and column of the matrix
   (not necessarily the first).

   Thanks,

   There is no fast way to do that right now.  One could easily add code
   to SAGE_ROOT/devel/sage/sage/matrix/matrix_integer_sparse.pyx that
   would provide blazingly fast deletion of a row, and reasonably fast
   deletion of a column.   Of course

[sage-support] Re: fast slicing of matrix

2009-06-02 Thread davidp

I might be going down the wrong path, but is seems like I would want
to add a

 copy_mpz_vector_init

function to  vector_integer_sparse_c.pxi that would make a copy of an
mpz_vector.  Is that overkill?

My first idea was to use add_mpz_vector_init(sum, v, w, mul), which
sets sum equal to v + mul*w, but let mul = 0.  However
add_mpz_vector_init returns the zero vector when mul = 0 !

Dave

On Jun 2, 9:06 pm, William Stein wst...@gmail.com wrote:
 On Tue, Jun 2, 2009 at 8:45 PM, davidp dav...@reed.edu wrote:

  I can't figure out how to create a new sparse matrix (see below).

  Sorry,
  Dave

 You can make a new matrix with the analogous parent but a different
 shape using the new_matrix method.

 sage: a = random_matrix(ZZ,3,4,sparse=True)
 sage: a.new_matrix(2,4)
 [0 0 0 0]
 [0 0 0 0]

 In your cython code you would write something like

 cdef Matrix_integer_sparse M = a.new_matrix(2,4)

 William





  M = Matrix_integer_sparse.__new__(Matrix_integer_sparse,
  sage.matrix.matrix_space.MatrixSpace(ZZ, self._nrows-1, self._ncols,
  sparse=True), None, None, None)

  ---
  ...
     def _delete_row_(self, Py_ssize_t row_number):
         cdef Py_ssize_t i
         cdef mpz_vector* self_row, *M_row
         cdef Matrix_integer_sparse M

         M = Matrix_integer_sparse.__new__(Matrix_integer_sparse,
  sage.matrix.matrix_space.MatrixSpace(ZZ, self._nrows-1, self._ncols,
  sparse=True), None, None, None)

  ^
  

  /usr/local/sage-devel/devel/sage-devel/sage/matrix/
  matrix_integer_sparse.pyx:221:101: Compiler crash in
  AnalyseExpressionsTransform

  ModuleNode.body = StatListNode(matrix_integer_sparse.pyx:23:0)
  StatListNode.stats[13] = StatListNode(matrix_integer_sparse.pyx:43:5)
  StatListNode.stats[0] = CClassDefNode(matrix_integer_sparse.pyx:43:5,
     as_name = u'Matrix_integer_sparse',
     base_class_module = u'matrix_sparse',
     base_class_name = u'Matrix_sparse',
     class_name = u'Matrix_integer_sparse',
     module_name = '',
     visibility = 'private')
  CClassDefNode.body = StatListNode(matrix_integer_sparse.pyx:55:4)
  StatListNode.stats[9] = DefNode(matrix_integer_sparse.pyx:216:4,
     name = u'_delete_row_',
     num_required_args = 2,
     reqd_kw_flags_cname = '0')
  File 'Nodes.py', line 360, in analyse_expressions: StatListNode
  (matrix_integer_sparse.pyx:217:8)
  File 'Nodes.py', line 2835, in analyse_expressions:
  SingleAssignmentNode(matrix_integer_sparse.pyx:221:41)
  File 'Nodes.py', line 2928, in analyse_types: SingleAssignmentNode
  (matrix_integer_sparse.pyx:221:41)
  File 'ExprNodes.py', line 2281, in analyse_types: SimpleCallNode
  (matrix_integer_sparse.pyx:221:41)
  File 'ExprNodes.py', line 3105, in analyse_types: TupleNode
  (matrix_integer_sparse.pyx:221:41,
     is_sequence_constructor = 1)
  File 'ExprNodes.py', line 2972, in analyse_types: TupleNode
  (matrix_integer_sparse.pyx:221:41,
     is_sequence_constructor = 1)
  File 'ExprNodes.py', line 2522, in analyse_types: GeneralCallNode
  (matrix_integer_sparse.pyx:221:101)

  Compiler crash traceback from this point on:
   File /usr/local/sage-devel/local/lib/python2.5/site-packages/Cython/
  Compiler/ExprNodes.py, line 2532, in analyse_types
     if hasattr(self.function, 'entry') and not
  self.function.entry.as_variable:
  AttributeError: 'NoneType' object has no attribute 'as_variable'
  Error running command, failed with status 256.
  sage: There was an error installing modified sage library code.

  On Jun 2, 7:28 pm, William Stein wst...@gmail.com wrote:
  On Tue, Jun 2, 2009 at 7:22 PM, davidp dav...@reed.edu wrote:

   I tried adding a delete_row method to matrix_integer_sparse.pyx but
   stopped after getting the error message:

  Just def your method -- do not cpdef it.  You can still use Cython
  code in a cpdef's method and it will be just as fast.

  Make sure that your delete row method returns a *new* matrix by the 
  way...

  William

   +
   Error converting Pyrex file to C:
   
   ...
              add_mpz_vector_init(M._matrix[i], self._matrix[i], 
   (Matrix_integer_sparseright)._matrix[i], mul)
          mpz_clear(mul)
          return M

   # added by David Perkinson
      cpdef ModuleElement _delete_row_(self, Py_ssize_t row_number):
           ^
   

   /usr/local/sage-devel/devel/sage-devel/sage/matrix/
   matrix_integer_sparse.pyx:216:10: C method '_delete_row_' not
   previously declared in definition part of extension type
   Error running command, failed with status 256.
   sage: There was an error installing modified sage library code.

   ++

   I might have to actually read the Cython documentation!

   Dave

   On Jun 2, 5:43 pm, Jason Grout jason-s

[sage-support] fast slicing of matrix

2009-06-01 Thread davidp

Is there a fast way to create a submatrix?

-


sage: version()
'Sage Version 4.0.alpha0, Release Date: 2009-05-15'
sage: G = graphs.GridGraph([100,100])
sage: L = G.laplacian_matrix()
sage: L
1 x 1 sparse matrix over Integer Ring
sage: time M = L[1:,1:]
CPU times: user 24.93 s, sys: 0.04 s, total: 24.97 s
Wall time: 25.27 s




I am just interested in deleting a single row and column of the matrix
(not necessarily the first).

Thanks,
Dave
--~--~-~--~~~---~--~~
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] using sphinx to create a manual

2009-05-30 Thread davidp

I am writing a manual for a Sage package I am developing.  It seems
natural to use Sphinx/reST.  I made an independent installation of
Sphinx and eventually realized that to typeset mathematics, I need to
write, for example, :math:`\Gamma` instead of Sage's cleaner version: `
\Gamma`.  The latter is obviously preferable (and $'s would be even
better, of course).

Any suggestions?

Thanks,
Dave
--~--~-~--~~~---~--~~
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: using sphinx to create a manual

2009-05-30 Thread davidp

I guess I figured it out.  In the conf.py file:

# The reST default role (used for this markup: `text`) to use for all
documents.
default_role = 'math'

--~--~-~--~~~---~--~~
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] odd behavior from integral

2009-04-10 Thread davidp

The following seems like odd behavior to me.

Dave

I. No problem:
sage: integral(log(x)/x^(1.002),x)
500*(-log(x)/x^(1/500) - 500/x^(1/500))
sage: s(10)-s(1)
500*(-log(10)/10^(1/500) - 500/10^(1/500)) + 25
sage: n(_)
2.64282437870861

II. Problem:
sage: integral(log(x)/x^(1.002),x,1,10)
---
TypeError Traceback (most recent call
last)

/home/davidp/ipython console in module()

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/misc/functional.pyc in integral(x, *args, **kwds)
435 
436 if hasattr(x, 'integral'):
-- 437 return x.integral(*args, **kwds)
438 else:
439 from sage.calculus.calculus import SR

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/calculus/calculus.pyc in integral(self, v, a, b)
   3068 else:
   3069 try:
- 3070 return self.parent()(self._maxima_().integrate
(v, a, b))
   3071 except TypeError, error:
   3072 s = str(error)

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/interfaces/maxima.pyc in integral(self, var, min,
max)
   1994 if max is None:
   1995 raise ValueError, neither or both of min/max
must be specified.
- 1996 return I(var, min, max)
   1997
   1998 integrate = integral

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/interfaces/expect.pyc in __call__(self, *args,
**kwds)
   1332
   1333 def __call__(self, *args, **kwds):
- 1334 return self._obj.parent().function_call(self._name,
[self._obj] + list(args), kwds)
   1335
   1336 def help(self):

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/interfaces/expect.pyc in function_call(self,
function, args, kwds)
   1252 self._check_valid_function_name(function)
   1253 return self.new(%s(%s)%(function, ,.join([s.name()
for s in args]+
- 1254  ['%s=%s'%
(key,value.name()) for key, value in kwds.items()])))
   1255
   1256 def call(self, function_name, *args, **kwds):

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/interfaces/expect.pyc in new(self, code)
   1065
   1066 def new(self, code):
- 1067 return self(code)
   1068
   1069
###

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/interfaces/expect.pyc in __call__(self, x, name)
   1000 return x
   1001 if isinstance(x, basestring):
- 1002 return cls(self, x, name=name)
   1003 try:
   1004 return self._coerce_from_special_method(x)

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/interfaces/expect.pyc in __init__(self, parent,
value, is_name, name)
   1375 except (TypeError, KeyboardInterrupt,
RuntimeError, ValueError), x:
   1376 self._session_number = -1
- 1377 raise TypeError, x
   1378 self._session_number = parent._session_number
   1379

TypeError: Computation failed since Maxima requested additional
constraints (try the command 'assume(0)' before integral or limit
evaluation, for example):
 an integer?

III.  Problem:
sage: numerical_integral(log(x)/x^(1.002),x,1,10)
---
TypeError Traceback (most recent call
last)

/home/davidp/ipython console in module()

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/gsl/integration.so in
sage.gsl.integration.numerical_integral (sage/gsl/integration.c:2008)
()

TypeError: invalid integration algorithm


Dave



--~--~-~--~~~---~--~~
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] opening a saved jmol file

2009-03-30 Thread davidp

In the sage notebook, how can I open (display) a file I saved in jmol
format?

Thanks,
Dave
--~--~-~--~~~---~--~~
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: new cell in worksheet

2009-03-30 Thread davidp

I am running Sage 3.4 under Fedora 10.  I am having trouble inserting
a cell (of any type) right before a text cell in a worksheet.

I have tried the following:

1. Hovering the mouse just above the text cell.
2. Going to a calculation cell just above the text cell and trying
shift-click, alt-click, control-click.

My solution has been to leave an empty calculation cell between the
text cell and the cells preceding the text cell.

Thanks for any suggestions.

Dave

On Mar 24, 2:41 am, Stan Schymanski schym...@gmail.com wrote:
 Hi Jason,

 Thanks a lot for that! Your proposal sounds good. Pity it hasn't been
 implemented yet, but perhaps the tickets you submitted will help. I'll
 contribute my thoughts when I have an account.

 Stan

 On Mar 23, 4:01 pm, Jason Grout jason-s...@creativetrax.com wrote:

  Stan Schymanski wrote:
   Thanks for your feedback, Jason! Could you submit a ticket for this to
   be fixed/enhanced? Unfortunately, I can't do it myself.

  We should get you a trac account, then.  You can follow the instructions
  onhttp://trac.sagemath.org/sage_trac/

  The bugs are nowhttp://trac.sagemath.org/sage_trac/ticket/5591

  and

  The bug is nowhttp://trac.sagemath.org/sage_trac/ticket/5592

  As for the alt-enter and ctrl-enter thing, can you look at my proposal
  in the last few messages in this 
  thread:http://groups.google.com/group/sage-devel/browse_thread/thread/5892dd...

  (specifically,http://groups.google.com/group/sage-devel/msg/e351edd7b62437b9)

  That proposal deals with splitting cells.

  Note that two adjacent text cells are merged whenever the sheet is saved
  and reopened.  I don't know that alt-enter and ctrl-enter makes sense
  right now (however, maybe the text cells shouldn't be merged, and maybe
  alt-enter and ctrl-enter should make sense...)

  Jasno

   Cheers,
   Stan

   Jason Grout wrote:
   Stan Schymanski wrote:

   In this context, I'm having trouble inserting a calculationcellbefore
   a htmlcellor between two html cells in Sage 3.4. The Alt-Enter or
   Ctrl-Enter methods don't not work in html cells.

   Both of these are because they have not been implemented.  Contributions
   are definitely welcome!

   If I want toinserta
   calculationcellbefore an htmlcell, I can't just press Alt-Enter in
   the foregoing calculationcell, because this creates anewcalculation
  cellAFTER the htmlcell. Is there another way?

   Hmmm...I'd consider this a bug.  The Alt-enter should make anew
   calculationcellright after the old calculationcell(before the
   following htmlcell).

   Jason

   Cheers,
   Stan

   kcrisman wrote:

   Dear Kwankyu,

   If I write and evaluate in acellin aworksheetand if there are
   already cells below the one which I am evaluating, then the cursor
   moves into thecelljust below instead of creating anewcellfor next
   input. Is this behavior preferable? This is annoying at least to me.

   One of the designers can answer for the technical reasons for this
   design decision, but let me tell you it is very useful when you are
   running through aworksheetyou have already created, but changing a
   few things (e.g. some initial constant defined at the top)!

   But actually, if you click on Help you will see that Alt-Enter
   actually does what you require, while Ctrl-Enter splits thecelland
   evaluates both things.  I didn't know either of these until I looked
   just now, and will definitely use them now too.

   Enjoy!

   - kcrisman
--~--~-~--~~~---~--~~
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] resetting vertex labels

2009-03-19 Thread davidp

Suppose G is a DiGraph.  Is there a way to change the vertex labels of
G so that they are shown when G.show() is called?  The method,
G.set_vertex() does not seem to do that.

Sample code

sage: G = DiGraph({1:{2: 2}, 2:{1:1}})
sage: G.show()
sage: G.set_vertex(1,4)
sage: G.show() # -- there is no change

What I am really after is this: I have a collection of integers, one
for each vertex.  Over time the integers change.  I would like to show
the graph with vertices labeled by these integers.  Best of all would
be to do this via @interact.

Thanks,
Dave
--~--~-~--~~~---~--~~
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] showing graphs with multiple edges

2009-03-19 Thread davidp

Hi,

I was a bit surprised by the difference exhibited below:

sage: G = DiGraph({1:{2: 2}, 2:{1:1}})
sage: G.show()
sage: DiGraph(G.laplacian_matrix()).show()

The latter draws multiple edges.

Dave
--~--~-~--~~~---~--~~
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: showing graphs with multiple edges

2009-03-19 Thread davidp

Sorry.  I was not being clear.  I was surprised by the fact that
*only* the latter shows multiple edges.

I am also surprised that arrowheads don't appear with multiple edges.
This is especially a problem with weighted digraphs.

(By the way, it probably would have been better for me to have written

sage: G = DiGraph({1:{2: 2}, 2:{1:1}}, weighted=True)

so that the Laplacian comes out correctly.  However, this doesn't help
with my problem.)

Dave

On Mar 19, 6:01 pm, Jason Grout jason-s...@creativetrax.com wrote:
 davidp wrote:
  Hi,

  I was a bit surprised by the difference exhibited below:

  sage: G = DiGraph({1:{2: 2}, 2:{1:1}})
  sage: G.show()

 I'm surprised by the output of this.  There are clearly two edges in the
 graph: 1-2 and 2-1, but only one edge is shown.

  sage: DiGraph(G.laplacian_matrix()).show()

 The Laplacian matrix has nonzero entries indicating edges from each
 vertex to each other vertex, so why do you find it surprising that there
 are two edges?

 sage: H=DiGraph(G.laplacian_matrix())
 sage: H.edges()
 [(0, 0, 1), (0, 1, -1), (1, 0, -1), (1, 1, 1)]

 I find it surprising that arrowheads don't appear in the following, though:

 sage: DiGraph(G.laplacian_matrix()).show()

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



[sage-support] Re: Small groups library is missing

2009-03-16 Thread davidp

I have just installed Sage 3.4, database_gap-4.4.10, and
gap_packages-4.4.10_6.  It seems that I can't access 'SmallGroups':

sage: gap.eval('SmallGroups(8,1)')
---
RuntimeError  Traceback (most recent call
last)

/home/davidp/download/ipython console in module()

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/interfaces/gap.pyc in eval(self, x, newlines,
strip, **kwds)
477 input_line += ';'
478
-- 479 result = Expect.eval(self, input_line, **kwds)
480
481 if not newlines:

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/interfaces/expect.pyc in eval(self, code, strip,
synchronize, locals, **kwds)
972 try:
973 with gc_disabled():
-- 974 return '\n'.join([self._eval_line(L, **kwds)
for L in code.split('\n') if L != ''])
975 except KeyboardInterrupt:
976 # DO NOT CATCH KeyboardInterrupt, as it is being
caught

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/interfaces/gap.pyc in _eval_line(self, line,
allow_use_file, wait_for_prompt)
721 return ''
722 else:
-- 723 raise RuntimeError, message
724
725 except KeyboardInterrupt:

RuntimeError: Gap produced error output
Variable: 'SmallGroups' must have a value


   executing SmallGroups(8,1);
sage: gap('SmallGroup(8,1)')
---
TypeError Traceback (most recent call
last)

/home/davidp/download/ipython console in module()

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/interfaces/expect.pyc in __call__(self, x, name)
   1000 return x
   1001 if isinstance(x, basestring):
- 1002 return cls(self, x, name=name)
   1003 try:
   1004 return self._coerce_from_special_method(x)

/usr/local/sage-3.4-Fedora_release_9-i686-Linux/local/lib/python2.5/
site-packages/sage/interfaces/expect.pyc in __init__(self, parent,
value, is_name, name)
   1375 except (TypeError, KeyboardInterrupt,
RuntimeError, ValueError), x:
   1376 self._session_number = -1
- 1377 raise TypeError, x
   1378 self._session_number = parent._session_number
   1379

TypeError: Gap produced error output
Error, the Small Groups library is required but not installed

   executing $sage1:=SmallGroup(8,1);;


I am running Sage under Fedora 10, 32bit.  The command sage -i
seemed to install the two packages without complaint.

So is this still a known problem?

Thanks,
Dave

On Mar 2, 6:33 pm, David Joyner wdjoy...@gmail.com wrote:
 On Mon, Mar 2, 2009 at 3:51 PM, David Joyner wdjoy...@gmail.com wrote:
  I am trying and failing to get the sage-install script to work.

 ...



  
  /bin/ls: cannot access gap-*.spkg: No such file or directory

  /bin/ls: cannot access gap-*.spkg: No such file or directory
  ./spkg-install: line 13: patches: command not found

  ./spkg-install: line 14: Installing: command not found

  ./spkg-install: line 15: Installing: command not found

  ./spkg-install: line 16: patches: command not found

  snip
  

  Does anyone have an idea what the problem could be?

 I finally figured out that (a) I was in the wrong directory
 and (b) spaces matter for shell scripts. It now works in Linux.
 I'm going to test in on a mac OS 10.4 and then post a link to the trac ticket
 if that works.
--~--~-~--~~~---~--~~
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 3.4 on Fedora: cannot execute binary file

2009-03-14 Thread davidp

Is it strange, then, to list this binary under 32bit:

http://sagemath.org/bin/linux/32bit/index.html

Also, I don't see a release for i686.  Perhaps that will come later.

Thanks,
Dave

On Mar 14, 8:37 am, Jaap Spies j.sp...@hccnet.nl wrote:
 davidp wrote:
  I am having trouble starting Sage 3.4 on two machines running Fedora:

  1.
  poly cd sage-3.4-Fedora_release_9-x86_64-Linux/
  poly ./sage
  --
  | Sage Version 3.4, Release Date: 2009-03-11                         |
  | Type notebook() for the GUI, and license() for information.        |
  --
  /home/davidp/download/sage-3.4-Fedora_release_9-x86_64-Linux/local/bin/
  sage.bin: /home/davidp/download/sage-3.4-Fedora_release_9-x86_64-Linux/
  local/bin/sage.bin: cannot execute binary file
  poly uname -a
  Linux poly 2.6.27.19-78.2.30.fc9.i686 #1 SMP Tue Feb 24 20:09:23 EST
  2009 i686 i686 i386 GNU/Linux

  2.
  xyzzy cd sage-3.4-Fedora_release_9-x86_64-Linux/
  xyzzy ./sage
  --
  | Sage Version 3.4, Release Date: 2009-03-11                         |
  | Type notebook() for the GUI, and license() for information.        |
  --
  /usr/local/sage-3.4-Fedora_release_9-x86_64-Linux/local/bin/sage.bin: /
  usr/local/sage-3.4-Fedora_release_9-x86_64-Linux/local/bin/sage.bin:
  cannot execute binary file
  xyzzy uname -a
  Linux xyzzy 2.6.27.19-170.2.35.fc10.i686.PAE #1 SMP Mon Feb 23
  13:09:26 EST 2009 i686 i686 i386 GNU/Linux

  Thanks for any help,

 Seems you downloaded the 64 bit version and try to run it on 33 bit.

 Jaap
--~--~-~--~~~---~--~~
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 3.4 on Fedora: cannot execute binary file

2009-03-14 Thread davidp

Thanks!

On Mar 14, 11:19 am, mabshoff michael.absh...@mathematik.uni-
dortmund.de wrote:
 Ok, there is now a 32 bit FC9 binary - I had it on sage.math all along
 and it did get lost in the shuffle when putting things in the various
 directories.

 Cheers,

 Michael
--~--~-~--~~~---~--~~
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: ideals of points

2009-02-28 Thread davidp

That works.

Thanks!

Dave

On Feb 26, 5:31 pm, Alex Raichev tortoise.s...@gmail.com wrote:
 Hi Dave:

 I'm also just learning the basics of interacting with Singular through
 Sage.  So probably someone else on the list can answer your question
 better than me.  Still, i'll take a stab at it.

 Carrying on with your/Singular's notation, try

 sage: singular.setring(AC)
 sage: sol= singular('SOL').sage_structured_str_list()

 to save the output of SOL as a structured list of Sage strings.  (I
 found this command by typing help(sage.interfaces.singular) and
 browsing the documentation page that popped up.)  Now all you have to
 do is convert those Sage strings to Sage numbers with the eval()
 command.  For instance,

 sage: a= eval(sol[1][1][1][1])

 Does that work?

 Alex

 P.S. I'll be jumping for joy if/when the Singular people fix the bug
 that's breaking the potentially super-useful variety() command.

 On Feb 27, 5:54 am,davidpdav...@reed.edu wrote:

  Thanks for your response.  I tried what you suggested and got the
  error you anticipated.  So it looks like I need to work within
  Singular.  The relevant page at the Singular site:

 http://www.singular.uni-kl.de/Manual/latest/sing_1168.htm#SEC1227

  Using the notation from the site just referenced, I end up with a
  ring, AC, in which the solutions are supposed to be stored in 'SOL'.
  I can execute singular.setring(AC), but cannot subsequently access the
  solutions.

  Thanks,
  Dave

  On Feb 25, 1:49 pm, Alex Raichev tortoise.s...@gmail.com wrote:

   Hi Dave:

   Once you have your zero-dimensional ideal K within a Sage ring, you
   could try the variety() command

   K.variety(ring=QQbar) or
   K.variety(ring=CC)

   to get its solutions as algebraic numbers or complex floating point
   numbers, respectively.  See 'variety()' under

  http://www.sagemath.org/doc/ref/module-sage.rings.polynomial.multi-po...

   for more details. Problem is, variety() sometimes 
   fails:http://sagetrac.org/sage_trac/ticket/4622.

   Alex

   On Feb 25, 7:27 am,davidpdav...@reed.edu wrote:

Hi,

I have the following homogeneous Singular ideal defining a finite set
of points in projective space.  I would like to get numerical
approximations for these points.

sage: S.ring()

//   characteristic : 0
//   number of vars : 4
//        block   1 : ordering dp
//                  : names    x_3 x_2 x_1 x_0
//        block   2 : ordering C
sage: S.ideal()

x_1^3-x_3*x_2*x_0,
x_3*x_2*x_1-x_0^3,
x_2^3-x_3*x_1*x_0,
x_3^3-x_2*x_1*x_0,
x_2^2*x_1^2-x_3^2*x_0^2,
x_3^2*x_1^2-x_2^2*x_0^2,
x_3^2*x_2^2-x_1^2*x_0^2
sage: type(S.ideal())
class 'sage.interfaces.singular.SingularElement'

One way to go might be to map to a new ring, setting x_0 = 1, then use
the nice Singular algorithm for finding the solutions:

   http://www.singular.uni-kl.de/Manual/3-0-4/sing_582.htm

I couldn't figure out how to get the Singular map function to work
with Sage, so I just converted equations using string commands (saved
in y in the following code) then tried:

sage: R = singular.ring(0,'(x_3,x_2,x_1)','lp')
sage: J = singular.ideal(y)
sage: J

-x_3*x_2+x_1^3,
x_3*x_2*x_1-1,
-x_3*x_1+x_2^3,
x_3^3-x_2*x_1,
-x_3^2+x_2^2*x_1^2,
x_3^2*x_1^2-x_2^2,
x_3^2*x_2^2-x_1^2
sage: K = J.groebner()
sage: M = K.solve(10,1)

I'm not sure where to go from there.  Of course, I might be taking the
wrong approach altogether.

Any advice would be appreciated.

Thanks,
Dave
--~--~-~--~~~---~--~~
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: ideals of points

2009-02-26 Thread davidp

Thanks for your response.  I tried what you suggested and got the
error you anticipated.  So it looks like I need to work within
Singular.  The relevant page at the Singular site:

http://www.singular.uni-kl.de/Manual/latest/sing_1168.htm#SEC1227

Using the notation from the site just referenced, I end up with a
ring, AC, in which the solutions are supposed to be stored in 'SOL'.
I can execute singular.setring(AC), but cannot subsequently access the
solutions.

Thanks,
Dave

On Feb 25, 1:49 pm, Alex Raichev tortoise.s...@gmail.com wrote:
 Hi Dave:

 Once you have your zero-dimensional ideal K within a Sage ring, you
 could try the variety() command

 K.variety(ring=QQbar) or
 K.variety(ring=CC)

 to get its solutions as algebraic numbers or complex floating point
 numbers, respectively.  See 'variety()' under

 http://www.sagemath.org/doc/ref/module-sage.rings.polynomial.multi-po...

 for more details. Problem is, variety() sometimes 
 fails:http://sagetrac.org/sage_trac/ticket/4622.

 Alex

 On Feb 25, 7:27 am,davidpdav...@reed.edu wrote:

  Hi,

  I have the following homogeneous Singular ideal defining a finite set
  of points in projective space.  I would like to get numerical
  approximations for these points.

  sage: S.ring()

  //   characteristic : 0
  //   number of vars : 4
  //        block   1 : ordering dp
  //                  : names    x_3 x_2 x_1 x_0
  //        block   2 : ordering C
  sage: S.ideal()

  x_1^3-x_3*x_2*x_0,
  x_3*x_2*x_1-x_0^3,
  x_2^3-x_3*x_1*x_0,
  x_3^3-x_2*x_1*x_0,
  x_2^2*x_1^2-x_3^2*x_0^2,
  x_3^2*x_1^2-x_2^2*x_0^2,
  x_3^2*x_2^2-x_1^2*x_0^2
  sage: type(S.ideal())
  class 'sage.interfaces.singular.SingularElement'

  One way to go might be to map to a new ring, setting x_0 = 1, then use
  the nice Singular algorithm for finding the solutions:

 http://www.singular.uni-kl.de/Manual/3-0-4/sing_582.htm

  I couldn't figure out how to get the Singular map function to work
  with Sage, so I just converted equations using string commands (saved
  in y in the following code) then tried:

  sage: R = singular.ring(0,'(x_3,x_2,x_1)','lp')
  sage: J = singular.ideal(y)
  sage: J

  -x_3*x_2+x_1^3,
  x_3*x_2*x_1-1,
  -x_3*x_1+x_2^3,
  x_3^3-x_2*x_1,
  -x_3^2+x_2^2*x_1^2,
  x_3^2*x_1^2-x_2^2,
  x_3^2*x_2^2-x_1^2
  sage: K = J.groebner()
  sage: M = K.solve(10,1)

  I'm not sure where to go from there.  Of course, I might be taking the
  wrong approach altogether.

  Any advice would be appreciated.

  Thanks,
  Dave
--~--~-~--~~~---~--~~
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] ideals of points

2009-02-24 Thread davidp

Hi,

I have the following homogeneous Singular ideal defining a finite set
of points in projective space.  I would like to get numerical
approximations for these points.

sage: S.ring()

//   characteristic : 0
//   number of vars : 4
//block   1 : ordering dp
//  : namesx_3 x_2 x_1 x_0
//block   2 : ordering C
sage: S.ideal()

x_1^3-x_3*x_2*x_0,
x_3*x_2*x_1-x_0^3,
x_2^3-x_3*x_1*x_0,
x_3^3-x_2*x_1*x_0,
x_2^2*x_1^2-x_3^2*x_0^2,
x_3^2*x_1^2-x_2^2*x_0^2,
x_3^2*x_2^2-x_1^2*x_0^2
sage: type(S.ideal())
class 'sage.interfaces.singular.SingularElement'

One way to go might be to map to a new ring, setting x_0 = 1, then use
the nice Singular algorithm for finding the solutions:

http://www.singular.uni-kl.de/Manual/3-0-4/sing_582.htm

I couldn't figure out how to get the Singular map function to work
with Sage, so I just converted equations using string commands (saved
in y in the following code) then tried:

sage: R = singular.ring(0,'(x_3,x_2,x_1)','lp')
sage: J = singular.ideal(y)
sage: J

-x_3*x_2+x_1^3,
x_3*x_2*x_1-1,
-x_3*x_1+x_2^3,
x_3^3-x_2*x_1,
-x_3^2+x_2^2*x_1^2,
x_3^2*x_1^2-x_2^2,
x_3^2*x_2^2-x_1^2
sage: K = J.groebner()
sage: M = K.solve(10,1)

I'm not sure where to go from there.  Of course, I might be taking the
wrong approach altogether.

Any advice would be appreciated.

Thanks,
Dave

--~--~-~--~~~---~--~~
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] Singular Hilbert series

2009-02-21 Thread davidp

Hi,

Singular's hilb command does not work as expected:

sage: R = singular.ring(0,'(x,y,z)','dp')
sage: I = singular.ideal(['x^3-y^2*z','z^2-x*y'])
sage: I.hilb()
`sage90`

Could someone please explain this?

Thanks,
Dave
--~--~-~--~~~---~--~~
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] problem with GraphDatabase

2009-01-30 Thread davidp

Hi,

Cutting and pasting commands from the Reference:

http://sagemath.org/doc/ref/node47.html

gives me:

===
 sage
--
| Sage Version 3.2.2, Release Date: 2008-12-18   |
| Type notebook() for the GUI, and license() for information.|
--
sage: graphs_query = GraphDatabase()
sage: L = graphs_query.get_list(num_vertices=7, diameter=5)
---
AttributeErrorTraceback (most recent call
last)

/home/davidp/math/sandpile/sage/sage-sandpile1.2/ipython console in
module()

AttributeError: 'GraphDatabase' object has no attribute 'get_list'
sage:
===
I have also tried cutting and pasting code from the online
documentation for GenericGraphQuery and similar functions, also
getting errors.

I am running sage under Fedora.

Any suggestions would be much appreciated.  (I have a thesis student
who would like to use these functions.)

Thanks,
Dave

--~--~-~--~~~---~--~~
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] gap documentation

2009-01-20 Thread davidp

I will be teaching abstract algebra this semester and want to
introduce my students to Sage and GAP.  I have installed
gap_packages-4.4.10_6, but I am still having trouble with
documentation:

--
| Sage Version 3.2.3, Release Date: 2009-01-05   |
| Type notebook() for the GUI, and license() for information.|
--
sage: gap_console()
GAP4, Version: 4.4.10 of 02-Oct-2007, i686-pc-linux-gnu-gcc
gap ?SymmetricGroup
Help: Showing `Reference: SymmetricGroup'
Record: 'rec.tempfile' must have an assigned value at
str := OutputTextFile( $SAGE.tempfile, false );
 called from
HELP_VIEWER_INFO.(viewer).show( data ); called from
HELP_PRINT_MATCH( i ); called from
HELP_SHOW_MATCHES( books, str, true ) called from
function( arguments ) called from read-eval-loop
Entering break read-eval-print loop ...
you can 'quit;' to quit to outer loop, or
you can 'return;' after assigning a value to continue
brk


I am running Sage on a thinkpad with Fedora 10.

Any suggestions would be appreciated.

Thanks,
Dave
--~--~-~--~~~---~--~~
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: problem running combinatorial functions

2009-01-07 Thread davidp

Oops.  I take back my last post.  Running Sage 3.2.2, I got the
following:

sage: combinations([1,2,3,4],2)

   File string, line 1
 [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ], [ 2, 4 ], [ 3, 4 ] ]
gap
   ^
SyntaxError: invalid syntax

The problem seems to occur on line 1580 of combinat.py:

1579ans=gap.eval(Combinations(%s,%s)%(mset,ZZ(k))).replace
(\n,)
1580   return eval(ans)

For the example above:

sage: gap.eval(Combinations([1,2,3,4],2))
'[ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ], [ 2, 4 ], [ 3, 4 ] ]\n\x1b
[1m\x1b[34mgap \x1b[0m'
sage: eval(gap.eval(Combinations([1,2,3,4],2)).replace(\n,))

   File string, line 1
 [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ], [ 2, 4 ], [ 3, 4 ] ]
gap
   ^
SyntaxError: invalid syntax

sage: eval(gap.eval(Combinations([1,2,3,4],2)).replace(\n,))

   File string, line 1
 [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ], [ 2, 4 ], [ 3, 4 ] ]
gap
   ^
SyntaxError: invalid syntax

Thanks for any suggestions.

Dave



On Jan 4, 10:44 am, davidp dav...@reed.edu wrote:
 Thanks.  By problem went away with Sage 3.2.2.

 Dave

 On Dec 27 2008, 10:55 am, mabshoff michael.absh...@mathematik.uni-

 dortmund.de wrote:
  On Dec 27, 9:11 am,DavidPerkinsondav...@reed.edu wrote:

  Hi Dave,

   Here is a typical error when I try to run a combinatorial function:

   sage: combinations([1,2],3)
   
      File string, line 1
        [  ]gap
            ^
   SyntaxError: invalid syntax

   Linux Fedora 9, 2.6.27.7-53.fc9.i686 on a Thinkpad
   SAGE Version 3.1.4, Release Date: 2008-10-16
   installed from a binary

   Thanks for any suggestions.

   Dave

  This works for me in Sage 3.2.2:

  sage: combinations([1,2],1)
  [[1], [2]]
  sage: combinations([1,2],2)
  [[1, 2]]
  sage: combinations([1,2],3)
  []

  Note that this code was recently (In Sage 3.2.0 or so IIRC) fixed.

  Cheers,

  Michael
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---