[sage-devel] Re: Implementing the tropical semiring

2009-11-07 Thread Nicolas M. Thiery

On Fri, Nov 06, 2009 at 12:52:09PM -0800, luisfe wrote:
 Quite a long time ago, somebody posted this
  Mon, 02 Jul 2007 10:36:10 -0700
 
  I am in need of free software that will work with polynomials over the
  Tropical semiring.  I was unable to find anything suitable, so I
  thought I would take a stab at implementing them in sage.  I have just
  barely found sage though, so I don't yet understand it entirely.  This
  list seemed very friendly so I thought I would ask a few questions:
 
  1. Is this already implemented under a different name (it's also
  called min-plus algebra), or someplace that I overlooked?
 
  2. Is it reasonable to implement in sage?  In particular one thing
  that I think may be difficult is that the polynomial 'x+3' is really
  '0*x+3' since 0 is the multiplicative identity (infinity is the
  additive identity).
 
  3. Where is the best place to go to find out how to develop a sage
  package etc.  Also good tutorials for python would be appreciated,
  since I have never done any python development.  I do have experience
  in a variety of other languages.
 
  4. Would this be better to implement in something like GAP (so that
  GAP users can take advantage of it as well) and then access it through
  sage?
 Has anyone made some progress about this?
 
 I have my own silly implementation of tropical polynomials over the
 rationals in sage using dictionaries. And I am considering to write it
 well, using Categories and Parents and a good coerce method. It should
 interact and use characteristics of gfan by A. Jensen and the tropical
 lib implemented in Singular by Thomas Markwig. Although the latest
 uses polymake, not included in sage by default and these two programs
 would be used more to pass from a polynomial ring over a valued field
 to a tropical semiring.
 
 Is there already any Category in which this structure could fit?

For information: in MuPAD, we had a category SemiRings, and Eric
Laugerotte had implemented a couple parents (called domains in
MuPAD) in it (boolean semi ring, tropical semi ring), which were used
for calculations with weighted automatons. The implementation was
rather plain, but it was already organized using coercions,
categories, and so on. In:

http://mupad-combinat.svn.sourceforge.net/viewvc/mupad-combinat/trunk/MuPAD-Combinat/lib/DOMAINS/

Look for:

CATEGORY/SemiRing.mu

DOMAIN/BooleanSemiRing.mu
DOMAIN/MaxMinSemiRing.mu  and friends MinMax, ...

DOMAINS/DOMAIN/SemiRing.mu
DOMAINS/DOMAIN/TEST/SemiRing.tst   // tests and examples

The last one was the most handy: it's a generic tropical semi-ring
that was created by passing an existing parent, and what +,*,0,1 were
to be. In Sage, it could look like:

SemiRing(NonNegativeIntegers, plus = max, zero = 0, mult = operator.add, one = 
0)

If you are interested, I'd happily add the SemiRing category to Sage
as soon as the category code is in (which should be very soon now;
finally!). There will be some technicalities, like how to make it easy
to add +infinity to an existing set, to disable all the preexisting
ring operations the set may already have (i.e. apply a forgetful
functor), ...

Eric: do you have references to suggest around this code, or some
design notes? Are you interested in joining on this project?

Best,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Do we need cp -a - or would 'cp -pR' do ?

2009-11-07 Thread Dr. David Kirkby

In my recent attempt to create a binary distribution for Solaris (see thread 
What directories should go into a binary  distribution?), failed as the '-a' 
option was used to the 'cp' command in

SAGE_ROOT/local/bin/sage-bdist.

See trac http://trac.sagemath.org/sage_trac/ticket/7407

A look at the top of sage-bdist shows:

if [ $UNAME = Darwin ]; then
 OPT=Rp
else
 OPT=ra
fi

then later on we see the '$OPT' is used when the 'cp' command is used.

cp -$OPT examples local makefile *.txt *.sage sage ipython data $TMP/
cp -L$OPT devel/sage-main $TMP/devel/sage-main
cp -$OPT installed $TMP/$PKGDIR/
cp -$OPT standard $TMP/$PKGDIR/
cp  install README.txt gen_html $TMP/$PKGDIR/
cp sage/local/bin/sage-README-osx.txt README.txt


Clearly it appears OS X is happy with the options '-Rp'. I can't see why Linux 
should not be too, as those are standard options.

Do we know why the '-L' option is used once?

cp -L$OPT devel/sage-main $TMP/devel/sage-main

I read the POSIX standard, and although this is a required option, I can't 
really work out exactly what the option is supposed to do. To quote from the 
2004 standard:


-L
 Take actions based on the type and contents of the file referenced by any 
symbolic link specified as a source_file operand or any symbolic links 
encountered during traversal of a file hierarchy.
-

I do not know exactly that action it is supposed to take though!

I'd like to get rid of the '-L' option too, unless there is a need for it, as 
it 
is not supported on HP-UX 11.11. However, '-L' is a POSIX option, so I'm not 
suggesting '-L' is removed if '-L' has any use in Sage. I'm just wondering what 
the reason for its inclusion is.

If there is a good reason for it, I'll change the code to:

if [ `uname` != HP-UX ] ; then
cp -LpR devel/sage-main $TMP/devel/sage-main
else
cp -pR devel/sage-main $TMP/devel/sage-main
fi


I just done a check on 4 Unix systems. Not one of them accepts this '-a' 
option. 
However, three of the four support -L, which is required by POSIX.

1) OpenSolaris
bash-3.2$ uname -a
SunOS hawk 5.11 snv_111b i86pc i386 i86pc
bash-3.2$ touch b
bash-3.2$ cp -a b c
cp: illegal option -- a
Usage: cp [-f] [-i] [-p] [...@] [-/] f1 f2
cp [-f] [-i] [-p] [...@] [-/] f1 ... fn d1
cp -r|-R [-H|-L|-P] [-f] [-i] [-p] [...@] [-/] d1 ... dn-1 dn


2) Solaris 10
drkir...@kestrel:~$ cp -a b c
cp: illegal option -- a
Usage: cp [-f] [-i] [-p] [...@] f1 f2
cp [-f] [-i] [-p] [...@] f1 ... fn d1
cp -r|-R [-H|-L|-P] [-f] [-i] [-p] [...@] d1 ... dn-1 dn

3) AIX 6.1 (runs on IBM Unix boxes)
$ uname -a
AIX client9 1 6 00C6B7C04C00
$ touch b
$ cp -a b c
cp: illegal option -- a
Usage: cp [-fhipHILPU][-d|-e] [-r|-R] [-E{force|ignore|warn}] [--] src target
or: cp [-fhipHILPU] [-d|-e] [-r|-R] [-E{force|ignore|warn}] [--] src1 ... 
srcN directory


4) HP-UX hpbox B.11.11 U 9000/785 2016698240 unlimited-user license
$ touch b
$ cp -a b c
cp: illegal option -- a
Usage:  cp [-f|-i] [-p] [-S] [-e warn|force|ignore] source_file target_file
cp [-f|-i] [-p] [-S] [-e warn|force|ignore] source_file ... 
target_directory
cp [-f|-i] [-p] [-S] -R|-r [-e warn|force|ignore] source_directory ... 
target_directory

As you can see, '-a' is not well supported, and I think is best removed.

Dave

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Automatic Uploading/Opening files with Sage.app

2009-11-07 Thread Ivan Andrus

In the past there was discussion about automatic uploading of sws  
files and such on local servers so that double clicking an sws file  
would do the right thing.

See for example here:

http://www.mail-archive.com/sage-devel@googlegroups.com/msg19059.html

which for some reason has all the messages in one thread while google  
groups does not:

http://groups.google.com/group/sage-devel/msg/d43d50551fd22a28
http://groups.google.com/group/sage-devel/msg/7af5aa59b0e4b2ee
http://groups.google.com/group/sage-devel/msg/5d1759cadc7303a9
...

Bizarre.  But back to the topic at hand.

I would like to get ideas as to what types of files should be handled  
and how. e.g. I know that pdf files can be used by sage, but having  
never worked with them I don't know what opening a pdf file with sage  
should do (if it even makes sense–e.g. can sage convert it to a  
worksheet and open it).  I do know that an .sws file should be  
automatically uploaded to the running notebook server (or start one  
if there isn't one running) and opened in a browser.  Should a .sage  
file be run in the terminal or somehow open up in the browser?  Should  
Sage.app accept .tex, .gap, etc. files?

I personally think that the most important (and difficult?) files to  
handle are .sws files, and I would like to implement this feature.  I  
think I may have some time to do so in the next few weeks, but I need  
to create the moral equivalent of

sage -upload /path/to/file.sws

Perhaps sage should know what to do with files instead of assuming  
that it's a sage/python file so that something like:

sage /path/to/file.sws

would upload it without having to specify -upload.  Also

sage /path/to/file.gap

would know to start gap etc.  Do you think this would this be a  
feature or a misfeature?

Wow, sorry for the long rambling email.

-Ivan
--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: error compiling sage-4.2 from source

2009-11-07 Thread Georg S. Weber


 Yes, definitely.  The preqreq script would be changed to require
 gfortran on *all* platforms except OS X, since Fortran isn't included
 in Xcode so is a pain to require there.

 William

Hi William,
I just skipped over the Mac OS X tools page from the R project:

http://r.research.att.com/tools/

and I from what I read there, I agree that we should continue to ship
the fortran.spkg with the Sage versions for Mac OS X. Apart from that,
I am +1 to removing the fortran.spkg, and rely on a Fortran compiler
as an external dependency, just as currently with the C/C++ compiler
to be used.

Cheers,
Georg
--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Notebook not working properly on Solaris 10.

2009-11-07 Thread Dr. David Kirkby

I built Sage 4.2 on Solaris 10 on a Sun Netra T1 running the first release of 
Solaris 10.

Whilst computing things like 1+1 work fine in command line mode, they do not 
work in the notebook. The input is accepted in the notebook, but no output is 
ever displayed.

See screenshot (sorry, I should have cropped it first), at:

http://sage.math.washington.edu/home/kirkby/Sage-4.2-on-Solaris-10.png

Here is the commands typed. Note, I'm running this on a different machine to 
where the browser is. The browser is running on an OpenSolaris (x86) machine, 
and the sage binary on a Solaris 10 (SPARC) machine.


drkir...@kestrel:~/sage-4.2$ ./sage
--
| Sage Version 4.2, Release Date: 2009-10-24 |
| Type notebook() for the GUI, and license() for information.|
--
sage: sage: notebook(address='', server_pool=['sa...@localhost'],ulimit='-v 
50', accounts=True)
**
WARNING: Running the notebook insecurely not on localhost is dangerous
because its possible for people to sniff passwords and gain access to
your account. Make sure you know what you are doing.
**
The notebook files are stored in: sage_notebook.sagenb
**
WARNING: Insecure notebook server listening on external address.
Unless you are running this via ssh port forwarding, you are
**crazy**!  You should run the notebook with the option secure=True.
**
**
**
* Open your web browser to http://localhost:8000 *
**
**
/export/home/drkirkby/sage-4.2/local/lib/python2.6/site-packages/twisted/persisted/sob.py:12:
 
DeprecationWarning: the md5 module is deprecated; use hashlib instead
   import os, md5, sys
2009-11-07 10:48:09+ [-] Log opened.
2009-11-07 10:48:09+ [-] twistd 8.2.0 
(/export/home/drkirkby/sage-4.2/local/bin/python 2.6.2) starting up.
2009-11-07 10:48:09+ [-] reactor class: 
twisted.internet.selectreactor.SelectReactor.
2009-11-07 10:48:09+ [-] twisted.web2.channel.http.HTTPFactory starting on 
8000
2009-11-07 10:48:09+ [-] Starting factory 
twisted.web2.channel.http.HTTPFactory instance at 0x3a05238
/export/home/drkirkby/sage-4.2/local/bin/sage-native-execute: xdg-open: not 
found
2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11] got EOF subprocess must 
have crashed...
2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11] The authenticity of host 
'localhost (127.0.0.1)' can't be established.
2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11] RSA key fingerprint is 
55:45:b6:ed:05:bb:e1:be:21:0a:0a:93:87:15:4d:41.
2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11] Are you sure you want to 
continue connecting (yes/no)?
2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11] import 
os;os.chdir(/tmp/tmpnMPbma);
2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11] 
execfile(_sage_input_2.py)Host key verification failed.
2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11]
2009-11-07 10:49:42+ [HTTPChannel,1,192.168.1.11] got EOF subprocess must 
have crashed...
2009-11-07 10:49:42+ [HTTPChannel,1,192.168.1.11] The authenticity of host 
'localhost (127.0.0.1)' can't be established.
2009-11-07 10:49:42+ [HTTPChannel,1,192.168.1.11] RSA key fingerprint is 
55:45:b6:ed:05:bb:e1:be:21:0a:0a:93:87:15:4d:41.
2009-11-07 10:49:42+ [HTTPChannel,1,192.168.1.11] Are you sure you want to 
continue connecting (yes/no)?
2009-11-07 10:49:42+ [HTTPChannel,1,192.168.1.11] import 
os;os.chdir(/tmp/tmpZmv353);
2009-11-07 10:49:42+ [HTTPChannel,1,192.168.1.11] 
execfile(_sage_input_2.py)Host key verification failed.
2009-11-07 10:49:42+ [HTTPChannel,1,192.168.1.11]
2009-11-07 10:49:52+ [HTTPChannel,0,192.168.1.11] got EOF subprocess must 
have crashed...
2009-11-07 10:49:52+ [HTTPChannel,0,192.168.1.11] The authenticity of host 
'localhost (127.0.0.1)' can't be established.
2009-11-07 10:49:52+ [HTTPChannel,0,192.168.1.11] RSA key fingerprint is 
55:45:b6:ed:05:bb:e1:be:21:0a:0a:93:87:15:4d:41.
2009-11-07 10:49:52+ [HTTPChannel,0,192.168.1.11] Are you sure you want to 
continue connecting (yes/no)?
2009-11-07 10:49:52+ [HTTPChannel,0,192.168.1.11] import 
os;os.chdir(/tmp/tmpu7K3JK);
2009-11-07 10:49:52+ [HTTPChannel,0,192.168.1.11] 
execfile(_sage_input_2.py)Host key verification failed.
2009-11-07 10:49:52+ [HTTPChannel,0,192.168.1.11]
2009-11-07 10:51:05+ [HTTPChannel,1,192.168.1.11] got EOF subprocess must 
have crashed...
2009-11-07 10:51:05+ 

[sage-devel] Re: Notebook not working properly on Solaris 10.

2009-11-07 Thread Willem Jan Palenstijn

On Sat, Nov 07, 2009 at 11:02:07AM +, Dr. David Kirkby wrote:
 
 I built Sage 4.2 on Solaris 10 on a Sun Netra T1 running the first release of 
 Solaris 10.
 
 Whilst computing things like 1+1 work fine in command line mode, they do not 
 work in the notebook. The input is accepted in the notebook, but no output is 
 ever displayed.

[...]
 
 2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11] got EOF subprocess must 
 have crashed...
 2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11] The authenticity of 
 host 
 'localhost (127.0.0.1)' can't be established.
 2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11] RSA key fingerprint is 
 55:45:b6:ed:05:bb:e1:be:21:0a:0a:93:87:15:4d:41.
 2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11] Are you sure you want 
 to 
 continue connecting (yes/no)?
 2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11] import 
 os;os.chdir(/tmp/tmpnMPbma);
 2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11] 
 execfile(_sage_input_2.py)Host key verification failed.
 2009-11-07 10:49:32+ [HTTPChannel,2,192.168.1.11]

It looks like the ssh connection is failing. Try if it works after first
manually ssh-ing to sa...@localhost once to answer the 'Are you sure you want
to continue connecting?' question.


-Willem Jan

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Do we need cp -a - or would 'cp -pR' do ?

2009-11-07 Thread MaxTheMouse



 Do we know why the '-L' option is used once?

 cp -L$OPT devel/sage-main $TMP/devel/sage-main

 I read the POSIX standard, and although this is a required option, I can't
 really work out exactly what the option is supposed to do. To quote from the
 2004 standard:

 
 -L
      Take actions based on the type and contents of the file referenced by any
 symbolic link specified as a source_file operand or any symbolic links
 encountered during traversal of a file hierarchy.
 -

 I do not know exactly that action it is supposed to take though!



If it helps, my cp reports:

-L, --dereferencealways follow symbolic links in SOURCE

This at least makes more sense. I don't know if it is needed in the
specific case. This is with cp (GNU coreutils) 7.4.

Adam
--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Do we need cp -a - or would 'cp -pR' do ?

2009-11-07 Thread Gonzalo Tornaria
On Sat, Nov 7, 2009 at 6:48 AM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 cp -L$OPT devel/sage-main $TMP/devel/sage-main

Maybe this is done to handle the case where sage-main is a symlink
to an actual directory. The option -L means to copy symlinks as real
files. Otherwise, the symlink may be copied (when using -a, at least
--- unspecified by posix when using -Rp).

As a matter of fact, using cp -Lra does NOT work as claimed above,
because the -a option implies -P which overrides the -L option. Using
cp -raL would copy symlinks, though.

The actual meaning of -a in gnu cp is really -dRp, not just -Rp.
The -d option should be replaced with -P posix option (preserve
symlinks), except the -d also preserves hard links. I don't think
posix has an option to preserve hard links.

For the line with -L, if the only motivation is to follow the symlink
in case sage-main itself is a symlink, the correct option is -H rather
than -L, but it may be possible to use (instead of -H or -L):

cp -$OPT devel/sage-main/ $TMP/devel/sage-main

the extra / at the end of the source operand makes it to expand the
symlink, if any.

Maybe somebody (wstein?) can comment on why the -L was added to the script?



WRT -d option (preserve symlinks + hardlinks). It's clearly necessary
to preserve symbolic links. For instance, dynamic libraries use
symlinks.

Is it really necessary for sage-bdist to preserve hardlinks?

[ ... checking a bdist tarball of 4.1.1 ... ]

there is exactly one hardlink in this bdist tarball:
local/bin/python is a hardlink to local/bin/python2.6.

IOW, using -P instead of -d would produce a tarball with two copies of
the python binary. Shouldn't this be handled with a symbolic link
instead?

-

My suggestion would be:

a. fix installation of python so that a symlink is used instead of a hard link
b. use -PRp as options for cp (this is posix!)
c. for the sage-main directory, use the trailing / trick so the -L /
-H option is not necessary (double check this with whoever wrote the
sage-bdist script to use -L option)
d. for systems where -P is not supported, figure out a way to copy
preserving symlinks.

[a. is not critical, but as long as it's not done, sage-bdist should
keep using -a or -d on gnu systems, to avoid bloat in the bdist
tarfile]

Gonzalo
PS: I've attached a shell script which exhibits the different
behaviours of cp with different options. You can try something like
that in HP-UX to see if there is a way to preserve symbolic links in a
copy.

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



cp-test.sh
Description: Bourne shell script


[sage-devel] Polynomial interpolation....

2009-11-07 Thread Nathann Cohen

Hello everybody !!!

I recently asked a question here : I have a set of points in R^n (or
C^n, or any vectorial space for the matter..), to which is associated
a set of values. Said differently, I have a function whose values I
only know at several points. I then would like, given a degree d, to
find a polynomial function of maximum degree d that goes through all
these points.

As Jason mentionned it in
http://groups.google.com/group/sage-support/browse_thread/thread/fa4a2936571de92f/a04de428e88abd77#a04de428e88abd77,
it seems to be the Chebyshev approximation defined in
http://mpmath.googlecode.com/svn/tags/0.13/doc/build/calculus/approximation.html.

Well, this approximation actually only works for dimension 1, while I
needed it in higher dimension. I wrote this functions, which is
basically the inversion of a matrix once everything is defined, and
thought it could be good to have it in Sage. Sadly, I know next to
nothing in this field of mathematics, and I am not sure my code is
clever/optimal. Besides, what is the best option ? Include it in
MPMaths ( fron which Jason found the approximation, or directly into
Sage ? )

Thank you for your help !

Nathann

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Polynomial interpolation....

2009-11-07 Thread Martin Rubey

Nathann Cohen nathann.co...@gmail.com writes:

 Hello everybody !!!

 I recently asked a question here : I have a set of points in R^n (or
 C^n, or any vectorial space for the matter..), to which is associated
 a set of values. Said differently, I have a function whose values I
 only know at several points. I then would like, given a degree d, to
 find a polynomial function of maximum degree d that goes through all
 these points.

 As Jason mentionned it in
 http://groups.google.com/group/sage-support/browse_thread/thread/fa4a2936571de92f/a04de428e88abd77#a04de428e88abd77,
 it seems to be the Chebyshev approximation defined in
 http://mpmath.googlecode.com/svn/tags/0.13/doc/build/calculus/approximation.html.

 Well, this approximation actually only works for dimension 1, while I
 needed it in higher dimension. I wrote this functions, which is
 basically the inversion of a matrix once everything is defined, and
 thought it could be good to have it in Sage. Sadly, I know next to
 nothing in this field of mathematics, and I am not sure my code is
 clever/optimal. Besides, what is the best option ? Include it in
 MPMaths ( fron which Jason found the approximation, or directly into
 Sage ? )

We have a *very* efficient (well, I believe so, at least) version of
(generalized) one-dimensional rational interpolation in FriCAS, and it's
one of the very short term goals to adapt it for several dimensions.

Hm, if your values are in the ground field, it should be there already,
actually.  In case of interest, I would check.

Help appreciated,

Martin

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] problems building sage 4.2

2009-11-07 Thread Pablo De Napoli

Building sage-4.2 on my Ubuntu machine failed (64 bits amd, Karmic Koala)
when building gnutls

host system
uname -a:
Linux ubuntu 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC
2009 x86_64 GNU/Linux


CC Version
gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.4.1-4ubuntu8'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--enable-shared --enable-multiarch --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
--program-suffix=-4.4 --enable-nls --enable-clocale=gnu
--enable-libstdcxx-debug --enable-objc-gc --disable-werror
--with-arch-32=i486 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu8)

Deleting old gnutls libraries in /home/pablo/sage/sage-4.2/local/lib
configure: error: cannot find install-sh or install.sh in build-aux
./build-aux
failed to configure GNUTLS

I don't know which maight be the cause of this problem.
best regards
Pablo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Automatic Uploading/Opening files with Sage.app

2009-11-07 Thread Ivan Andrus

I think I sent this from the wrong email address last time, since I  
don't see it on google groups.  If you already got this I apologize.

In the past there was discussion about automatic uploading of sws  
files and such on local servers so that double clicking an sws file  
would do the right thing.

See for example here:

http://www.mail-archive.com/sage-devel@googlegroups.com/msg19059.html

which for some reason has all the messages in one thread while google  
groups does not:

http://groups.google.com/group/sage-devel/msg/d43d50551fd22a28
http://groups.google.com/group/sage-devel/msg/7af5aa59b0e4b2ee
http://groups.google.com/group/sage-devel/msg/5d1759cadc7303a9
...

Bizarre.  But back to the topic at hand.

I would like to get ideas as to what types of files should be handled  
and how. e.g. I know that pdf files can be used by sage, but having  
never worked with them I don't know what opening a pdf file with sage  
should do (if it even makes sense–e.g. can sage convert it to a  
worksheet and open it).  I do know that an .sws file should be  
automatically uploaded to the running notebook server (or start one  
if there isn't one running) and opened in a browser.  Should a .sage  
file be run in the terminal or somehow open up in the browser?  Should  
Sage.app accept .tex, .gap, etc. files?

I personally think that the most important (and difficult?) files to  
handle are .sws files, and I would like to implement this feature.  I  
think I may have some time to do so in the next few weeks, but I need  
to create the moral equivalent of

sage -upload /path/to/file.sws

Perhaps sage should know what to do with files instead of assuming  
that it's a sage/python file so that something like:

sage /path/to/file.sws

would upload it without having to specify -upload.  Also

sage /path/to/file.gap

would know to start gap etc.  Do you think this would this be a  
feature or a misfeature?

Wow, sorry for the long rambling email.

-Ivan
--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Do we need cp -a - or would 'cp -pR' do ?

2009-11-07 Thread Dr. David Kirkby

Gonzalo Tornaria wrote:
 On Sat, Nov 7, 2009 at 6:48 AM, Dr. David Kirkby
 david.kir...@onetel.net wrote:
 cp -L$OPT devel/sage-main $TMP/devel/sage-main
 
 Maybe this is done to handle the case where sage-main is a symlink
 to an actual directory. The option -L means to copy symlinks as real
 files. Otherwise, the symlink may be copied (when using -a, at least
 --- unspecified by posix when using -Rp).
 
 As a matter of fact, using cp -Lra does NOT work as claimed above,
 because the -a option implies -P which overrides the -L option. Using
 cp -raL would copy symlinks, though.
 
 The actual meaning of -a in gnu cp is really -dRp, not just -Rp.
 The -d option should be replaced with -P posix option (preserve
 symlinks), except the -d also preserves hard links. I don't think
 posix has an option to preserve hard links.
 
 For the line with -L, if the only motivation is to follow the symlink
 in case sage-main itself is a symlink, the correct option is -H rather
 than -L, but it may be possible to use (instead of -H or -L):
 
 cp -$OPT devel/sage-main/ $TMP/devel/sage-main
 
 the extra / at the end of the source operand makes it to expand the
 symlink, if any.
 
 Maybe somebody (wstein?) can comment on why the -L was added to the script?


That would be very useful if William commented here.

 
 
 WRT -d option (preserve symlinks + hardlinks). It's clearly necessary
 to preserve symbolic links. For instance, dynamic libraries use
 symlinks.
 
 Is it really necessary for sage-bdist to preserve hardlinks?
 
 [ ... checking a bdist tarball of 4.1.1 ... ]
 
 there is exactly one hardlink in this bdist tarball:
 local/bin/python is a hardlink to local/bin/python2.6.
 
 IOW, using -P instead of -d would produce a tarball with two copies of
 the python binary. Shouldn't this be handled with a symbolic link
 instead?

I would have thought so too. But I'm puzzled, as python-2.6.2.p4/spkg-install 
creates a symbolic link. It has the line:

ln -s python2.6 python


I see that local/bin/python and local/bin/python2.6 are hard links, as they 
have 
the same inode.


drkir...@kestrel:~/sage-4.2/local/bin$ ls -i python
   8980 python
drkir...@kestrel:~/sage-4.2/local/bin$ ls -i python2.6
   8980 python2.6

But how did you find out these two were hard links? I'm not aware of any way to 
find if A is a hard link of B, unless one finds the inodes and compares them, 
which would be next to impossible where there are a lot of files. I assume 
there 
is some way you do this.

 -
 
 My suggestion would be:
 
 a. fix installation of python so that a symlink is used instead of a hard link

Do you know where this bit of code is? As I say, from what I can see, the link 
should be created as a symbolic link, not a hard link.

 b. use -PRp as options for cp (this is posix!)
 c. for the sage-main directory, use the trailing / trick so the -L /
 -H option is not necessary (double check this with whoever wrote the
 sage-bdist script to use -L option)
 d. for systems where -P is not supported, figure out a way to copy
 preserving symlinks.
 
 [a. is not critical, but as long as it's not done, sage-bdist should
 keep using -a or -d on gnu systems, to avoid bloat in the bdist
 tarfile]

Though the bloat will already exist on OS X, as OS X uses -pR, and no -a.

 Gonzalo
 PS: I've attached a shell script which exhibits the different
 behaviours of cp with different options. You can try something like
 that in HP-UX to see if there is a way to preserve symbolic links in a
 copy.

You have a far better understanding of this than me. If I gave you an account 
on 
the HP-UX box, could you try this out? (If so, let me know a username). But do 
not waste much time over it. Clearly the use of this non-POSIX option '-a' 
needs 
to be removed asap, as it stops a binary being created on Solaris. I'm 
reluctant 
to put tests in the script to handle Solaris differently to linux, when POSIX 
options should be suitable for either. If its possible to do something which 
works on all platforms (HP-UX etc), so much the better. But that is hardly that 
important.


--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] cython mode bug?

2009-11-07 Thread mhampton

Someone reading a tutorial I wrote on cython was quite confused
because the header %cython  in a cell gives a confusing error, and
needs to be %cython.  It seems to me that the extra whitespace
should not cause such problems, and this is a bug.  Anyone disagree?

-Marshall
--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Set reorders elements

2009-11-07 Thread Alex Ghitza


This is a bit disconcerting:

sage: Set(['a', 'b', 'c'])
{'a', 'c', 'b'}
sage: Set(['a', 'b', 'c', 'd'])
{'a', 'c', 'b', 'd'}
sage: Set(['a', 'b', 'c', 'd', 'e'])
{'a', 'c', 'b', 'e', 'd'}

Bug?  It doesn't seem to happen with lists of numbers.


Best,
Alex


-- 
Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne
-- Australia -- http://www.ms.unimelb.edu.au/~aghitza/

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Set reorders elements

2009-11-07 Thread Nick Alexander


On 7-Nov-09, at 8:29 PM, Alex Ghitza wrote:



 This is a bit disconcerting:

 sage: Set(['a', 'b', 'c'])
 {'a', 'c', 'b'}
 sage: Set(['a', 'b', 'c', 'd'])
 {'a', 'c', 'b', 'd'}
 sage: Set(['a', 'b', 'c', 'd', 'e'])
 {'a', 'c', 'b', 'e', 'd'}

 Bug?  It doesn't seem to happen with lists of numbers.

Sets are unordered.  Why does the display order changing worry you?

Nick

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Set reorders elements

2009-11-07 Thread Alex Ghitza

On Sat, Nov 07, 2009 at 08:44:11PM -0800, Nick Alexander wrote:
 
 
 Sets are unordered.  Why does the display order changing worry you?
 

Of course they are.  So mathematically speaking everything is fine.
However, unless there's a good reason for Set(['a', 'b', 'c']) to
result in {'a', 'c', 'b'}, I would prefer to not be kept on my toes
like this.

Questions that come to mind when I see this:

1. Can the display order change between different sessions of Sage on
the same machine?

2. Is the display order machine-dependent in any way?


In fact, the reason this is bothering me right now is that I'm writing
code for working with free groups on sets, and I end up with something
like

sage: G.a, b, c = FreeGroup()
sage: G
Free Group on the Set {a, c, b}
sage: b
c

This is probably due more to crappy programming on my part rather than
the Set issue, but the latter did confuse me.


Best,
Alex


-- 
Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne
-- Australia -- http://www.ms.unimelb.edu.au/~aghitza/

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Set reorders elements

2009-11-07 Thread Alex Ghitza

On Sun, Nov 08, 2009 at 04:06:01PM +1100, Alex Ghitza wrote:
 
 In fact, the reason this is bothering me right now is that I'm writing
 code for working with free groups on sets, and I end up with something
 like
 
 sage: G.a, b, c = FreeGroup()
 sage: G
 Free Group on the Set {a, c, b}
 sage: b
 c

And another example, where I (would like to) follow the example of the
constructor for multivariate polynomials:

sage: FreeGroup('x', 10)
Expected:
Free Group on the Set {x0, x1, x2, x3, x4, x5, x6, x7, x8, x9}
Got:
Free Group on the Set {x8, x9, x2, x3, x0, x1, x6, x7, x4, x5}


Best,
Alex


-- 
Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne
-- Australia -- http://www.ms.unimelb.edu.au/~aghitza/

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Set reorders elements

2009-11-07 Thread William Stein

On Sat, Nov 7, 2009 at 8:29 PM, Alex Ghitza aghi...@gmail.com wrote:


 This is a bit disconcerting:

 sage: Set(['a', 'b', 'c'])
 {'a', 'c', 'b'}
 sage: Set(['a', 'b', 'c', 'd'])
 {'a', 'c', 'b', 'd'}
 sage: Set(['a', 'b', 'c', 'd', 'e'])
 {'a', 'c', 'b', 'e', 'd'}

 Bug?  It doesn't seem to happen with lists of numbers.

Just a quick remark.  In Sage there is set (the builton Python type)
and Set (the Sage type, which wraps the builtin one):

sage: set(['a','b','c'])
set(['a', 'b', 'c'])
sage: Set(['a','b','c'])
{'a', 'c', 'b'}

My intention in introducting Set in addition to set, was to make
something that would have much more mathematical printing and
semantics than Python sets, in addition to allowing for infinite sets,
etc.  The underlying data structure for finite enumerated sets is just
a normal Python set:

sage: type(x._Set_object__object)
type 'frozenset'

I think it would be reasonable to change the _repr_ method to output
the elements in some natural order *if possible*. Right now, it just
does this:

def _repr_(self):
r
Return the string representation of ``self``.

EXAMPLES::

sage: S = EnumeratedSet(GF(2))
sage: S
{0, 1}

s = repr(self.set())
return { + s[5:-2] + }

This is in sage/sets/set.py

I think I would be OK with you changing this function to do something more like

   s = repr(sorted(list(self.set(

or something like that.   Obviously, there will be sets where elements
can't be compared, so sorting will raise an error -- this needs to be
caught.  There will also be a performance penalty, but we pay this
only for printing.

William

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---