[sage-support] noob q: working directory

2011-09-02 Thread Anton Sherwood
Hi everybody.

In the tutorial:
Alternatively, evaluating c.save('filename.png')
will save the plot to the given file.

I tried it, then searched my disk for the relevant filename
with no result.  Is it a bug?  What directory ought it to be in?
If I try to read in a file, what is the base directory?

...
Also: ARGH.  Google Groups won't let me register with my preferred
address (bro...@pobox.com).

-- 
Anton Sherwood *\\* www.bendwavy.org *\\* www.zazzle.com/tamfang

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


[sage-support] Re: How make typesetting be the default in all notebooks?

2011-09-02 Thread Jason Grout

On 9/2/11 7:24 PM, Chris Seberino wrote:

If you alter typsetting with pretty_print_default, then it works fine
but it does not magically
add/remove the check in the checkbox of the worksheet.

In other words, adding prety_print_default() to init.sage works but
the worksheet still shows an unchecked Typeset box in a new worksheet
which may confuse some users.

I suppose a fix would require pretty_print_default invocations
triggering some javascript code to add/remove the check?  I don't
know.


Yep.  That's a known bug, though I don't know if there is a trac ticket 
for it.  Of course, patches are welcome.  I think you're right; somehow 
a message has to get to the notebook to uncheck/check the box.


Jason


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


[sage-support] Re: How make typesetting be the default in all notebooks?

2011-09-02 Thread Chris Seberino


On Sep 2, 6:49 pm, Jason Grout  wrote:

> Type pretty_print_default() in an input cell and press shift-enter. All
> future output will be typeset automatically.
>
> Can you try to put pretty_print_default() in the init.sage and see if
> that works?

Jason

Thankfully that works great.  There is one potential tiny bug fyi I
found

If you alter typsetting with pretty_print_default, then it works fine
but it does not magically
add/remove the check in the checkbox of the worksheet.

In other words, adding prety_print_default() to init.sage works but
the worksheet still shows an unchecked Typeset box in a new worksheet
which may confuse some users.

I suppose a fix would require pretty_print_default invocations
triggering some javascript code to add/remove the check?  I don't
know.

Sincerely,

Chris

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


[sage-support] Re: How make typesetting be the default in all notebooks?

2011-09-02 Thread Jason Grout

On 9/2/11 3:51 PM, Chris Seberino wrote:



On Sep 2, 3:20 pm, William Stein  wrote:

Unfortunately, I don't think there is support for this feature at present.
If there were, it would likely be implemented via the Settings link in
the notebook for a given user.


Just to make sure we are talking about the same thing

So there is nothing I can add to init.sage that is equivalent to
clicking the Typeset checkbox in a worksheet?


When you click "Help" in the notebook, searching the page for "Typeset" 
leads to this:



Type pretty_print_default() in an input cell and press shift-enter. All 
future output will be typeset automatically.



Can you try to put pretty_print_default() in the init.sage and see if 
that works?


Thanks,

Jason


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


Re: [sage-support] Re: Bug in Graph.is_chordal

2011-09-02 Thread Nathann Cohen
> Consider: g = graph({1:[2,3,4,5],2:[3,5],4:[3,5]}).

Hahahahhahaaha ! Dead right :-)

And the code works anyway because the tree it returns actually is *NOT* a
BFS tree :-)

sage: g.lex_BFS(tree = True)[1].edges()
[(2, 1, None), (3, 2, None), (4, 5, None), (5, 2, None)]

Two (obvious) black patches in my previous proof :
* It totally ignores the edges between classes of vertices with the same
distance to the source -- precisely what your counter-example destroys.
* without considering "the last neighbor of v discovered before v itself",
its process does not ensure that the neighborhood of a removed vertex is
indeed simplicial. Very bad indeed :-)

For a time I thought I would be able to patch my proof, but in the end I
don't get how this recognition algorithm works... Which is a pity because I
am sure I had found a clear explanation in a paper when I implemented all
that stuff. What I need right now is some sleep though. Sounds like this
will really require a patch :-)

Thank you for your perseverance ! At the least I enjoyed the time thinking
of this algorithm again and (re ?)-learned a few nice tricks ;-)

Good night !

Nathann

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


[sage-support] Re: How make typesetting be the default in all notebooks?

2011-09-02 Thread Chris Seberino


On Sep 2, 3:20 pm, William Stein  wrote:
> Unfortunately, I don't think there is support for this feature at present.
> If there were, it would likely be implemented via the Settings link in
> the notebook for a given user.

Just to make sure we are talking about the same thing

So there is nothing I can add to init.sage that is equivalent to
clicking the Typeset checkbox in a worksheet?

Sincerely,

Chris

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


Re: [sage-support] How make typesetting be the default in all notebooks?

2011-09-02 Thread William Stein
Hi,

Unfortunately, I don't think there is support for this feature at present.
If there were, it would likely be implemented via the Settings link in
the notebook for a given user.

On Fri, Sep 2, 2011 at 11:49 AM, Chris Seberino  wrote:
> How make typesetting be the default in all notebooks?
>
> (i.e. I don't want users to have to check the Typeset checkbox all the
> time.)
>
> Sincerely,
>
> Chris Seberino
>
> P.S. I tried googling for it but could not find the answer.
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>



-- 
William Stein
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 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Obtaining Size of a List and of elements of a List

2011-09-02 Thread Vincent Knight
Thanks,

This really has clarified everything :)

Much appreciated,
Vince
On 2 Sep 2011 14:49, "D. S. McNeil"  wrote:
> In your code, ComSet is a Python list (not a set) as are many of its
> components, and you use len(x) to get the size:
>
> sage: ComSet, type(ComSet), len(ComSet)
> ([[[0, 1], [0, 2], [1, 2]], [[0, 1, 2]], [[0, 1], [0, 2], [1, 2]]],
> , 3)
> sage: ComSet[0], type(ComSet[0]), len(ComSet[0])
> ([[0, 1], [0, 2], [1, 2]], , 3)
> sage: ComSet[0][0], type(ComSet[0][0]), len(ComSet[0][0])
> ([0, 1], , 2)
> sage: ComSet[0][0][0], type(ComSet[0][0][0])
> (0, )
>
> cardinality is a method not of Python lists, but of the Combinations
> object. For example:
>
> sage: C
> Combinations of [0, 1, 2] of length 2
> sage: C.cardinality()
> 3
> sage: list(C)
> [[0, 1], [0, 2], [1, 2]]
> sage: C.list()
> [[0, 1], [0, 2], [1, 2]]
> sage: len(C.list())
> 3
>
> The reason tab-completion doesn't reveal len is because len is a
> function, not a method on the object, and the dot-tab procedure
> returns the object's contents. (Admittedly, if you type
> ComSet.__[tab], you can see the special methods, including
> ComSet.__len__ which is used behind the scenes, but you would never
> write ComSet.__len__() in real code.)
>
> Does that help?
>
>
> Doug
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at
http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org

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


[sage-support] Re: Bug in Graph.is_chordal

2011-09-02 Thread Jan
Hi Nathann,

First, thank you for taking time to give a very detailed reply.
I'm sorry but I'm not yet done bothering you :-]
I think this is wrong:
> When v is considered for removal, it is a leaf of the lex-BFS tree.
> Its father (and first discoverer) is named x, and we suppose that
> there is a vertex y which is not a neighbor of x, otherwise v is
> removed without any problem.
(I also mentioned this in message #3, but it seems it still holds)
Consider: g = graph({1:[2,3,4,5],2:[3,5],4:[3,5]}).
g is like [the 4-cycle 2--3--4--5] + [(1,x) for x in [2 .. 5]]
g is not chordal.
A LexBFS ordering (reverse elimination ordering) could be [1, 2, 3, 5,
4].
Notice that all v in [2 .. 5] have father equal to 1.
But then x is adjacent to every other vertex, i.e. we can't find y.

Regards,
Jan

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


[sage-support] How make typesetting be the default in all notebooks?

2011-09-02 Thread Chris Seberino
How make typesetting be the default in all notebooks?

(i.e. I don't want users to have to check the Typeset checkbox all the
time.)

Sincerely,

Chris Seberino

P.S. I tried googling for it but could not find the answer.

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


Re: [sage-support] Re: Bug in Graph.is_chordal

2011-09-02 Thread Nathann Cohen
Hellooo Jan !

It is 20:20, it is almost dark outside and I am getting home by bike.
Worst of all, I am being assaulted by hungry mosquitoes. I re-read it
the following enough times to be sure that if I miswrote "v" instead
of "x" somewhere, reading it again wouldn't have changed anything.

When v is considered for removal, it is a leaf of the lex-BFS tree.
Its father (and first discoverer) is named x, and we suppose that
there is a vertex y which is not a neighbor of x, otherwise v is
removed without any problem.
Why should there be a x-y path avoiding all of v's neighbors ? Well,
first note that v is the furthest vertex from the source. Not
strictly, of course, but a lex-BFS is a BFS, and as we are testing for
removal the vertices in the reverse of the discovery order, it means
that in the lex-BFS exploration the vertex v is the last one to be
discovered (without considering the vertices that have been deleted
since the beginning of the elimination algorithm). Hence, it is the
one which is the further away from the source, even if other vertices
may be at equal distance from the source.
Now, how can v be adjacent to the other vertices of the graph ? Well,
for instance v can not be connected to any of x's ancestors, as its
distance from the source is strictly greater than the distance between
x and the source. Hence there is a path from x to the source of the
lex-BFS which does not touch any of x's neighbors. By the same reason,
the vertex y can not be closer than v from the source. If it were,
there would be a path from y to the source (from ancestor to ancestor)
which would avoid all of v's neighbors.

Hence, at some point, when the lex-BFS algorithm was processing all
the vertices at distance d(source, y) = d(source, v), it picked y
before v (we are removing the vertices in reverse order). But then, we
know that y and v have different sets of neighbors among the vertices
at distance "d(source, { v or y} ) - 1" from the source. We know that
because by assumption y is not adjacent to x. In this case, because y
was picked before v in the lex-BFS ordering, it means that the lex-BFS
code of y at this moment was strictly greater than the lex-BFS code of
v.

Hence there is a neighbor of y at distance d(source, y) - 1 which is
not a neighbor of v. Hence there is a path from y to the source going
through this vertex which avoids all of v's neighbors, hence
connectedness, hence certificate, hence I can jump on my bike to
escape the mosquitoes.

Nathann

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


Re: [sage-support] Re: pni and Sage 4.7

2011-09-02 Thread William Stein
On Fri, Sep 2, 2011 at 10:00 AM, Maarten Derickx
 wrote:
> From the location of your sage install
> ~/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-
> i686-Linux
>
> I see you downloaded a prebuild binairy, I guess what's going wrong is that
> this binary was compiled in such a way that it's not compatible with your
> system. This
> post https://groups.google.com/forum/#!topic/sage-support/XJS-3u5z7ws
> might be of help.
> I don't know if we have old prebuild binary's publically available
> somewhere,

That won't help.

> but at least we have old source code
> on http://www.sagemath.org/src-old/

And current source code:

http://www.sagemath.org/download-source.html

 -- William

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



-- 
William Stein
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 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: pni and Sage 4.7

2011-09-02 Thread Maarten Derickx
>From the location of your sage install

~/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts- 
i686-Linux

I see you downloaded a prebuild binairy, I guess what's going wrong is that 
this binary was compiled in such a way that it's not compatible with your 
system. This 
post https://groups.google.com/forum/#!topic/sage-support/XJS-3u5z7ws
might be of help. 

I don't know if we have old prebuild binary's publically available 
somewhere, but at least we have old source code 
on http://www.sagemath.org/src-old/

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


[sage-support] Re: Bug in Graph.is_chordal

2011-09-02 Thread Jan
Hi Nathann,

after this line (line 9520 in 
http://trac.sagemath.org/sage_trac/attachment/ticket/11735/trac_11735.patch):
g.delete_vertices([vv for vv in g.neighbors(v) if vv != y and vv !=
x])
How can one be sure that x and y are still connected? (otherwise no
path x -- y exists)
I don't know whether this holds for the current code.
In the paper another method of choosing v,x,y is described, and the
authors prove that x,y stay connected.
For the patch, I'm not familiar with the version control system used
and unfortunately I don't have time to learn it now.

Regards,
Jan

On Sep 1, 6:23 pm, Nathann Cohen  wrote:
> Hello !
>
> I'm finally back to the civilisation if you want us to deal with this patch 
> :-)
>
> Nathann
>
> On 29 August 2011 15:46, Nathann Cohen  wrote:
>
> > Hello Jan !!!
>
> > I am sorry for my vry slow answers, I am on vacation right now, with
> > very very bad WiFi connections when I get some. If you think you would sleep
> > better with copying the implementation given in the paper, then the best is
> > probably to write a patch for this. I like mine better, just because I feel
> > like I understand how it works, but to be honest I do not really mind in
> > this case as it is so easy to check whether the code is correct. What
> > would you think of writing a patch to change the current behaviour to match
> > the paper using your code, while letting my version of it (the updated/fixed
> > one) in the code as a comment ?
>
> > Before returning the result, it should be checked, for instance like I did
> > in my patch. If at some point the value returned is incorrect, the exception
> > should be
> > "There was an error in the computed answer... Please report the bug" or
> > something alike so that we quickly learn of it and fix the mistake. What do
> > you think ?
>
> > What I fear the most are silent mistakes.. The ones you do not notice. In
> > these situations I don't mind Sage answering me that it wasn't able to do
> > the computations, especially when the patch is already written :-)
>
> > If you have time to create the patch, I will try to review it as soon as I
> > get back to the civilisation (possibly next friday). Otherwise we'll talk
> > about it then :-)
>
> > Thank you for your work, by the way !
>
> > Nathann

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


Re: [sage-support] Obtaining Size of a List and of elements of a List

2011-09-02 Thread D. S. McNeil
In your code, ComSet is a Python list (not a set) as are many of its
components, and you use len(x) to get the size:

sage: ComSet, type(ComSet), len(ComSet)
([[[0, 1], [0, 2], [1, 2]], [[0, 1, 2]], [[0, 1], [0, 2], [1, 2]]],
, 3)
sage: ComSet[0], type(ComSet[0]), len(ComSet[0])
([[0, 1], [0, 2], [1, 2]], , 3)
sage: ComSet[0][0], type(ComSet[0][0]), len(ComSet[0][0])
([0, 1], , 2)
sage: ComSet[0][0][0], type(ComSet[0][0][0])
(0, )

cardinality is a method not of Python lists, but of the Combinations
object.  For example:

sage: C
Combinations of [0, 1, 2] of length 2
sage: C.cardinality()
3
sage: list(C)
[[0, 1], [0, 2], [1, 2]]
sage: C.list()
[[0, 1], [0, 2], [1, 2]]
sage: len(C.list())
3

The reason tab-completion doesn't reveal len is because len is a
function, not a method on the object, and the dot-tab procedure
returns the object's contents.  (Admittedly, if you type
ComSet.__[tab], you can see the special methods, including
ComSet.__len__ which is used behind the scenes, but you would never
write ComSet.__len__() in real code.)

Does that help?


Doug

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


[sage-support] Re: Labels and others in 3D plots

2011-09-02 Thread kcrisman
> var('x, y, z');
> @interact
> def _(a=(-1,1,.1),b=(-1,1,.1),c=(-2,2,.2)):
>     A1 = implicit_plot3d(z==c,(x,-2.1,2),(y,-2,2),(z,-2,2),
> color='red', opacity=0.25, axes=true)
>     A2 = implicit_plot3d(y==c,(x,-2.1,2),(y,-2,2),(z,-2,2),
> color='orange', opacity=0.25, axes=true)
>     A3 = implicit_plot3d(x==c,(x,-2.1,2),(y,-2,2),(z,-2,2),
> color='green', opacity=0.25, axes=true)
>     S = plot3d(a*x^2-b*y^2,(x,-2,2),(y,-2,2))
> def _(which_figure=[A1,A2,A3]):
>      show(S+which_figure)

You have two different definitions here, but you only call one of them
in the interact, I think - I've never tried this construction, and I'm
not sure it's legit.  In any case, even if you created A1 etc., you
couldn't make them options in the second def, because how would they
appear?  A1 isn't a string, it's a plot, so I don't know how that
would show up in a dropdown menu.

What about this?

var('x, y, z');
@interact
def
_(a=(-1,1,.1),b=(-1,1,.1),c=(-2,2,.2),which_figure=['1','2','3']):
A1 = implicit_plot3d(z==c,(x,-2.1,2),(y,-2,2),(z,-2,2),
color='red', opacity=0.25, axes=true)
A2 = implicit_plot3d(y==c,(x,-2.1,2),(y,-2,2),(z,-2,2),
color='orange', opacity=0.25, axes=true)
A3 = implicit_plot3d(x==c,(x,-2.1,2),(y,-2,2),(z,-2,2),
color='green', opacity=0.25, axes=true)
S = plot3d(a*x^2-b*y^2,(x,-2,2),(y,-2,2))
show(eval("S+A%s"%which_figure))

I'm having trouble with the Jmol and Java plugin in my browser right
now (anyone else having this trouble with 4.7.1 on Safari 5.x?), but

@interact
def _(wh=['1','2']):
A1 = plot(x^2,(x,0,1))
A2 = plot(sqrt(x),(x,0,1))
show(eval("A%s"%wh))

works fine, so this should as well, I *think*.

The magic potion here is that we append the formatted string (%s) for
the variable (wh) to A, and then tell Python to evaluate the Python
object you would get if A1 (for instance) were not a string, but an
input to Python.

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


[sage-support] Re: integral() error

2011-09-02 Thread kcrisman


On Sep 1, 11:19 pm, "Justin C. Walker"  wrote:
> On Sep 1, 2011, at 19:31 , robin hankin wrote:
>
> > Hi.
>
> > sage 4.7.1, macosx 10.6.8, firefox 5.0.
>
> > When I use the sage notebook the following happens:
>
> > var('x')
> > integral(exp(x),x)
>
> > Traceback (click to the left of this block for traceback)
> > ...
> > RuntimeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined.
>

What happens if you do

sage: maxima_console()

and what happens with

sage: x.simplify()

(which just sends it to Maxima and back)?

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


Re: [sage-support] Obtaining Size of a List and of elements of a List

2011-09-02 Thread Vincent Knight
I'm afraid that's not working. Appartently len has been removed and replaced
with cardinality(). Thanks for the tip about ".[tab]". However I still seem
to be rather stuck:

If I run this code:

Columns=3
Rows=3
RowVector=[2,3,2]
ComSet=[]
for j in range(Columns):
   C=Combinations(range(Rows),RowVector[j])
   ComSet.append(C.list())
show(ComSet)

ComSet then appears as: [[[0,1],[0,2],[1,2]],[[0,1,2]],[[0,1],[0,2],[1,2]]]

which is what I require. If I then use ".[tab]" on ComSet I get various
options, none of which include "len" and or "cardinality". The only option
that looks relatively right would be "count" but I can't seem to find any
help on that command and can't seem to use it correctly.

If I use .[tab] on any element of ComSet, for example on [[0,1],[0,2],[1,2]
] I seem to get a similar problem (and len does not appear as an option):

Defining:

C=[[0,1],[0,2],[1,2]]

and then C.[tab] gives me the same options as before (i.e. count which I
don't seem to be able to find any help for). If however I define C in a
different manner:

C=Combinations(range(3),2)

then C.[tab] does indeed give me cardinality.

I am obviously missing something simple. Is there a straightforward way to
obtain the length of a set?

Any further help would be greatly appreciated,
Vince





On 2 September 2011 12:01, Robert Bradshaw wrote:

> On Fri, Sep 2, 2011 at 3:44 AM, Vince  wrote:
> > Dear all,
> >
> > If I have a list, how do I obtain the cardinality of the list, the
> > command Cardinality() doesn't seem to always work. For example, the
> > following code produces a set ComSet of sets of combinations.
> >
> > Rows=3
> > RowVector=[2,3,2]
> > ComSet=[]
> > for j in range(Columns):
> >C=Combinations(range(Rows),RowVector[j])
> >ComSet.append(C.list())
> > show(ComSet)
>
> What's Columns?
>
> > However using Cardinality() on ComSet does not seem to work:
> >
> > ComSet.Cardinality()
> >
> > Basically I am looking for the mathematica command "Length".
>
>
> FYI, most Python and Sage commands start with a lower case. In this
> case, however, what you're looking for is len(ComSet). If you have an
> object x, type x-dot-tab to see what methods it supports.
>
> > Furthermore how would I be able to map that command on to the elements
> > of ComSet?
>
> Use "list comprehensions" (it's a Python thing).
>
> sage: L = [[1, 2, 3], [4, 5]]
> sage: [len(a) for a in L]
> [3, 2]
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>



-- 
Dr Vincent Knight
Cardiff School of Mathematics
Senghennydd Road,
Cardiff
CF24 4AG
(+44) 29 2087 5548
www.vincent-knight.com
@drvinceknight 
Skype: drvinceknight

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


Re: [sage-support] Obtaining Size of a List and of elements of a List

2011-09-02 Thread Vincent Knight
Many thanks for this. Apologies for incomplete code: Columns=3.

Vince
On 2 Sep 2011 12:01, "Robert Bradshaw"  wrote:
> On Fri, Sep 2, 2011 at 3:44 AM, Vince  wrote:
>> Dear all,
>>
>> If I have a list, how do I obtain the cardinality of the list, the
>> command Cardinality() doesn't seem to always work. For example, the
>> following code produces a set ComSet of sets of combinations.
>>
>> Rows=3
>> RowVector=[2,3,2]
>> ComSet=[]
>> for j in range(Columns):
>>C=Combinations(range(Rows),RowVector[j])
>>ComSet.append(C.list())
>> show(ComSet)
>
> What's Columns?
>
>> However using Cardinality() on ComSet does not seem to work:
>>
>> ComSet.Cardinality()
>>
>> Basically I am looking for the mathematica command "Length".
>
>
> FYI, most Python and Sage commands start with a lower case. In this
> case, however, what you're looking for is len(ComSet). If you have an
> object x, type x-dot-tab to see what methods it supports.
>
>> Furthermore how would I be able to map that command on to the elements
>> of ComSet?
>
> Use "list comprehensions" (it's a Python thing).
>
> sage: L = [[1, 2, 3], [4, 5]]
> sage: [len(a) for a in L]
> [3, 2]
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at
http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org

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


Re: [sage-support] Obtaining Size of a List and of elements of a List

2011-09-02 Thread Robert Bradshaw
On Fri, Sep 2, 2011 at 3:44 AM, Vince  wrote:
> Dear all,
>
> If I have a list, how do I obtain the cardinality of the list, the
> command Cardinality() doesn't seem to always work. For example, the
> following code produces a set ComSet of sets of combinations.
>
> Rows=3
> RowVector=[2,3,2]
> ComSet=[]
> for j in range(Columns):
>    C=Combinations(range(Rows),RowVector[j])
>    ComSet.append(C.list())
> show(ComSet)

What's Columns?

> However using Cardinality() on ComSet does not seem to work:
>
> ComSet.Cardinality()
>
> Basically I am looking for the mathematica command "Length".


FYI, most Python and Sage commands start with a lower case. In this
case, however, what you're looking for is len(ComSet). If you have an
object x, type x-dot-tab to see what methods it supports.

> Furthermore how would I be able to map that command on to the elements
> of ComSet?

Use "list comprehensions" (it's a Python thing).

sage: L = [[1, 2, 3], [4, 5]]
sage: [len(a) for a in L]
[3, 2]

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


[sage-support] Obtaining Size of a List and of elements of a List

2011-09-02 Thread Vince
Dear all,

If I have a list, how do I obtain the cardinality of the list, the
command Cardinality() doesn't seem to always work. For example, the
following code produces a set ComSet of sets of combinations.

Rows=3
RowVector=[2,3,2]
ComSet=[]
for j in range(Columns):
C=Combinations(range(Rows),RowVector[j])
ComSet.append(C.list())
show(ComSet)

However using Cardinality() on ComSet does not seem to work:

ComSet.Cardinality()

Basically I am looking for the mathematica command "Length".
Furthermore how would I be able to map that command on to the elements
of ComSet?

Many thanks,
Vince

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


[sage-support] pni and Sage 4.7

2011-09-02 Thread Anthony Wickstead
I am trying to try out SAGE on my Dell Latitude D410 laptop, which has
a dual boot system running Vista and Ubuntu [Linux tony-laptop
2.6.32-33-generic #72-Ubuntu SMP Fri Jul 29 21:08:37 UTC 2011 i686 GNU/
Linux]. I downloaded SAGE 4.7 yesterday but the installation process
warned that it might not run because of a lack of pni. That seems to
be correct:

*
processor   : 0
vendor_id   :
GenuineIntel
cpu family  :
6
model   :
13
model name  : Intel(R) Pentium(R) M processor
2.00GHz
stepping:
8
cpu MHz : 2000.000
cache size  : 2048 KB
fdiv_bug: no
hlt_bug : no
f00f_bug: no
coma_bug: no
fpu : yes
fpu_exception   : yes
cpuid level : 2
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca
cmov clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts est tm2
bogomips: 3990.16
clflush size: 64
cache_alignment : 64
address sizes   : 32 bits physical, 32 bits virtual
power management:

*

The installation process suggested a work-around but warned that it
might not work. It didn't!

***

tony@tony-laptop:~/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-
i686-Linux$ sh sage
--
| Sage Version 4.7.1, Release Date: 2011-08-11   |
| Type notebook() for the GUI, and license() for information.|
--
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libcsage.so(print_backtrace+0x3b)[0x27b30e]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libcsage.so(sigdie+0x17)[0x27b34e]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libcsage.so(sage_signal_handler+0x1ad)[0x27ae70]
[0x1a1400]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/python2.6/site-packages/sage/rings/
integer.so(initinteger+0x29fb)[0xad750b]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(_PyImport_LoadDynamicModule+0xb6)
[0xea83a6]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(+0xe2f78)[0xea5f78]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(+0xe391f)[0xea691f]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(+0xe3c1c)[0xea6c1c]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(+0xe4296)[0xea7296]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(PyImport_ImportModuleLevel+0x3b)
[0xea77cb]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(+0xc7916)[0xe8a916]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(PyCFunction_Call+0x128)[0xe30c48]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(PyObject_Call+0x5c)[0xded73c]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(PyObject_CallFunction+0x65)
[0xdf0115]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(PyImport_Import+0xb7)[0xea78e7]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/python2.6/site-packages/sage/rings/
complex_double.so(+0xfdf4)[0x4a1df4]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/python2.6/site-packages/sage/rings/
complex_double.so(initcomplex_double+0x18df)[0x4aa91f]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(_PyImport_LoadDynamicModule+0xb6)
[0xea83a6]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(+0xe2f78)[0xea5f78]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(+0xe391f)[0xea691f]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(+0xe3c1c)[0xea6c1c]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(+0xe4296)[0xea7296]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(PyImport_ImportModuleLevel+0x3b)
[0xea77cb]
/home/tony/Documents/sage-4.7.1-linux-32bit-ubuntu_10.04_lts-i686-
Linux/local/lib/libpython2.6.so.1.0(+0