[sage-support] shortest paths in graphs

2008-02-22 Thread vgermrk

This works:
graphs.CubeGraph(4).shortest_paths('')
but this don't:
graphs.CubeGraph(4).shortest_path_all_pairs()

Maybe the shortest_path_all_pairs function needs a
by_weight=False   parameter too (like the other shortest paths
functions).

I also would like to have a function  all_shortest_paths(u,v), which
returns all shortest paths from u to v.
I know i could use all_paths and then pick the shortest, but that's
really inefficient.
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: noncommutative algebras

2008-02-22 Thread Simon King

Dear William,

On Feb 22, 1:58 am, William Stein [EMAIL PROTECTED] wrote:
   If I rename it to tensor.sage (not sure if this is a good idea),

 Yes, that's a VERY GOOD idea.  It's really crazy to use a compiled
 spyx for the purposes of interfacing with the Singular interpreter
 via pexpect.

Sorry, using a compiled spyx was just, well, let's call it my personal
tradition.

Am i right that the loop must be re-written if it is .sage rather
than .spyx?
I think
   for i from 1=i=len(L[2]):
is only possible in .spyx, while in .sage it should be
   for i in range(1,len(L[2])+1)

@John, this would explain the new error message after renaming the
file.

However, i don't know why attaching the .spyx didn't work.

Yours
 Simon

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Errno 13 on worksheet cells after uploading

2008-02-22 Thread AprèsTech

Hello,

After uploading a worksheet from my PC to the sagenb.org server, I
can't edit or evaluate cells within it.  I'm receiving the error
message

Traceback (most recent call last):
  File stdin, line 1, in module
IOError: [Errno 13] Permission denied: '/home/server2/sage_notebook/
worksheets/aprestech/4/code/3.py'

Did I do something wrong, or is this a bug?

Thanks,
Andy

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Trying to graph cubic function f(x)=x^(1/3)

2008-02-22 Thread Andy

I am interested in the use of Sage as a teaching tool at all grade
levels.  At the moment, I'm trying to weave Sage into an introductory
algebra curriculum.

I can graph all the basic functions with plot(x), replacing x with
x^2, x^3, 1/x, etc.  The one I can't get to work is x^(1/3).  I've
tried to express the cube root function several different ways.  The
expression I'm using now is:

sage:
show(plot(x^(1/3),-10,10),figsize=[5,5],xmin=-10,xmax=10,ymin=-10,ymax=10)

I receive the error message  TypeError: 'float' object is
unsubscriptable

Also, is the expression above the most succinct way to generate a
graph with this kind of view, x and y ranging -10 to 10?

Thanks for any advice.

Andy
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Trying to graph cubic function f(x)=x^(1/3)

2008-02-22 Thread Alex Ghitza

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Andy,

I had the exact same question a few days ago.  There are
many issues involved here, but the short answer to your
question (provided by Carl Witty) is:

you can plot x^(1/3) with

show(plot(lambda x : RR(x).nth_root(3), -10, 10), figsize=[5,5], 
ymin=-10, ymax=10)

You don't need to specify xmin and xmax in show since they're
given in the plot command.

Best,
Alex



Andy wrote:
| I am interested in the use of Sage as a teaching tool at all grade
| levels.  At the moment, I'm trying to weave Sage into an introductory
| algebra curriculum.
|
| I can graph all the basic functions with plot(x), replacing x with
| x^2, x^3, 1/x, etc.  The one I can't get to work is x^(1/3).  I've
| tried to express the cube root function several different ways.  The
| expression I'm using now is:
|
| sage:
| show(plot(x^(1/3),-10,10),figsize=[5,5],xmin=-10,xmax=10,ymin=-10,ymax=10)
|
| I receive the error message  TypeError: 'float' object is
| unsubscriptable
|
| Also, is the expression above the most succinct way to generate a
| graph with this kind of view, x and y ranging -10 to 10?
|
| Thanks for any advice.
|
| Andy
| |
|


- --
Alexandru Ghitza
Assistant Professor
Department of Mathematics
Colby College
Waterville, ME 04901
http://bayes.colby.edu/~ghitza/
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHvtngdZTaNFFPILgRAvbjAJ9qlM5R2UnmCHwOMV2HOlhg+LcwZACcC21K
Mrx/wRMSjGXeYz2KpkXN0Xo=
=O3v+
-END PGP SIGNATURE-


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Trying to graph cubic function f(x)=x^(1/3)

2008-02-22 Thread William Stein

On Fri, Feb 22, 2008 at 6:19 AM, Alex Ghitza [EMAIL PROTECTED] wrote:

  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1

  Hi Andy,

  I had the exact same question a few days ago.  There are
  many issues involved here, but the short answer to your
  question (provided by Carl Witty) is:

  you can plot x^(1/3) with

  show(plot(lambda x : RR(x).nth_root(3), -10, 10), figsize=[5,5],
  ymin=-10, ymax=10)

  You don't need to specify xmin and xmax in show since they're
  given in the plot command.


Hi,

What would people think of improving the _error_ message to plot
so that it prints some additional helpful information for certain strikingly
common situations?  +1 ?  -1?

 -- William


  Andy wrote:
  | I am interested in the use of Sage as a teaching tool at all grade
  | levels.  At the moment, I'm trying to weave Sage into an introductory
  | algebra curriculum.
  |
  | I can graph all the basic functions with plot(x), replacing x with
  | x^2, x^3, 1/x, etc.  The one I can't get to work is x^(1/3).  I've
  | tried to express the cube root function several different ways.  The
  | expression I'm using now is:
  |
  | sage:
  | show(plot(x^(1/3),-10,10),figsize=[5,5],xmin=-10,xmax=10,ymin=-10,ymax=10)
  |
  | I receive the error message  TypeError: 'float' object is
  | unsubscriptable
  |
  | Also, is the expression above the most succinct way to generate a
  | graph with this kind of view, x and y ranging -10 to 10?
  |
  | Thanks for any advice.
  |
  | Andy
  | |
  |


  - --
  Alexandru Ghitza
  Assistant Professor
  Department of Mathematics
  Colby College
  Waterville, ME 04901
  http://bayes.colby.edu/~ghitza/
  -BEGIN PGP SIGNATURE-
  Version: GnuPG v2.0.7 (GNU/Linux)
  Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

  iD8DBQFHvtngdZTaNFFPILgRAvbjAJ9qlM5R2UnmCHwOMV2HOlhg+LcwZACcC21K
  Mrx/wRMSjGXeYz2KpkXN0Xo=
  =O3v+
  -END PGP SIGNATURE-




  




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



[sage-support] Re: Errno 13 on worksheet cells after uploading

2008-02-22 Thread William Stein

On Thu, Feb 21, 2008 at 9:09 PM, AprèsTech [EMAIL PROTECTED] wrote:

  Hello,

  After uploading a worksheet from my PC to the sagenb.org server, I
  can't edit or evaluate cells within it.  I'm receiving the error
  message

  Traceback (most recent call last):
   File stdin, line 1, in module
  IOError: [Errno 13] Permission denied: '/home/server2/sage_notebook/
  worksheets/aprestech/4/code/3.py'

  Did I do something wrong, or is this a bug?

This is *definitely* a bug on my part.  I'll look into it immediately.
If you still have this problem after you get this email, please
respond and let me know.

Also, can you get the bug to occur again by uploading another worksheet?
This problem is caused by the too-strict in this case security model.  It can
be fixed once for all if it is easily repeatable.

William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: noncommutative algebras

2008-02-22 Thread William Stein

On Fri, Feb 22, 2008 at 12:50 AM, Simon King
[EMAIL PROTECTED] wrote:

  Dear William,


  On Feb 22, 1:58 am, William Stein [EMAIL PROTECTED] wrote:
 If I rename it to tensor.sage (not sure if this is a good idea),
  
   Yes, that's a VERY GOOD idea.  It's really crazy to use a compiled
   spyx for the purposes of interfacing with the Singular interpreter
   via pexpect.

  Sorry, using a compiled spyx was just, well, let's call it my personal
  tradition.

  Am i right that the loop must be re-written if it is .sage rather
  than .spyx?
  I think

for i from 1=i=len(L[2]):
  is only possible in .spyx, while in .sage it should be
for i in range(1,len(L[2])+1)

Yes, that is correct.   But when you're not working with pure C data structures
you're going to get no speed improvements by using
for i from 1=i=len(L[2]):
instead of
for i in range(1,len(L[2])+1)

You're just making things a little more difficult.

  @John, this would explain the new error message after renaming the
  file.

Yes, that would.


  However, i don't know why attaching the .spyx didn't work.



That's very suspicious:

sage: attach tensorpower.spyx
Loading of file /Users/palmieri/.sage/tensorpower.spy has type not
implemented.

That suggests there is either a very very weird serious bug that got
magically fixed
or maybe the above log isn't what really happened -- notice that in
the error message
it says .spy not  .spyx.

 -- William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: noncommutative algebras

2008-02-22 Thread William Stein

On Fri, Feb 22, 2008 at 10:03 AM, John Palmieri [EMAIL PROTECTED] wrote:



  On Feb 22, 8:47 am, William Stein [EMAIL PROTECTED] wrote:
   On Fri, Feb 22, 2008 at 12:50 AM, Simon King
  
  
  


  [EMAIL PROTECTED] wrote:
  
 Dear William,
  
 On Feb 22, 1:58 am, William Stein [EMAIL PROTECTED] wrote:
If I rename it to tensor.sage (not sure if this is a good idea),
  
  Yes, that's a VERY GOOD idea.  It's really crazy to use a compiled
  spyx for the purposes of interfacing with the Singular interpreter
  via pexpect.
  
 Sorry, using a compiled spyx was just, well, let's call it my personal
 tradition.
  
 Am i right that the loop must be re-written if it is .sage rather
 than .spyx?
 I think
  
   for i from 1=i=len(L[2]):
 is only possible in .spyx, while in .sage it should be
   for i in range(1,len(L[2])+1)
  
   Yes, that is correct.   But when you're not working with pure C data 
 structures
   you're going to get no speed improvements by using
  
   for i from 1=i=len(L[2]):
   instead of
   for i in range(1,len(L[2])+1)
  
   You're just making things a little more difficult.
  
 @John, this would explain the new error message after renaming the
 file.
  
   Yes, that would.
  
  
  
 However, i don't know why attaching the .spyx didn't work.
  
   That's very suspicious:
  
   sage: attach tensorpower.spyx
   Loading of file /Users/palmieri/.sage/tensorpower.spy has type not
   implemented.
  
   That suggests there is either a very very weird serious bug that got
   magically fixed
   or maybe the above log isn't what really happened -- notice that in
   the error message
   it says .spy not  .spyx.

  Right, I'm confused by that, too, but that's what it says.  I just
  took the new file tensorpower.sage that Simon sent me, copied it to
  tp.spyx, and did the following (in a new worksheet).

  sage: attach tp.spyx
  Loading of file /home/palmieri/.sage/tp.spy has type not
  implemented.
  sage: attach tensorpower.sage
  sage: R=singular.ring(2,'(x1,x12,x2)','dp')

 sage: D=singular.matrix(3,3,'0,0,-x12, 0,0,0, 0,0,0')
  sage: S=singular.nc_algebra(1,D)
  sage: S
  //   characteristic : 2
  //   number of vars : 3

 //block   1 : ordering dp
  //  : namesx1 x12 x2
  //block   2 : ordering C
  //   noncommutative relations: ...

  This is with Sage 2.9.3 on the linux box in my office, and I had a
  similar problem with Sage 2.10.1 on my mac at home.

  ...

  Now, after trying one or two more things, here's more information: if
  I start sage from a terminal, then type attach tp.spyx, I get an
  error about not being able to find the file (which makes sense, since
  I put the file in ~/.sage/, not in my home directory). Then I type
  notebook(), go to my web browser, and do the stuff I pasted in
  above.  Then I quit that, go back to the terminal, hit ctrl-C twice,
  and do attach tp.spyx.  This time it works: typing notebook() and
  then quitting it seems to change my default directory from ~/ to
  ~/.sage/.

  So, anyway, it seems that I can attach .spyx files from the terminal
  session, but not from a notebook in a web browser.

To attach files in a *local* notebook give the exact path to the file.

 -- William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: shortest paths in graphs

2008-02-22 Thread Robert Miller

Looking at the repository, it seems as if I wrote these functions, but
I don't think that's right. Maybe this was one of the patches I merged
from Jason Grout, while his name wasn't getting on the changesets. I
seem to remember Emily Kirkman working on path functions, also. I'm
not sure what the origin of this code is, but the fact that it doesn't
work has been filed as a trac ticket:

http://trac.sagemath.org/sage_trac/ticket/2265

On Feb 22, 12:20 am, vgermrk [EMAIL PROTECTED] wrote:
 This works:
 graphs.CubeGraph(4).shortest_paths('')
 but this don't:
 graphs.CubeGraph(4).shortest_path_all_pairs()

 Maybe the shortest_path_all_pairs function needs a
 by_weight=False   parameter too (like the other shortest paths
 functions).

 I also would like to have a function  all_shortest_paths(u,v), which
 returns all shortest paths from u to v.
 I know i could use all_paths and then pick the shortest, but that's
 really inefficient.
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: noncommutative algebras

2008-02-22 Thread Simon King

Dear John,

a brief addendum to a previous post of yours:

On Feb 20, 10:22 pm, John Palmieri [EMAIL PROTECTED] wrote:
 By the way, is the following a bug?

 sage: singular.LIB('ncall.lib')
 sage: R=singular.ring(0,'(x1,x12,x2)','dp')
 sage: C=singular.matrix(3,3,'1,-1,-1, -1,1,-1, -1,-1,1')
 sage: C

 1, -1,-1,
 -1,1, -1,
 -1,-1,1
 sage: R=singular.ring(0,'(x1,x12,x2)','dp')
 sage: C
 `sage1`

As William pointed out, this is not a bug.

When re-defining R, then i think the matrix C is in fact lost.
However, it may be worth mentioning that after defining the 'same'
ring under a new name, it is easy to produce a copy of C in the new
ring; let R and C be defined as above. Then:
sage: newR=singular.ring(0,'(x1,x12,x2)','dp')
sage: C
`sage1`
sage: newC=R.fetch(C)
sage: newC

1, -1,-1,
-1,1, -1,
-1,-1,1
sage: R.set_ring()
sage: C

1, -1,-1,
-1,1, -1,
-1,-1,1
sage: newC
`sage3`

You see, a matrix (or an ideal) is only accessible if its ring is
active. But as long as the ring is not overwritten, the matrix isn't
lost.

Singular offers two commands to ship data from one ring to another:
fetch and imap. See
http://www.singular.uni-kl.de/Manual/latest/sing_197.htm#SEC237
and
http://www.singular.uni-kl.de/Manual/latest/sing_215.htm#SEC255

Cheers
  Simon

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: shortest paths in graphs

2008-02-22 Thread Robert Miller

 I also would like to have a function  all_shortest_paths(u,v), which
 returns all shortest paths from u to v.

See ticket:

http://trac.sagemath.org/sage_trac/ticket/2266
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Trying to graph cubic function f(x)=x^(1/3)

2008-02-22 Thread Andy

Alex

Thanks for your help.  I had searched the group and found the thread
about nth roots, but I wasn't putting it together with the plot
statement correctly.

Thanks also to Jason for publishing an illustration -- good idea.  The
published worksheets are a great resource for learning Sage and
working through the subtleties, one which I'll remember to search for
future questions.


On Feb 22, 7:19 am, Alex Ghitza [EMAIL PROTECTED] wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Hi Andy,

 I had the exact same question a few days ago.  There are
 many issues involved here, but the short answer to your
 question (provided by Carl Witty) is:

 you can plot x^(1/3) with

 show(plot(lambda x : RR(x).nth_root(3), -10, 10), figsize=[5,5],
 ymin=-10, ymax=10)

 You don't need to specify xmin and xmax in show since they're
 given in the plot command.

 Best,
 Alex

 Andy wrote:

 | I am interested in the use of Sage as a teaching tool at all grade
 | levels.  At the moment, I'm trying to weave Sage into an introductory
 | algebra curriculum.
 |
 | I can graph all the basic functions with plot(x), replacing x with
 | x^2, x^3, 1/x, etc.  The one I can't get to work is x^(1/3).  I've
 | tried to express the cube root function several different ways.  The
 | expression I'm using now is:
 |
 | sage:
 | show(plot(x^(1/3),-10,10),figsize=[5,5],xmin=-10,xmax=10,ymin=-10,ymax=10)
 |
 | I receive the error message  TypeError: 'float' object is
 | unsubscriptable
 |
 | Also, is the expression above the most succinct way to generate a
 | graph with this kind of view, x and y ranging -10 to 10?
 |
 | Thanks for any advice.
 |
 | Andy
 | |
 |

 - --
 Alexandru Ghitza
 Assistant Professor
 Department of Mathematics
 Colby College
 Waterville, ME 04901http://bayes.colby.edu/~ghitza/
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v2.0.7 (GNU/Linux)
 Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org

 iD8DBQFHvtngdZTaNFFPILgRAvbjAJ9qlM5R2UnmCHwOMV2HOlhg+LcwZACcC21K
 Mrx/wRMSjGXeYz2KpkXN0Xo=
 =O3v+
 -END PGP SIGNATURE-
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] sage can't find matlab

2008-02-22 Thread chz

Hi there -

I have a local install of Matlab 2007b and a local install of Sage.
When I run a Matlab command from Sage, e.g. the command
matlab.eval('2+2')
I get the error Unable to start matlab because the command 'matlab -
nodisplay' failed.  The location of the Matlab executable is included
in my PATH variable, so I'm not sure what the problem is.  I've
scoured the various tutorials  documentation available, as well as
the Sage wiki, and I couldn't find anyone addressing this issue.  Any
suggestions?

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---