[sage-support] Re: Using multiple cores with Sage under VMWare Player

2009-06-08 Thread James Parson

>
> Here's a really dumb thing you could do.
>
> (1) Make a copy of sage-vmware-* to another directory.
>
> (2) Run both vmware's at the same time.
>
> That'll definitely use both cores on your computer.

Indeed! That's what I ended up doing this afternoon. I had VMWare
Workstation make a clone of my Sage virtual machine. For some reason,
when I tried simply making a copy of Sage in another directory (before
I tried Workstation), I couldn't get it to run. Whenever I tried to
start it up a second copy, something would flash on the screen,
vanishing before I could read it, and the notebook system would not
run. Probably I was doing something foolish.

Is there any direct way to share Sage worksheets between two virtual
machines, or is it simplest to save the files from one system and load
them into another?


Thanks again,

James Parson
--~--~-~--~~~---~--~~
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: Coercion into power series ring

2009-06-08 Thread Kwankyu

I tried change_ring(), without success...

sage: R.=PowerSeriesRing(QQ)
sage: P.=PolynomialRing(R)
sage: f=t*x+t^2
sage: g=f/t
sage: f
t*x + t^2
sage: g
x + t
sage: f.parent()
Univariate Polynomial Ring in x over Power Series Ring in t over
Rational Field
sage: g.parent()
Univariate Polynomial Ring in x over Laurent Series Ring in t over
Rational Field
sage: g.change_ring(R)
---
TypeError Traceback (most recent call
last)
...
TypeError: Unable to coerce t () to Rational
sage:

Now I am forced to extract coefficients of g, and reconstruct g with
the right base ring. Or I may live with laurent series base ring.
--~--~-~--~~~---~--~~
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 multiple cores with Sage under VMWare Player

2009-06-08 Thread William Stein

2009/6/8 James Parson :
>
>> You might have to use vmware workstation in order to configure the
>> virtual machine to use more than 1 core:
>>
>>  http://www.vmware.com/products/ws/
>>
>> It costs money, but there is an easy 1-month free trial.  You could try
>> that in order to tell whether multiple cores will work with the
>> virtual machine.
>
> Thanks for your suggestion. I downloaded the trial version of
> Workstation, and I was able to change a "Processor" setting so that
> VMWare Workstation said that it was using 2 processors. Even after
> that change, though, if I started two worksheets with independent
> calculations, they still ran on just one core. Do you have any other
> thoughts?
>

Here's a really dumb thing you could do.

(1) Make a copy of sage-vmware-* to another directory.

(2) Run both vmware's at the same time.

That'll definitely use both cores on your computer.

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: Folders to organise worksheets

2009-06-08 Thread kilucas



On Jun 4, 9:44 am, William Stein  wrote:
> On Thu, Jun 4, 2009 at 1:36 AM, kilucas  wrote:
>
> > As a set of worksheets grows I feel I need to organise them into my
> > own folder structure. On sagenb I can see Active, Archived and Trash
> > folders for worksheets but can't spot a way to create my own folders
> > or navigate such a folder structure afterwards. Can I do this (and
> > especially - can I do this as an online worksheet user without
> > resorting to to the sage command line) and if so how please? Or should
> > I organise my worksheets in some other way perhaps?
>
> Unfortunately, there is currently no support for folders in the Sage
> notebook.  Nobody has had a chance to implement it yet.   However,
> Mike Hansen is currently planning to implement both folders and labels
> for the Sage notebook in the immediate future.
>
> So stay tuned!
>
> In the meantime, I tend to put a keyword in the title of a collection
> of related worksheets, then use the search box in the upper right to
> view only those worksheets.
>

V helpful. Thanks.

> William
>
>
>
> > Many thanks for any clues you can give.
>
> > Kevin
>
> --
> William Stein
> Associate Professor of Mathematics
> University of Washingtonhttp://wstein.org
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: element-wise multiplication of matrices

2009-06-08 Thread Jason Grout

kcrisman wrote:
> 
> 
>> This is based on the code developed in the 
>> threadhttp://groups.google.com/group/sage-devel/browse_thread/thread/100de8...
>>
>> (that code probably should get into Sage; it makes some calculations
>> very, very easy to write down...)
>>
>> The trac ticket for incorporating this decorator 
>> ishttp://trac.sagemath.org/sage_trac/ticket/6245
> 
> There are lots of good uses for something like this, e.g. I could have
> used this for teaching Dirichlet products this past semester.  If
> something like this ever got into Sage, would it only be for "private"


If you polish it up into a patch, I'll review it (so hopefully it gets 
into 4.0.2)!  Hmmm...or maybe I shouldn't review it, being one of the 
authors...



> use as detailed above, or could some custom infix operators
> potentially become standard like the backslash, which only works for
> things with the _backslash_ defined (presumably only matrix/vector
> combos)?


Only time will tell.  I think it's safe to say it would be available for 
private use.  Frankly, I'm a bit surprised that we have the backslash 
operator.  It's a bow to matlab (I assume), but there are lots and lots 
of other matlab operators we don't have.  Sage has (rightfully) been 
very conservative about language additions.

However, I can see a sage.misc.infix module (or even specific modules, 
like sage.graphs.infix) containing a bunch of nice infix operators, not 
defined by default, but that someone could then import.  That would help 
standardize some things if people used them a lot.

Jason



-- 
Jason Grout


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



[sage-support] sage -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 "", 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: element-wise multiplication of matrices

2009-06-08 Thread kcrisman



> This is based on the code developed in the 
> threadhttp://groups.google.com/group/sage-devel/browse_thread/thread/100de8...
>
> (that code probably should get into Sage; it makes some calculations
> very, very easy to write down...)
>
> The trac ticket for incorporating this decorator 
> ishttp://trac.sagemath.org/sage_trac/ticket/6245

There are lots of good uses for something like this, e.g. I could have
used this for teaching Dirichlet products this past semester.  If
something like this ever got into Sage, would it only be for "private"
use as detailed above, or could some custom infix operators
potentially become standard like the backslash, which only works for
things with the _backslash_ defined (presumably only matrix/vector
combos)?

- 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] Re: Using multiple cores with Sage under VMWare Player

2009-06-08 Thread James Parson

> You might have to use vmware workstation in order to configure the
> virtual machine to use more than 1 core:
>
>  http://www.vmware.com/products/ws/
>
> It costs money, but there is an easy 1-month free trial.  You could try
> that in order to tell whether multiple cores will work with the
> virtual machine.

Thanks for your suggestion. I downloaded the trial version of
Workstation, and I was able to change a "Processor" setting so that
VMWare Workstation said that it was using 2 processors. Even after
that change, though, if I started two worksheets with independent
calculations, they still ran on just one core. Do you have any other
thoughts?


Thanks again,

James Parson
--~--~-~--~~~---~--~~
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: Removing objects from lists; keeping original list unchanged?

2009-06-08 Thread Justin C. Walker


On Jun 8, 2009, at 06:44 , Alasdair wrote:

> This is more of a python question than a Sage question, but
> anyway...

FYI, the Python site has plenty of documentation; the Library  
reference manual would have provided the answer.

> I'm trying to iterate over a list, producing a sequence of
> new lists, each of which is obtained from the original list by
> deleting one object.  I've tried:
>
> for x in lst:
>   lstc=copy(lst)
>   print lstc.remove(x)
>
> But this doesn't work - can anybody tell me what I'm doing wrong, and
> what I should be doing?

The first thing to know is that it helps us to diagnose the problems  
you are having if you provide some indication of what "it doesn't  
work" means.  In particular, what is not happening that should, or  
what is happening that should not.

> I can get the effect I want by iterating over
> the indices of the list, but I'd like to know why this little snippet
> of code doesn't work.

You are incorrectly assuming that lstc.remove() returns a value.  It  
does not.  The remove() method modifies the input list.  This should  
do what you want:

for x in lst:
 lstc = copy(lst)
 lstc.remove(x)
 print lstc

HTH

Justin

--
Justin C. Walker
Curmudgeon-at-large
Director
Institute for the Absorption of Federal Funds

186,000 Miles per Second
Not just a good idea:
   it's the law!



--~--~-~--~~~---~--~~
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: Removing objects from lists; keeping original list unchanged?

2009-06-08 Thread Alasdair

Thanks for that!  Only a little thing, but I was getting very
confused.

-A.

On Jun 9, 12:01 am, Jason Bandlow  wrote:
> Alasdair wrote:
> > This is more of a python question than a Sage question, but
> > anyway...I'm trying to iterate over a list, producing a sequence of
> > new lists, each of which is obtained from the original list by
> > deleting one object.  I've tried:
>
> > for x in lst:
> >    lstc=copy(lst)
> >    print lstc.remove(x)
>
> > But this doesn't work - can anybody tell me what I'm doing wrong, and
> > what I should be doing?  I can get the effect I want by iterating over
> > the indices of the list, but I'd like to know why this little snippet
> > of code doesn't work.
>
> The problem is that
>
>     lstc.remove(x)
>
> modifies lstc in place and doesn't return anything.  So you aren't
> printing anything.  The following should do what you want:
>
> for x in lst:
>     lstc = copy(lst)
>     lstc.remove(x)
>     print lstc
>
> HTH,
> Jason
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/sage-support?hl=en
-~--~~~~--~~--~--~---



[sage-support] Re: Removing objects from lists; keeping original list unchanged?

2009-06-08 Thread simon . king

Hi Alasdair,

I understand that you mean
  sage: lst=[[1,2],[3,4],[5,6]]
  sage: for x in lst:
  : lstc=copy(lst)
  : lstc.remove(x)
  : print lstc
  :
  [[3, 4], [5, 6]]
  [[1, 2], [5, 6]]
  [[1, 2], [3, 4]]

Probably you got onle "None" printed. This is because the return value
of lstc.remove(x) is None. The remove() method changes the list in
place.

Best regards,
  Simon

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



[sage-support] Re: Removing objects from lists; keeping original list unchanged?

2009-06-08 Thread Jason Bandlow

Alasdair wrote:
> This is more of a python question than a Sage question, but
> anyway...I'm trying to iterate over a list, producing a sequence of
> new lists, each of which is obtained from the original list by
> deleting one object.  I've tried:
> 
> for x in lst:
>lstc=copy(lst)
>print lstc.remove(x)
> 
> But this doesn't work - can anybody tell me what I'm doing wrong, and
> what I should be doing?  I can get the effect I want by iterating over
> the indices of the list, but I'd like to know why this little snippet
> of code doesn't work.

The problem is that

lstc.remove(x)

modifies lstc in place and doesn't return anything.  So you aren't
printing anything.  The following should do what you want:

for x in lst:
lstc = copy(lst)
lstc.remove(x)
print lstc

HTH,
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] Removing objects from lists; keeping original list unchanged?

2009-06-08 Thread Alasdair

This is more of a python question than a Sage question, but
anyway...I'm trying to iterate over a list, producing a sequence of
new lists, each of which is obtained from the original list by
deleting one object.  I've tried:

for x in lst:
   lstc=copy(lst)
   print lstc.remove(x)

But this doesn't work - can anybody tell me what I'm doing wrong, and
what I should be doing?  I can get the effect I want by iterating over
the indices of the list, but I'd like to know why this little snippet
of code doesn't work.

Thanks,
Alasdair
--~--~-~--~~~---~--~~
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: Coercion into power series ring

2009-06-08 Thread Kwankyu

A comparable case works well.

sage: S.=ZZ[]
sage: f=2*x+4;
sage: f/2
x + 2
sage: S(f/2).parent()
Univariate Polynomial Ring in x over Integer Ring


--~--~-~--~~~---~--~~
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 4.0 can be installed on ubuntu 8.04?

2009-06-08 Thread ccandide



On 8 juin, 03:25, Bruce Cohen  wrote:
> I installed this binary:
> sage-4.0-linux-Debian_GNU_Linux_4.0_etch-sse2-i686-Linux
> on my ubuntu 8.04 machine.  


For information : wich processor ? how many RAM ?

--~--~-~--~~~---~--~~
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: element-wise multiplication of matrices

2009-06-08 Thread Jason Grout

Dan Drake wrote:
> On Sun, 07 Jun 2009 at 11:12AM -0700, paramaniac wrote:
>> Is there a possibility/workaround in Sage to compute the element-wise
>> multiplication of two matrices? In Matlab there's the .* operator, but
>> Matlab is useless in my case since I need a symbolic result.
> 
> There's no operator that I know of for that, but you can convert your
> matrices to lists, multiply, and convert back:
> 
> sage: x,y,z,w = var('x y z w')
> sage: a = matrix(SR, 2, 2, [x, y, z, w])
> sage: b = matrix(SR, 2, 2, [1+x, 1+y, 1+z, 1+w])
> sage: a.list()
> [x, y, z, w]
> sage: b.list()
> [x + 1, y + 1, z + 1, w + 1]
> 
> Now make a list of corresponding pairs of entries with zip() and
> multiply:
> 
> sage: [ x*y for x, y in zip(a.list(), b.list()) ]
> [(x + 1)*x, (y + 1)*y, (z + 1)*z, (w + 1)*w]
> 
> ...and make a matrix out of the new list:
> 
> sage: matrix(2, 2, [ x*y for x, y in zip(a.list(), b.list()) ])
> 
> [(x + 1)*x (y + 1)*y]
> [(z + 1)*z (w + 1)*w]
> 
> You can easily put that sequence of steps into a function. You may need
> to fiddle a bit with the rows and columns bits, and maybe add a ring
> argument if you need to specify what ring the matrix should be over.
> 
> def componentwise_multiply(a, b, rows, cols):
> return matrix(rows, cols, [x*y for x, y in zip(a.list(), b.list())])

You can also turn this into a custom infix operator, if you want.  That 
would mean that your code would depend on a definition, but it could 
make your function a lot easier to use.  See 
http://sagenb.org/home/pub/565 for an example using the above code. 
This is based on the code developed in the thread 
http://groups.google.com/group/sage-devel/browse_thread/thread/100de89e7d402134/fe89570b403344ae
 


(that code probably should get into Sage; it makes some calculations 
very, very easy to write down...)

The trac ticket for incorporating this decorator is 
http://trac.sagemath.org/sage_trac/ticket/6245

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] code breakage due to upgrade to sage 4.0

2009-06-08 Thread Stan Schymanski

Dear all,

I noticed that some of my old code does not work any more with sage
4.0.
I used to assign the solutions of equations by referring to them in
the following way:

--
| Sage Version 4.0, Release Date: 2009-05-29 |
| Type notebook() for the GUI, and license() for information.|
--
sage: var('x y')
(x, y)
sage: soln = solve(y == x^3 -2, x)
sage: x1 = soln[0][2]
---
TypeError Traceback (most recent call
last)

/Users/sschym/ in ()

TypeError: 'sage.symbolic.expression.Expression' object is unindexable

This works now:
sage: x1 = soln[0].rhs()
sage: x1
1/2*(I*sqrt(3) - 1)*(y + 2)^(1/3)

Is there a way to make soln[0][2] work again? Otherwise I would have
to change most of my notebooks!

Another issue is that the substitute command now expects dictionary
entries without quotations, so that my previous use of the subs
command does not work any more:

sage: pars = dict(y=2)
sage: pars
{'y': 2}
sage: x1.subs(pars)
---
TypeError Traceback (most recent call
last)
...

This works now:

sage: x1.subs({y:2})
1/2*(I*sqrt(3) - 1)*4^(1/3)

Is there an easy way of getting my old notebooks to work with Sage
4.0? Is there an easy way to create dictionaries without the
quotations for use in subs()??

Thanks for your help!

Stan


--~--~-~--~~~---~--~~
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] Coercion into power series ring

2009-06-08 Thread Kwankyu

Hi,

See this:

sage: R.=PowerSeriesRing(QQ)
sage: P.=PolynomialRing(R)
sage: f=(x*t+t^2)/t
sage: f
x + t
sage: P(f)
---
TypeError Traceback (most recent call
last)
...
TypeError: Unable to coerce t () to Rational
sage: f.parent()
Univariate Polynomial Ring in x over Laurent Series Ring in t over
Rational Field

What is a convenient way to coerce f into P?


Kwankyu
--~--~-~--~~~---~--~~
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: element-wise multiplication of matrices

2009-06-08 Thread paramaniac

Thank you for the fast response!

Regards,
Lukas
--~--~-~--~~~---~--~~
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: element-wise multiplication of matrices

2009-06-08 Thread paramaniac

Thank you for the fast response!

Regards,
Lukas
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---