[sage-support] Re: Installing optional R package on sagenb.org

2009-01-09 Thread ztnews

I had a similar failure today, trying to:

r.install_packages(adapt)

after some fussing, runing ./sage as root, and using the notebook
interface I could get through the download phase, but same sorts of
failures in just as the gcc kicks in.  Seems several of the key R
scripts have /home/wstein/...  hard wired in to R_HOME_XXX, which
obviously will fail.  I tried editing the R startup scripts (among
others) but couldn't get it to work.

BTW, I installed from the latest Debian tarball into a Debian/VMWARE
machine just today.  So installing R packages is still an issue.

  -  Cronin


William Stein wrote:
 On Fri, Jan 2, 2009 at 6:57 PM, kcrisman kcris...@gmail.com wrote:
 
  Dear support,
  Because I only have OSX and there is this scary warning about it in
  the documentation for r.install_packages (which incidentally the test
  for it has no s, but I don't know if that matters), I was trying to
  load one on the sagenb site.  Probably this is a gross violation of
  bandwidth or something,

 It will surely fail with a permission denied error at some point.  What
 package would you like to install?

  but anyway the surprise result under the R
  interface was
 
  install_packages(MASS)
  Error: could not find function install_packages

 Try typing

 r.install_packages(MASS)

 in a normal Sage input cell.  You probably forgot the quotes.

 Trying this on OS X it definitely fails for me.  There is this message:

 sage: r.install_packages(MASS)
 ** You are using OS X.  Unfortunately, the R optional package system
 currently doesn't support OS X very well.  We are working on this. **

 I wonder who the We refers to?  :-)

 I tried the above on sagenb.org (I'm the admin, so I have permissions).
 It seems to fail as well:

 s...@sagenb:~$ sage
 --
 | Sage Version 3.2.2, Release Date: 2008-12-18   |
 | Type notebook() for the GUI, and license() for information.|
 --
 sage: r.install_packages(MASS)
 0.00user 0.02system 0:00.03elapsed 82%CPU (0avgtext+0avgdata 0maxresident)k
 64inputs+0outputs (1major+209minor)pagefaults 0swaps

 R version 2.6.1 (2007-11-26)
 Copyright (C) 2007 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0

 R is free software and comes with ABSOLUTELY NO WARRANTY.
 You are welcome to redistribute it under certain conditions.
 Type 'license()' or 'licence()' for distribution details.

   Natural language support but running in an English locale

 R is a collaborative project with many contributors.
 Type 'contributors()' for more information and
 'citation()' on how to cite R or R packages in publications.

 Type 'demo()' for some demos, 'help()' for on-line help, or
 'help.start()' for an HTML browser interface to help.
 Type 'q()' to quit R.

  options(repos=http://cran.r-project.org/;); install.packages(MASS)
 trying URL 'http://cran.r-project.org/src/contrib/VR_7.2-45.tar.gz'
 Content type 'application/x-gzip' length 465054 bytes (454 Kb)
 opened URL
 ==
 downloaded 454 Kb

 WARNING: ignoring environment value of R_HOME
 /home/sage/sage/local/lib/R/library
 WARNING: ignoring environment value of R_HOME
 * Installing *source* package 'MASS' ...
 ** libs
 gcc -std=gnu99 -I/home/sage/sage/local/lib/R/include
 -I/home/sage/sage/local/lib/R/include  -I/home/sage/sage/local/inlcude
 WARNING: ignoring environment value of R_HOME   -fpic
 -I/home/sage/sage/local/include -L/home/sage/sage/local/lib/  -c lqs.c
 -o lqs.o
 gcc: WARNING:: No such file or directory
 gcc: ignoring: No such file or directory
 gcc: environment: No such file or directory
 gcc: value: No such file or directory
 gcc: of: No such file or directory
 gcc: R_HOME: No such file or directory
 make: *** [lqs.o] Error 1
 ERROR: compilation failed for package 'MASS'
 ** Removing '/home/sage/sage/local/lib/R/library/MASS'
 ** Removing '/home/sage/sage/local/lib/R/library/class'
 ** Removing '/home/sage/sage/local/lib/R/library/nnet'
 ** Removing '/home/sage/sage/local/lib/R/library/spatial'

 The downloaded packages are in
   /tmp/RtmpoUnbs5/downloaded_packages
 Updating HTML index of packages in '.Library'
 Warning message:
 In install.packages(MASS) :
   installation of package 'VR' had non-zero exit status
 



 
  which was surprising since tab-completion was how I found this
  function in the first place.  I also got this in the Sage interface
  with r.install_packages.
 
  If anyone knows how I might do this, or if it's not good to do, or
  whether my Mac will actually allow me to install the optional package
  after all, OR whether Sage actually includes these by default (which
  doesn't seem to be the case, but I might have typed something wrong),
  I would greatly appreciate any information you might have.
 
  Thanks!
  - kcrisman
  
 



 --
 William Stein
 Associate Professor of Mathematics
 

[sage-support] question about solve() function

2009-01-09 Thread Sand Wraith

Hi!

Is it possible to get order of root of equation? For example equation:

f(x)=(x+1)^2
and it's solution solve(f,x) will be [x == -1], but this is not
perfect clear, because x==-1 have second order. This equation actually
must have two same roots: [x == -1,x == -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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: question about solve() function

2009-01-09 Thread William Stein

On Fri, Jan 9, 2009 at 3:49 AM, Sand Wraith omegat...@gmail.com wrote:

 Hi!

 Is it possible to get order of root of equation? For example equation:

 f(x)=(x+1)^2
 and it's solution solve(f,x) will be [x == -1], but this is not
 perfect clear, because x==-1 have second order. This equation actually
 must have two same roots: [x == -1,x == -1].

Use the roots command:

sage: f = (x + 1)^2
sage: f.roots()
[(-1, 2)]

The 2 is the multiplicity.

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



[sage-support] Re: Installing optional R package on sagenb.org

2009-01-09 Thread William Stein

On Fri, Jan 9, 2009 at 1:19 AM, ztnews cronin.vin...@gmail.com wrote:

 I had a similar failure today, trying to:

 r.install_packages(adapt)

 after some fussing, runing ./sage as root, and using the notebook
 interface I could get through the download phase, but same sorts of
 failures in just as the gcc kicks in.  Seems several of the key R
 scripts have /home/wstein/...  hard wired in to R_HOME_XXX, which
 obviously will fail.  I tried editing the R startup scripts (among
 others) but couldn't get it to work.

 BTW, I installed from the latest Debian tarball into a Debian/VMWARE
 machine just today.  So installing R packages is still an issue.

  -  Cronin

I made this trac #4959:

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

Michael -- I hope there wasn't already a ticket for this in trac --
it's impossible to search for r.
I couldn't find anything under install_packages.



 William Stein wrote:
 On Fri, Jan 2, 2009 at 6:57 PM, kcrisman kcris...@gmail.com wrote:
 
  Dear support,
  Because I only have OSX and there is this scary warning about it in
  the documentation for r.install_packages (which incidentally the test
  for it has no s, but I don't know if that matters), I was trying to
  load one on the sagenb site.  Probably this is a gross violation of
  bandwidth or something,

 It will surely fail with a permission denied error at some point.  What
 package would you like to install?

  but anyway the surprise result under the R
  interface was
 
  install_packages(MASS)
  Error: could not find function install_packages

 Try typing

 r.install_packages(MASS)

 in a normal Sage input cell.  You probably forgot the quotes.

 Trying this on OS X it definitely fails for me.  There is this message:

 sage: r.install_packages(MASS)
 ** You are using OS X.  Unfortunately, the R optional package system
 currently doesn't support OS X very well.  We are working on this. **

 I wonder who the We refers to?  :-)

 I tried the above on sagenb.org (I'm the admin, so I have permissions).
 It seems to fail as well:

 s...@sagenb:~$ sage
 --
 | Sage Version 3.2.2, Release Date: 2008-12-18   |
 | Type notebook() for the GUI, and license() for information.|
 --
 sage: r.install_packages(MASS)
 0.00user 0.02system 0:00.03elapsed 82%CPU (0avgtext+0avgdata 0maxresident)k
 64inputs+0outputs (1major+209minor)pagefaults 0swaps

 R version 2.6.1 (2007-11-26)
 Copyright (C) 2007 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0

 R is free software and comes with ABSOLUTELY NO WARRANTY.
 You are welcome to redistribute it under certain conditions.
 Type 'license()' or 'licence()' for distribution details.

   Natural language support but running in an English locale

 R is a collaborative project with many contributors.
 Type 'contributors()' for more information and
 'citation()' on how to cite R or R packages in publications.

 Type 'demo()' for some demos, 'help()' for on-line help, or
 'help.start()' for an HTML browser interface to help.
 Type 'q()' to quit R.

  options(repos=http://cran.r-project.org/;); install.packages(MASS)
 trying URL 'http://cran.r-project.org/src/contrib/VR_7.2-45.tar.gz'
 Content type 'application/x-gzip' length 465054 bytes (454 Kb)
 opened URL
 ==
 downloaded 454 Kb

 WARNING: ignoring environment value of R_HOME
 /home/sage/sage/local/lib/R/library
 WARNING: ignoring environment value of R_HOME
 * Installing *source* package 'MASS' ...
 ** libs
 gcc -std=gnu99 -I/home/sage/sage/local/lib/R/include
 -I/home/sage/sage/local/lib/R/include  -I/home/sage/sage/local/inlcude
 WARNING: ignoring environment value of R_HOME   -fpic
 -I/home/sage/sage/local/include -L/home/sage/sage/local/lib/  -c lqs.c
 -o lqs.o
 gcc: WARNING:: No such file or directory
 gcc: ignoring: No such file or directory
 gcc: environment: No such file or directory
 gcc: value: No such file or directory
 gcc: of: No such file or directory
 gcc: R_HOME: No such file or directory
 make: *** [lqs.o] Error 1
 ERROR: compilation failed for package 'MASS'
 ** Removing '/home/sage/sage/local/lib/R/library/MASS'
 ** Removing '/home/sage/sage/local/lib/R/library/class'
 ** Removing '/home/sage/sage/local/lib/R/library/nnet'
 ** Removing '/home/sage/sage/local/lib/R/library/spatial'

 The downloaded packages are in
   /tmp/RtmpoUnbs5/downloaded_packages
 Updating HTML index of packages in '.Library'
 Warning message:
 In install.packages(MASS) :
   installation of package 'VR' had non-zero exit status
 



 
  which was surprising since tab-completion was how I found this
  function in the first place.  I also got this in the Sage interface
  with r.install_packages.
 
  If anyone knows how I might do this, or if it's not good to do, or
  whether my Mac will actually allow me to install the optional 

[sage-support] Re: why doesn`t solve() give a proper answer

2009-01-09 Thread Robert Dodier

On Jan 9, 6:51 am, Slava slava_se...@mail.ru wrote:

 I`m trying to solve such simple system of equations: [sqrt(x) == 1, x
 == y],
 so I type:

 x,y = var('x,y');
 solve([sqrt(x) == 1, x == y], x, y);

 the answer is: []

If I understand correctly, Sage punts to Maxima to solve equations.
Maxima's built-in solver is not too strong. There is an add-on package
which can solve equations which contain radicals. Dunno how to call
it from Sage, but in Maxima itself it's like this:

load (topoly_solver);
to_poly_solve ([sqrt(x) = 1, x = y], [x, y]);
 = [[x = 1, y = 1]]

Maybe at some point in the not-too-distant future, the built-in
solver would call to_poly_solve automatically 

HTH

Robert Dodier

--~--~-~--~~~---~--~~
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: why doesn`t solve() give a proper answer

2009-01-09 Thread William Stein

On Fri, Jan 9, 2009 at 9:01 AM, Robert Dodier robert.dod...@gmail.com wrote:

 On Jan 9, 6:51 am, Slava slava_se...@mail.ru wrote:

 I`m trying to solve such simple system of equations: [sqrt(x) == 1, x
 == y],
 so I type:

 x,y = var('x,y');
 solve([sqrt(x) == 1, x == y], x, y);

 the answer is: []

 If I understand correctly, Sage punts to Maxima to solve equations.
 Maxima's built-in solver is not too strong. There is an add-on package
 which can solve equations which contain radicals. Dunno how to call
 it from Sage, but in Maxima itself it's like this:

 load (topoly_solver);
 to_poly_solve ([sqrt(x) = 1, x = y], [x, y]);
  = [[x = 1, y = 1]]

 Maybe at some point in the not-too-distant future, the built-in
 solver would call to_poly_solve automatically 

That would be nice.  Here's doing the above in sage:

sage: x,y=var('x,y')
sage: v = [sqrt(x)==1, x==y]
sage: w = maxima(v)
sage: maxima.load('topoly_solver')
sage: w.to_poly_solve([x,y])
[[x=1,y=1]]

There's currently no simple code in sage to turn the output of
to_poly_solve into  native sage objects.

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



[sage-support] Re: why doesn`t solve() give a proper answer

2009-01-09 Thread William Stein

On Fri, Jan 9, 2009 at 9:05 AM, William Stein wst...@gmail.com wrote:
 On Fri, Jan 9, 2009 at 9:01 AM, Robert Dodier robert.dod...@gmail.com wrote:

 On Jan 9, 6:51 am, Slava slava_se...@mail.ru wrote:

 I`m trying to solve such simple system of equations: [sqrt(x) == 1, x
 == y],
 so I type:

 x,y = var('x,y');
 solve([sqrt(x) == 1, x == y], x, y);

 the answer is: []

 If I understand correctly, Sage punts to Maxima to solve equations.
 Maxima's built-in solver is not too strong. There is an add-on package
 which can solve equations which contain radicals. Dunno how to call
 it from Sage, but in Maxima itself it's like this:

 load (topoly_solver);
 to_poly_solve ([sqrt(x) = 1, x = y], [x, y]);
  = [[x = 1, y = 1]]

 Maybe at some point in the not-too-distant future, the built-in
 solver would call to_poly_solve automatically 

 That would be nice.  Here's doing the above in sage:

 sage: x,y=var('x,y')
 sage: v = [sqrt(x)==1, x==y]
 sage: w = maxima(v)
 sage: maxima.load('topoly_solver')
 sage: w.to_poly_solve([x,y])
 [[x=1,y=1]]

 There's currently no simple code in sage to turn the output of
 to_poly_solve into  native sage objects.


I should correct myself and say it doesn't have any trivial to use
function to do that.  Of course we wrote code to do that when
implementing our solve command (which does work as you suggest above).

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



[sage-support] Problem Running with nohup on OSX.5

2009-01-09 Thread Tom


I'm having difficulty running Sage in the background on a Mac with OSX.
5 and getting the output saved in a file.  I tried a few permutations
with different results so I expect I'm making a silly error.   Here's
what I've seen.
Since the program runs fine in some of the scenarios, I don't think
the program (which I call commands.sage) is the problem (I've made
it simpler and simpler without any change in the results).  Any help
would be appreciated.

Thanks,
Tom

0.  If I run Sage (from the command line) and type

load commands.sage

then the program runs fine.


1.  If I run

nohup ./sage  commands.sage  results.txt 

the file results.txt will just contain the initial startup messages
from Sage, but nothing more.


2.  If I run
./sage  commands.sage  results.txt

all the output is correctly written to results.txt.   The only problem
is that I can't close the terminal session and let Sage run in the
background.


3. If I run

./sage  commands.sage

I get the initial startup message, but nothing else written to screen
or any file.


4.  If I create a file intro.sage with the one line

load commands.sage

and then run

./sage  intro.sage

then the program runs and the output is sent to the screen.


5.  If I run

nohup ./sage  intro.sage  results.txt 

the file results.txt will just contain the initial startup messages
from Sage, but nothing more.


--~--~-~--~~~---~--~~
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 with nohup on OSX.5

2009-01-09 Thread Carl Witty

On Jan 9, 1:53 pm, Tom haged...@tcnj.edu wrote:
 I'm having difficulty running Sage in the background on a Mac with OSX.
 5 and getting the output saved in a file.  I tried a few permutations
 with different results so I expect I'm making a silly error.   Here's
 what I've seen.
 Since the program runs fine in some of the scenarios, I don't think
 the program (which I call commands.sage) is the problem (I've made
 it simpler and simpler without any change in the results).  Any help
 would be appreciated.

 Thanks,
 Tom

 0.  If I run Sage (from the command line) and type

 load commands.sage

 then the program runs fine.

 1.  If I run

 nohup ./sage  commands.sage  results.txt 

 the file results.txt will just contain the initial startup messages
 from Sage, but nothing more.

 2.  If I run
 ./sage  commands.sage  results.txt

 all the output is correctly written to results.txt.   The only problem
 is that I can't close the terminal session and let Sage run in the
 background.

 3. If I run

 ./sage  commands.sage

 I get the initial startup message, but nothing else written to screen
 or any file.

 4.  If I create a file intro.sage with the one line

 load commands.sage

 and then run

 ./sage  intro.sage

 then the program runs and the output is sent to the screen.

 5.  If I run

 nohup ./sage  intro.sage  results.txt 

 the file results.txt will just contain the initial startup messages
 from Sage, but nothing more.

It seems to be working for me with:

  nohup ./sage mytest.sage  /dev/null  results.txt 

So I gave the command file as a command-line argument, instead of on
standard input; and I made sure to redirect standard input from /dev/
null.  I also had to avoid the name commands.sage, because that
conflicts with a module Commands that's part of Sage (via IPython).

Carl
--~--~-~--~~~---~--~~
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] the set containing the empty set

2009-01-09 Thread John H Palmieri

Is this a bug?

sage: Set([])
{}
sage: Set(Set([]))
{}
sage: Set([]) == Set(Set([]))
True

In general, are Sage Sets supposed to behave like mathematical sets?

--~--~-~--~~~---~--~~
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: the set containing the empty set

2009-01-09 Thread Mike Hansen

On Fri, Jan 9, 2009 at 3:36 PM, John H Palmieri jhpalmier...@gmail.com wrote:

 Is this a bug?

 sage: Set([])
 {}
 sage: Set(Set([]))
 {}
 sage: Set([]) == Set(Set([]))
 True

This is because Set takes a list (iterable) for all the of the
elements of the set.  So, if you want to construct the set containing
the empty set, you'd do the following:

sage: e = Set([])
sage: ee = Set([e])
sage: e
{}
sage: ee
{{}}
sage: e == ee
False

--Mike

--~--~-~--~~~---~--~~
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: the set containing the empty set

2009-01-09 Thread John H Palmieri



On Jan 9, 3:40 pm, William Stein wst...@gmail.com wrote:
 On Fri, Jan 9, 2009 at 3:38 PM, Mike Hansen mhan...@gmail.com wrote:

  On Fri, Jan 9, 2009 at 3:36 PM, John H Palmieri jhpalmier...@gmail.com 
  wrote:

  Is this a bug?

  sage: Set([])
  {}
  sage: Set(Set([]))
  {}
  sage: Set([]) == Set(Set([]))
  True

  This is because Set takes a list (iterable) for all the of the
  elements of the set.  So, if you want to construct the set containing
  the empty set, you'd do the following:

  sage: e = Set([])
  sage: ee = Set([e])
  sage: e
  {}
  sage: ee
  {{}}
  sage: e == ee
  False

 Yep.  Think coercion -- Set(foo) makes foo into a set.
 It doesn't make the set containing foo.

Oh, I should have figured that out.

Here's another question: what is the most efficient way of testing
whether one Set is a subset of another?  I can do

S in list(T.subsets())

-- and it's a bit frustrating that I can't do S in T.subsets() -- and
I can also manipulate intersections, unions, differences, etc. I can
also convert to python sets and use =.  Is there a preferred way?

  John


--~--~-~--~~~---~--~~
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: the set containing the empty set

2009-01-09 Thread William Stein

On Fri, Jan 9, 2009 at 6:42 PM, John H Palmieri jhpalmier...@gmail.com wrote:



 On Jan 9, 3:40 pm, William Stein wst...@gmail.com wrote:
 On Fri, Jan 9, 2009 at 3:38 PM, Mike Hansen mhan...@gmail.com wrote:

  On Fri, Jan 9, 2009 at 3:36 PM, John H Palmieri jhpalmier...@gmail.com 
  wrote:

  Is this a bug?

  sage: Set([])
  {}
  sage: Set(Set([]))
  {}
  sage: Set([]) == Set(Set([]))
  True

  This is because Set takes a list (iterable) for all the of the
  elements of the set.  So, if you want to construct the set containing
  the empty set, you'd do the following:

  sage: e = Set([])
  sage: ee = Set([e])
  sage: e
  {}
  sage: ee
  {{}}
  sage: e == ee
  False

 Yep.  Think coercion -- Set(foo) makes foo into a set.
 It doesn't make the set containing foo.

 Oh, I should have figured that out.

 Here's another question: what is the most efficient way of testing
 whether one Set is a subset of another?  I can do

S in list(T.subsets())

 -- and it's a bit frustrating that I can't do S in T.subsets() -- and
 I can also manipulate intersections, unions, differences, etc. I can
 also convert to python sets and use =.  Is there a preferred way?


There should be an is_subset method, but mysteriously there isn't.   Implement
it and send a patch.

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