[sage-support] Re: Did something happen with matrix_plot in 6.7

2015-05-20 Thread John H Palmieri


On Wednesday, May 20, 2015 at 2:54:57 PM UTC-7, David Einstein wrote:
>
> In 6.6 if I did
> sage: matrix_plot(matrix([[1,2,3,4],[4,3,2,1]]))
>
> I'd get a boring image (a bunch of squares)
>
> In 6.7 I just get an axis.
>
> This happens on my Mac OSX 10.10.3 and My linux machine (some recent 
> Fedora).  Both sages are built from source.
>
> There do not seem to be any open trac tickets for this, but I may be doing 
> something wrong.  Am I?
>

It looks like a bug was introduced, my guess is in 
http://trac.sagemath.org/ticket/18327. I have now reported it at 
http://trac.sagemath.org/ticket/18463.

-- 
John
 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Make doc error

2015-06-03 Thread John H Palmieri
Earlier in the docbuilding, I see this:

[combinat ] building [inventory]: targets for 2 source files that are out 
of date
[combinat ] updating environment: 0 added, 2 changed, 0 removed
[combinat ] reading sources... [ 50%] 
sage/combinat/cluster_algebra_quiver/cluster_seed
[combinat ] Encoding error:
[combinat ] 'ascii' codec can't decode byte 0xc3 in position 414: ordinal 
not in range(128)
[combinat ] The full traceback has been saved in 
/var/folders/cp/n8wtqs490tq5psknff1hv9qrgn/T/sphinx-err-jeDhGW.log, if 
you want to report the issue to the developers.

which is caused by the accents on line 18 of cluster_seed.py. Does the 
problem go away if you remove those accents or add something like

# -*- coding: utf-8 -*-

to the top of the file?

  John



On Wednesday, June 3, 2015 at 4:24:37 PM UTC-7, Viviane Pons wrote:
>
> This I did already...
>
> 2015-06-03 18:21 GMT-05:00 Volker Braun >
> :
>
>> Try "make doc-clean && make"
>>
>>
>> On Thursday, June 4, 2015 at 1:06:03 AM UTC+2, Viviane Pons wrote:
>>>
>>> Hi everyone,
>>>
>>> I get this doc build error on a branch (
>>> http://trac.sagemath.org/ticket/18594) and I have no idea why. I just 
>>> know the error comes from the branch (I can build the doc fine on develop) 
>>> but I don't know which commit caused it. I'm going to look into it but if 
>>> someone has the slightest idea of what is causing it, it would help!
>>>
>>> The error:
>>>
>>> [reference] WARNING: Unable to fetch 
>>> /media/ubuntudata/Programming/sage/src/doc/output/doctrees/en/reference/combinat/environment.pickle
>>> Error building the documentation.
>>>
>>> Note: incremental documentation builds sometimes cause spurious
>>> error messages. To be certain that these are real errors, run
>>> "make doc-clean" first and try again.
>>> Traceback (most recent call last):
>>>   File "/media/ubuntudata/Programming/sage/src/doc/common/builder.py", 
>>> line 1626, in 
>>> getattr(get_builder(name), type)()
>>>   File "/media/ubuntudata/Programming/sage/src/doc/common/builder.py", 
>>> line 292, in _wrapper
>>> getattr(get_builder(document), 'inventory')(*args, **kwds)
>>>   File "/media/ubuntudata/Programming/sage/src/doc/common/builder.py", 
>>> line 516, in _wrapper
>>> getattr(DocBuilder(self.name, lang), format)(*args, **kwds)
>>>   File "/media/ubuntudata/Programming/sage/src/doc/common/builder.py", 
>>> line 110, in f
>>> eval(compile(open(sys.argv[0]).read(), sys.argv[0], 'exec'))
>>>   File 
>>> "/media/ubuntudata/Programming/sage/src/doc/common/custom-sphinx-build.py", 
>>> line 219, in 
>>> raise OSError(ERROR_MESSAGE)
>>> OSError: [reference] WARNING: Unable to fetch 
>>> /media/ubuntudata/Programming/sage/src/doc/output/doctrees/en/reference/combinat/environment.pickle
>>>
>>>
>>> Best
>>>
>>> Viviane
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sage-support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sage-support...@googlegroups.com .
>> To post to this group, send email to sage-s...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/sage-support.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How to get Sage back from a colon?

2015-06-09 Thread John H Palmieri
Control-C will cancel the current command and return you to the "sage:" 
prompt.

  John



On Tuesday, June 9, 2015 at 9:58:46 AM UTC-7, Craig E Larson wrote:
>
> Sometimes I forget a parenthesis, etc, and I get a colon input prompt. 
> Double-enter won't escape the colon. Correcting the syntax also isn't 
> enough. Control-Z will exit Sage totally and I lose my data and history. Is 
> there another way to escape the colon besides Control-Z?
>
> Here's an example.
>
> sage: is_P_position(ChompBoard([3,3,3,1])
> : 
> : is_P_position(ChompBoard([3,3,3,1]))
> : 
> : is_P_position(ChompBoard([3,3,3,1]))
> : 
> : 
> : 
> : 
> :   
> :  
> Forever
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] confirm sagenb live doc behavior

2015-06-29 Thread John H Palmieri
On my Mac using Safari or Firefox, if I run sage and then start the 
notebook, live cells in the documentation work just fine. (On the other 
hand, if I go to sagenb.org, log in, click Help and open up a live 
reference manual page, I get a green block cursor after I evaluate a cell, 
but it never actually evaluates. Or at least not after at least 5 minutes 
of waiting. I don't know if you're interested in the behavior of 
sagenb.org.)

  John



On Monday, June 29, 2015 at 12:41:13 PM UTC-7, kcrisman wrote:
>
>
>> It works for me, as follows:  sage 6.7 server running on a remote 
>>
>
> Thanks, John, that is helpful - I would much rather it be my 
> recently-announced-not-to-be-upgraded-due-to-budget-stuff computer than a 
> problem in sagenb.  Anyone on local machines, esp. Mac?
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Building SageMath 6.8 from source on 32-bit Ubuntu 15.04

2015-07-27 Thread John H Palmieri
Did you try this:


Note: incremental documentation builds sometimes cause spurious
error messages. To be certain that these are real errors, run
"make doc-clean" first and try again.


  John



On Monday, July 27, 2015 at 2:57:08 AM UTC-7, Brenton wrote:
>
> Hi, 
>
> I've been downloading the latest SageMath release source code via Git and 
> when I did this for beta releases and 6.8.rc0, the build happened without 
> error after I downloaded the singular patch into 
> `build/pkgs/singular/patches/`. SageMath 6.8.rc1 & 6.8 are where the 
> problem is. Running `make` from their directory gives the following error 
> message:
>
> Error building the documentation.
>
>
> Note: incremental documentation builds sometimes cause spurious
> error messages. To be certain that these are real errors, run
> "make doc-clean" first and try again.
> Traceback (most recent call last):
>   File "/home/fusion809/sage/src/doc/common/builder.py", line 1626, in 
> 
> getattr(get_builder(name), type)()
>   File "/home/fusion809/sage/src/doc/common/builder.py", line 292, in 
> _wrapper
> getattr(get_builder(document), 'inventory')(*args, **kwds)
>   File "/home/fusion809/sage/src/doc/common/builder.py", line 503, in 
> _wrapper
> x.get(9)
>   File "/home/fusion809/sage/local/lib/python/multiprocessing/pool.py", 
> line 558, in get
> raise self._value
> OSError: [misc ] /home/fusion809/sage/src/doc/en/reference/misc/sage/
> misc/ascii_art.rst:11: WARNING: autodoc can't import/find module 'sage.
> misc.ascii_art', it reported error: "No module named ascii_art", please 
> check your spelling and sys.path
>
>
> Makefile:742: recipe for target 'doc-html' failed
> make[2]: *** [doc-html] Error 1
> make[2]: Leaving directory '/home/fusion809/sage/build/make'
> Makefile:563: recipe for target 'all' failed
> make[1]: *** [all] Error 2
> make[1]: Leaving directory '/home/fusion809/sage/build/make'
>
>
> real 16m54.732s
> user 12m49.636s
> sys 0m12.840s
> ***
> Error building Sage.
>
>
> The following package(s) may have failed to build (not necessarily
> during this run of 'make all'):
>
>
> * documentation: dochtml
>   log file: /home/fusion809/sage/logs/pkgs/../dochtml.log
>
> Attached is my build file.
>
> Thanks for your time,
> Brenton
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Graph.clique_complex()

2015-10-02 Thread John H Palmieri


On Friday, October 2, 2015 at 8:50:12 PM UTC-7, Selva Raja S wrote:
>
>
> clique_complex() does not shows facets
>
>
>
> *for example*sage: 
> g=Graph({1:[2,5,6,3,4],2:[7,3,5,4],3:[8,4,5],4:[9,5],5:[10]})
> sage: g.clique_complex()
> Simplicial complex with 10 vertices and 6 facets
>


You have made an accurate statement. Do you have a question? I'm guessing 
that you want list of the facets:

sage: g.clique_complex().facets()
{(4, 9), (1, 6), (2, 7), (1, 2, 3, 4, 5), (5, 10), (3, 8)}

But if you want something else, let us know.

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: building sage from source on OSX 10.11 El Capitan

2015-10-22 Thread John H Palmieri


On Thursday, October 22, 2015 at 12:57:08 PM UTC-7, Karl Rubin wrote:
>
> I upgraded to El Capitan OSX 10.11 on my iMac before I knew that this 
> would kill my sage installation.  I see that there was a ticket about this 
> (#19370) that is now closed/fixed.  How can I get the corrected source code 
> to build it myself?  I'm comfortable with the command line and can follow 
> instructions, but I'm not familiar with git and haven't been able to figure 
> out how to do it myself.  And I prefer not to disable SIP if possible. 
>  Thanks for any help.
>

You should be able to download the latest beta version (which includes the 
changes from #19370) at 

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

You need to get the file "sage-6.10.beta1.tar.gz", unpack the tarball, and 
build it. Actually, once you build it, if you move the Sage installation, 
it will break (because of changes in OS X 10.11). So unpack the tarball, 
put the resulting "sage-6.10.beta1" directory somewhere you want to keep it 
for a while, and only then should you build it.

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How can one recompile a standard package (without rebuilding the whole thing) ?

2015-10-28 Thread John H Palmieri


On Wednesday, October 28, 2015 at 10:19:51 AM UTC-7, Emmanuel Charpentier 
wrote:
>
> Case in point : Trac#19469 . This 
> ticket will solve an annoying quirk un the Ipython notebook.
>
> I tested it successfully on one installation, by recompiling the whole hog 
> ( make distclean && make ).
>
> I have another installation, now up to 6.10beta1. I did successfully :
> git trac checkout 
> make (rebuilds the documentation, by the way...)
>

Try 

./configure
make

(although there is an open ticket which would make ./configure unnecessary).

  John


> The resulting Sage still has the "old" behaviour.
>
> I also tried ./sage -b in $SAGE_ROOT. Same result.
>
> Is there a way to force the recompilation-reinstallation of the Ipythobn 
> notebook ? I know that neither ./sage -i notebook or ./sage -f notebook 
> work : these calls fail with complaining that they cannot find the source 
> tarball... Further attempts to use this installation fail with the same 
> error (sage has somehow registered that the Ipytho notebook is missing and 
> tries to install it, unsuccessfully...).
>
> What am I missing ?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How can one recompile a standard package (without rebuilding the whole thing) ?

2015-10-28 Thread John H Palmieri


On Wednesday, October 28, 2015 at 11:48:13 AM UTC-7, Emmanuel Charpentier 
wrote:
>
> Mirabile dictu, it worked ! But it's a strange thing : AFAIK, ./configure 
> is used to adapt a source to the specifics of a platform. This (usually) 
> does not change between recompilations.
>

> Except that Sagemath source carries a lot of its own buildig platform (e. 
> g. gcc...). Is that the explanation ?
>
 
I believe that the configure script detects the version of each Sage 
package it needs to install, so if you want to update a package, you need 
to run ./configure so that it knows to build the new one instead of the old 
one.

  John

 

>
> Thanks, John !
>
> Le mercredi 28 octobre 2015 18:32:06 UTC+1, John H Palmieri a écrit :
>>
>>
>>
>> On Wednesday, October 28, 2015 at 10:19:51 AM UTC-7, Emmanuel Charpentier 
>> wrote:
>>>
>>> Case in point : Trac#19469 <http://trac.sagemath.org/ticket/19469>. 
>>> This ticket will solve an annoying quirk un the Ipython notebook.
>>>
>>> I tested it successfully on one installation, by recompiling the whole 
>>> hog ( make distclean && make ).
>>>
>>> I have another installation, now up to 6.10beta1. I did successfully :
>>> git trac checkout 
>>> make (rebuilds the documentation, by the way...)
>>>
>>
>> Try 
>>
>> ./configure
>> make
>>
>> (although there is an open ticket which would make ./configure 
>> unnecessary).
>>
>>   John
>>
>>
>>> The resulting Sage still has the "old" behaviour.
>>>
>>> I also tried ./sage -b in $SAGE_ROOT. Same result.
>>>
>>> Is there a way to force the recompilation-reinstallation of the Ipythobn 
>>> notebook ? I know that neither ./sage -i notebook or ./sage -f notebook 
>>> work : these calls fail with complaining that they cannot find the source 
>>> tarball... Further attempts to use this installation fail with the same 
>>> error (sage has somehow registered that the Ipytho notebook is missing and 
>>> tries to install it, unsuccessfully...).
>>>
>>> What am I missing ?
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] TAB completion

2015-11-05 Thread John H Palmieri


On Thursday, November 5, 2015 at 3:40:01 PM UTC-8, William wrote:
>
> On Thu, Nov 5, 2015 at 3:29 PM, Justin C. Walker  > wrote: 
> > Hi, 
> > 
> > In the distant past, I knew how to configure Sage to handle TAB 
> completion this way: 
> >   - one TAB: complete if unique prefix typed; else 
> >   - second TAB: list all possible 
> > 
> > I have not been able to determine how to achieve this in recent 
> versions: I always get a complete list on one TAB, and after searching the 
> doc, I am lost in a twisty maze of passages, all looking strangely similar. 
> > 
> > Suggestions or clues welcome. 
>
> More generally, how does one configure anything about IPython for the 
> sage command prompt anymore.  IPython's config used to be a nicely 
> documented file, which we customized for sage and dropped in 
> ~/.sage/ipython.  Now it seems our customization is done via Python 
> code in [SAGE_ROOT]/src/sage/repl/interpreter.py.  How can one 
> customize what's done, aside from editing that code?  For example, 
> what if I want to change the "sage:" prompt, or the color scheme, or 
> whatever, but keep everything else the same? 
>

I did 

$ sage --ipython profile create 

and got some message that some configuration files were created. Those are 
reasonably well documented, and I could change the "sage:" prompt pretty 
easily. I didn't play around with it too much, though.

  John


 

>
>  -- William 
>
> > 
> > Thanks! 
> > 
> > Justin 
> > 
> > -- 
> > Justin C. Walker, Curmudgeon at Large 
> > Institute for the Absorption of Federal Funds 
> > --- 
> > If it weren't for carbon-14, I wouldn't date at all. 
> > --- 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "sage-support" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sage-support...@googlegroups.com . 
> > To post to this group, send email to sage-s...@googlegroups.com 
> . 
> > Visit this group at http://groups.google.com/group/sage-support. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> William (http://wstein.org) 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] TAB completion

2015-11-05 Thread John H Palmieri
On Thursday, November 5, 2015 at 5:03:27 PM UTC-8, William wrote:
>
> On Thu, Nov 5, 2015 at 4:02 PM, John H Palmieri  > wrote: 
> > 
> > 
> > On Thursday, November 5, 2015 at 3:40:01 PM UTC-8, William wrote: 
> >> 
> >> On Thu, Nov 5, 2015 at 3:29 PM, Justin C. Walker  
> wrote: 
> >> > Hi, 
> >> > 
> >> > In the distant past, I knew how to configure Sage to handle TAB 
> >> > completion this way: 
> >> >   - one TAB: complete if unique prefix typed; else 
> >> >   - second TAB: list all possible 
> >> > 
> >> > I have not been able to determine how to achieve this in recent 
> >> > versions: I always get a complete list on one TAB, and after 
> searching the 
> >> > doc, I am lost in a twisty maze of passages, all looking strangely 
> similar. 
> >> > 
> >> > Suggestions or clues welcome. 
> >> 
> >> More generally, how does one configure anything about IPython for the 
> >> sage command prompt anymore.  IPython's config used to be a nicely 
> >> documented file, which we customized for sage and dropped in 
> >> ~/.sage/ipython.  Now it seems our customization is done via Python 
> >> code in [SAGE_ROOT]/src/sage/repl/interpreter.py.  How can one 
> >> customize what's done, aside from editing that code?  For example, 
> >> what if I want to change the "sage:" prompt, or the color scheme, or 
> >> whatever, but keep everything else the same? 
> > 
> > 
> > I did 
> > 
> > $ sage --ipython profile create 
> > 
> > and got some message that some configuration files were created. Those 
> are 
> > reasonably well documented, and I could change the "sage:" prompt pretty 
> > easily. I didn't play around with it too much, though. 
>
> Thanks!  This worked for Justin upon adding the line 
>
>c.InteractiveShell.readline_parse_and_bind = ['tab:complete'] 
>
> to the file 
>
>.sage/ipython-4.0.0/profile_default/ipython_config.py 
>
> William 
>
>
>
Great! I'm glad it helped. Maybe we should document it somewhere. 
Meanwhile, I found out about it by reading the file 
./sage/ipython-3.2.1/README

  John

 

>
> > 
> >   John 
> > 
> > 
> > 
> >> 
> >> 
> >>  -- William 
> >> 
> >> > 
> >> > Thanks! 
> >> > 
> >> > Justin 
> >> > 
> >> > -- 
> >> > Justin C. Walker, Curmudgeon at Large 
> >> > Institute for the Absorption of Federal Funds 
> >> > --- 
> >> > If it weren't for carbon-14, I wouldn't date at all. 
> >> > --- 
> >> > 
> >> > 
> >> > -- 
> >> > You received this message because you are subscribed to the Google 
> >> > Groups "sage-support" group. 
> >> > To unsubscribe from this group and stop receiving emails from it, 
> send 
> >> > an email to sage-support...@googlegroups.com. 
> >> > To post to this group, send email to sage-s...@googlegroups.com. 
> >> > Visit this group at http://groups.google.com/group/sage-support. 
> >> > For more options, visit https://groups.google.com/d/optout. 
> >> 
> >> 
> >> 
> >> -- 
> >> William (http://wstein.org) 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sage-support" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to sage-support...@googlegroups.com . 
> > To post to this group, send email to sage-s...@googlegroups.com 
> . 
> > Visit this group at http://groups.google.com/group/sage-support. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> William (http://wstein.org) 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How to save the output of view locally (and not open the output)?

2015-11-07 Thread John H Palmieri


On Saturday, November 7, 2015 at 1:34:49 PM UTC-8, slabbe wrote:
>
> This opens a pdf:
>
> sage: g = graphs.PetersenGraph()
> sage: s = latex(g)
> sage: view(s, tightpage=True)
>
> But is there a way to just save that pdf file locally and not open it?
>

Until you quite the Sage session, the file should be saved some place like 
.sage/temp/HOSTNAME/9348/sage.pdf   (9348 is some random number). So if you 
don't mind having it open, it is available. I thought there was another way 
to do this, but I can't find a simple one. You can do:

   sage: from sage.misc.latex import _latex_file_
   sage: t = _latex_file_(s)   # the contents of the file to be run through 
LaTeX

Or even better, mimic the effects of tightpage=True:

   sage: t = _latex_file_(s, 
extra_preamble='\\usepackage[tightpage,active]{preview}\\PreviewEnvironment{page}',
math_left='\\begin{page}$', math_right='$\\end{page}')

Then save to a file and run PDFLaTeX on it:

sage: file = "/home/palmieri/my_file.tex"
sage: O = open(file, 'w')
sage: O.write(t)
sage: O.close
sage: from sage.misc.latex import _run_latex_
sage: _run_latex_(file)

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: view(g) where g is graph: does not respect colors

2015-12-01 Thread John H Palmieri
On Tuesday, December 1, 2015 at 9:40:18 AM UTC-8, Pedro Cruz wrote:
>
> The following code (sage 6.9):
>
> sage: g = graphs.PetersenGraph()
> sage: g.set_latex_options(vertex_color='green')
> sage: view(g)
>
>
> produces a black-and-white graph.
>

Can you use "g.plot()" instead? If so, "g.plot?" lists some options to set 
vertex and edge colors.

 

>
> In SMC produces a graph with blue vertices.
>
> What can I do?
>
> Thank you, 
> Pedro
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: about vector subspace

2016-03-26 Thread John H Palmieri


On Saturday, March 26, 2016 at 7:13:57 AM UTC-7, Александр Шевченко wrote:
>
> Hello.
>
> I have next problem, when I write next strings. 
>
> V = VectorSpace(F,n)S = V.subspace(basis)
>
>
Does "S = V.subspace_with_basis(basis)" do what you want?

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: how to Choose Applications, then select "All Applications"

2016-04-12 Thread John H Palmieri
In your first message (with the old version of Sage) you had:

students-MacBook-Pro:~ student$ /Users/student/sage/sage/sage 

It should look like this. In your more recent message (with a good version 
of Sage), though, you had:

students-MacBook-Pro:~ student$ 
/Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/sage ; exit;

The part "/Volumes/..." indicates that you dragged the "sage" file from the 
disk image to "Terminal", not the "sage" file from the copied version. Make 
sure you use "sage" from the copied version. It might be safest to first 
copy "SageMath" (as you have done) and then eject the disk image. Then 
proceed to drag the "sage" file to "Terminal".



On Tuesday, April 12, 2016 at 3:08:54 PM UTC-7, ana...@g.uky.edu wrote:
>
> Sorry, I do not quite understand what you wrote.
> I copied the "SageMath" folder to one of my directories.
> Then, I dragged the "sage" file to terminal and ran it.
> I thought by this, I completed the step
> >4) Select to run it with "Terminal":
> in read.me.
> What can I do make it work?
>
> On Tuesday, April 12, 2016 at 3:10:44 PM UTC-4, Dima Pasechnik wrote:
>>
>>
>>
>> On Tuesday, April 12, 2016 at 7:16:34 PM UTC+1, ana...@g.uky.edu wrote:
>>>
>>> Thank you for the answer. Now, as you gave me the advise, I downloaded 
>>> Sage-7.2 beta0, and did the same thing up to
>>>
>>> 3) Use finder to visit the sage folder you just copied it and double 
>>> click on the "sage" icon.
>>> and
>>> 4) Select to run it with "Terminal":
>>>
>>> Again, where and how I can "Choose Applications, then select "All 
>>> Applications"?
>>>
>>> Following is the output I got, then I do not know where to go.
>>>
>>> students-MacBook-Pro:~ student$ 
>>> /Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/sage ; exit;
>>>
>>>
>>> Rewriting paths for your new installation directory
>>>
>>> ===
>>>
>>>
>>> This might take a few minutes but only has to be done once.
>>>
>>>
>>> patching 
>>> /Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/local/bin/class-4d.x
>>>
>>> Traceback (most recent call last):
>>>
>>>   File 
>>> "/Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/relocate-once.py", 
>>> line 141, in 
>>>
>>> p('local/bin/class-4d.x').patch(1944, 2071).save()
>>>
>>>   File 
>>> "/Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/relocate-once.py", 
>>> line 113, in patch
>>>
>>> self.search_and_replace, self.filename
>>>
>>>   File 
>>> "/Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/relocate-once.py", 
>>> line 53, in __init__
>>>
>>> self.fh = open(filename, "r+b")
>>>
>>> IOError: [Errno 30] Read-only file system: 
>>> '/Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/local/bin/class-4d.x'
>>>
>>
>> this seems to indicate that you did not copy the image anywhere, but 
>> tried to launch it in place.
>> This of course will never work.
>> Perhaps this kind of error should be handled better.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: how to Choose Applications, then select "All Applications"

2016-04-12 Thread John H Palmieri


On Tuesday, April 12, 2016 at 4:00:51 PM UTC-7, Dima Pasechnik wrote:
>
>
>
> On Tuesday, April 12, 2016 at 11:51:15 PM UTC+1, Dima Pasechnik wrote:
>>
>>
>>
>> On Tuesday, April 12, 2016 at 11:08:54 PM UTC+1, ana...@g.uky.edu wrote:
>>>
>>> Sorry, I do not quite understand what you wrote.
>>> I copied the "SageMath" folder to one of my directories.
>>> Then, I dragged the "sage" file to terminal and ran it.
>>>
>>  
>> sorry, no, you are meant to navigate in Terminal (using cd command) to 
>> the directory you put Sage in,
>> and start it there. 
>>
>> (I thought you are working with *.app.dmg package rather than with *.dmg)
>>
>
> As an example, assume you copied SageMath directory to the desktop.
> Then in terminal you type, at its prompt (I denote it by '$'), and hit 
> Enter at the end  of each line:
>
> $ cd ~/Desktop/SageMath
> $ ./sage
>
> you will see a lot of messages: "patching ..." (only at the 1st run)
> and then the Sage prompt (sage:)
>

I think that dragging the 'sage' script to the Terminal app ought to work, 
also.

  John

 

>
>
>  
>>
>>> I thought by this, I completed the step
>>> >4) Select to run it with "Terminal": 
>>> in read.me.
>>> What can I do make it work?
>>>
>>> On Tuesday, April 12, 2016 at 3:10:44 PM UTC-4, Dima Pasechnik wrote:



 On Tuesday, April 12, 2016 at 7:16:34 PM UTC+1, ana...@g.uky.edu wrote:
>
> Thank you for the answer. Now, as you gave me the advise, I downloaded 
> Sage-7.2 beta0, and did the same thing up to
>
> 3) Use finder to visit the sage folder you just copied it and double 
> click on the "sage" icon.
> and
> 4) Select to run it with "Terminal":
>
> Again, where and how I can "Choose Applications, then select "All 
> Applications"?
>
> Following is the output I got, then I do not know where to go.
>
> students-MacBook-Pro:~ student$ 
> /Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/sage ; exit;
>
>
> Rewriting paths for your new installation directory
>
> ===
>
>
> This might take a few minutes but only has to be done once.
>
>
> patching 
> /Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/local/bin/class-4d.x
>
> Traceback (most recent call last):
>
>   File 
> "/Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/relocate-once.py", 
> line 141, in 
>
> p('local/bin/class-4d.x').patch(1944, 2071).save()
>
>   File 
> "/Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/relocate-once.py", 
> line 113, in patch
>
> self.search_and_replace, self.filename
>
>   File 
> "/Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/relocate-once.py", 
> line 53, in __init__
>
> self.fh = open(filename, "r+b")
>
> IOError: [Errno 30] Read-only file system: 
> '/Volumes/sage-7.2.beta0-OSX_10.11.4-x86_64/SageMath/local/bin/class-4d.x'
>

 this seems to indicate that you did not copy the image anywhere, but 
 tried to launch it in place.
 This of course will never work.
 Perhaps this kind of error should be handled better.

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] How do I define a morphism/function/map of sets?

2016-04-18 Thread John H Palmieri
How do I define a function between finite sets within the category 
framework? Should the following work?

sage: S = Set([1,2,3])
sage: T = Set([4,5,6,7])
sage: f = S.hom(lambda x: 3+x, T)
sage: f
Generic morphism:
  From: {1, 2, 3}
  To:   {4, 5, 6, 7}
sage: f(2)

---
TypeError Traceback (most recent call 
last)

TypeError: 2 fails to convert into the map's domain {1, 2, 3}, but a 
`pushforward` method is not properly implemented

I see that it works if I define S and T using FiniteEnumeratedSet instead. 
Is that the best solution?

Or suppose I want to define a map sending 1 to 5, 2 to 7, 3 to 5. I can't 
see how to use the dictionary {1:5, 2:7, 3:5} (for example) to define a 
function.

In general, I would like fully functional, callable, composable morphisms 
of sets, and finite sets are good enough for now. Any advice? Also of other 
categories, in particular finite abelian groups, but maybe those work 
better already?

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How do I define a morphism/function/map of sets?

2016-04-18 Thread John H Palmieri
Thanks, FiniteSetMaps might be what I want, but I'll keep both approaches 
in mind.

  John


On Monday, April 18, 2016 at 3:51:27 PM UTC-7, vdelecroix wrote:
>
> I read the end of your mail too late. The following works with lambda 
> functions. 
>
> sage: S = FiniteEnumeratedSet([1,2,3]) 
> sage: T = FiniteEnumeratedSet([4,5,6,7]) 
> sage: d = {1:5, 2:7, 3:5} 
> sage: f = S.hom(lambda x: d[x], T) 
> sage: f(1) 
> 5 
> sage: f(2) 
> 7 
> sage: f(3) 
> 5 
>
> Otherwise you should have a look at FiniteSetMaps. 
>
> On 18/04/16 19:48, Vincent Delecroix wrote: 
> > It should... but Sage does not recognize that 2 belongs to S. Note that 
> > the following works 
> > 
> > sage: S = FiniteEnumeratedSet([1,2,3]) 
> > sage: T = FiniteEnumeratedSet([4,5,6,7]) 
> > sage: f = S.hom(lambda x: 3+x, T) 
> > sage: f(1) 
> > 4 
> > 
> > Vincent 
> > 
> > On 18/04/16 15:02, John H Palmieri wrote: 
> >> How do I define a function between finite sets within the category 
> >> framework? Should the following work? 
> >> 
> >>  sage: S = Set([1,2,3]) 
> >>  sage: T = Set([4,5,6,7]) 
> >>  sage: f = S.hom(lambda x: 3+x, T) 
> >>  sage: f 
> >>  Generic morphism: 
> >>From: {1, 2, 3} 
> >>To:   {4, 5, 6, 7} 
> >>  sage: f(2) 
> >> 
> >> 
> --- 
> >> 
> >>  TypeError Traceback (most recent 
> >> call 
> >> last) 
> >>   
> >>  TypeError: 2 fails to convert into the map's domain {1, 2, 3}, but 
> a 
> >> `pushforward` method is not properly implemented 
> >> 
> >> I see that it works if I define S and T using FiniteEnumeratedSet 
> >> instead. 
> >> Is that the best solution? 
> >> 
> >> Or suppose I want to define a map sending 1 to 5, 2 to 7, 3 to 5. I 
> can't 
> >> see how to use the dictionary {1:5, 2:7, 3:5} (for example) to define a 
> >> function. 
> >> 
> >> In general, I would like fully functional, callable, composable 
> morphisms 
> >> of sets, and finite sets are good enough for now. Any advice? Also of 
> >> other 
> >> categories, in particular finite abelian groups, but maybe those work 
> >> better already? 
> >> 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Issue build sagemath 7.2 from source.

2016-05-17 Thread John H Palmieri


On Tuesday, May 17, 2016 at 9:25:23 AM UTC-7, Pietro Liguori wrote:
>
>
> gcc version is 4.9.3 !
>

That is the version Sage is trying to build, but it needs some version to 
get started. Early in the log file, it says

"gcc version 3.4.3"

This is the version installed on your machine, and it is too old to build gcc 
4.9.3.


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] How do I build Sage 7.2 on ubuntu 16.04? Build fails in atlas-3.10.2.p2

2016-07-21 Thread John H Palmieri


On Thursday, July 21, 2016 at 4:38:38 AM UTC-7, Paul Leopardi wrote:
>
> On Thursday, 21 July 2016 08:57:55 UTC+10, Paul Leopardi wrote:
>>
>>
>> The build now gets past the point where it failed previously. 
>>
>>
> The build now fails in dochtml with a problem that looks like this WONTFIX 
> bug:  https://trac.sagemath.org/ticket/18891
>

Does the branch at https://trac.sagemath.org/ticket/21014 fix it? That 
branch will actually be merged soon, as opposed to whatever is at #18891.

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: tab-completion in new IPython-command line

2016-08-28 Thread John H Palmieri
I have exactly the same question. Anyone? Is it some IPython setting that 
we can change?

  John


On Thursday, August 25, 2016 at 9:17:01 AM UTC-7, Daniel Krenn wrote:
>
> Pressing TAB after a dot on some object gives (in the recent 7.4.beta1) 
> this: 
>
> sage: M = Matrix([1]) 
> sage: M. 
>   M.act_on_polynomial   M.anticommutator 
>   M.add_multiple_of_column  M.antitranspose 
>   M.add_multiple_of_row M.apply_map   > 
>   M.additive_order  M.apply_morphism 
>   M.adjoint M.as_bipartite_graph 
>
> This looks nice, but is it possible to see more/all methods at once? 
>
> When searching for something (a method) of some object (with many 
> methods) it is convenient to see the whole list at once. This also 
> allows (allowed) copying&grepping for some keywords. 
> So: 
> - Is there a way to display more at once? 
> - How to navigate back and forth easily? 
> (All this relates to the command line interface.) 
>
> Best 
>
> Daniel 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: tab-completion in new IPython-command line

2016-09-02 Thread John H Palmieri
I found one way to view more methods: hit Ctrl-L to clear the screen first, 
and/or use a larger terminal window. If your "sage:" prompt is at the very 
bottom of a terminal window, it will only include a few lines of methods 
when you hit the TAB key, but if the prompt is at the top of the window, it 
uses all of that available space, so it displays more methods. Still not 
ideal, or at least not what I'm used to.

This new version of tab completion is provided by the prompt_toolkit 
package, and there are some pull requests on its github page to allow for 
more ways to navigate the pop-up window (e.g., allow the left and right 
arrows to switch columns), but those do not seem to have been implemented 
yet (or at least, they don't work on my computer). I also don't see any 
obvious ways to customize this display.

  John


On Thursday, August 25, 2016 at 9:17:01 AM UTC-7, Daniel Krenn wrote:
>
> Pressing TAB after a dot on some object gives (in the recent 7.4.beta1) 
> this: 
>
> sage: M = Matrix([1]) 
> sage: M. 
>   M.act_on_polynomial   M.anticommutator 
>   M.add_multiple_of_column  M.antitranspose 
>   M.add_multiple_of_row M.apply_map   > 
>   M.additive_order  M.apply_morphism 
>   M.adjoint M.as_bipartite_graph 
>
> This looks nice, but is it possible to see more/all methods at once? 
>
> When searching for something (a method) of some object (with many 
> methods) it is convenient to see the whole list at once. This also 
> allows (allowed) copying&grepping for some keywords. 
> So: 
> - Is there a way to display more at once? 
> - How to navigate back and forth easily? 
> (All this relates to the command line interface.) 
>
> Best 
>
> Daniel 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Calculating with homology classes, getting coordinates

2016-09-09 Thread John H Palmieri
If you're willing to work with field coefficients, there is the method 
"homology_with_basis":

sage: T = simplicial_complexes.Torus()
sage: H = T.homology_with_basis()
sage: H
Homology module of Minimal triangulation of the torus over Rational Field
sage: H.basis()
Finite family {(2, 0): h_{2,0}, (1, 0): h_{1,0}, (0, 0): h_{0,0}, (1, 1): 
h_{1,1}}
sage: h10 = H.basis()[1,0]; h10
h_{1,0}
sage: h11 = H.basis()[1,1]
sage: x = h10 + 3/2 * h11
sage: x.to_cycle()  # a representative of x as a linear combination of 
chains
(0, 1) + 3/2*(0, 2) - (0, 3) - 3/2*(0, 5) + (1, 3) + 3/2*(2, 5)

-- 
John

On Friday, September 9, 2016 at 8:28:31 AM UTC-7, Albert Haase wrote:
>
> For an abstract finite simplicial complex C, the method 
> homology(algorithm='auto',generators=True) uses CHomP to compute the 
> homology groups and their generators. The generators are conveniently 
> expressed as sums of simplices from C rather than as coefficient vectors of 
> chains from the chain complex. Assume we manipulate the generators, for 
> instance by letting a group act on them.
>
> (1) Are there sage functions, or a "setting", that allows us to calculate 
> with homology classes, where representatives of the classes are expressed 
> as sums of simplices from the simplicial complex C?
>
> (2) Is there a sage function that takes an element of a homology group 
> (represented by a sum of simplices from C) and returns its coordinates 
> w.r.t. a basis of the homology group?
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How do I count the number of simple cycles in a graph?

2016-10-04 Thread John H Palmieri


On Tuesday, October 4, 2016 at 8:39:38 PM UTC-7, Kristaps Balodis wrote:
>
>
>
> I seem to be confused about the language here.  For instance when asking 
> about simple cycles in the Peterson graph it gives things like [0,4,0] but 
> the petersen graph doesn't have any cycles shorter than length 5...
>

The previous answer deals with a directed graph version of the Petersen 
graph, where each edge in the original is replaced by a pair of directed 
edges, one in each direction. For the undirected case you could try 
g.cycle_basis(...): see 
http://doc.sagemath.org/html/en/reference/graphs/sage/graphs/generic_graph.html#sage.graphs.generic_graph.GenericGraph.cycle_basis.


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Sage 7.2 not starting up under Mac OS X ver. 10.12

2016-10-07 Thread John H Palmieri


On Friday, October 7, 2016 at 9:51:21 AM UTC-7, slelievre wrote:
>
>
>
> Le vendredi 7 octobre 2016 10:14:34 UTC+2, Samuel Dupree a écrit :
>>
>> I'm attempting to run Sage 7.2 on a MacBook Pro running Mac OS X ver. 
>> 10.12 (Sierra). Sage won't start up and it gives me the following messages: 
>>
>>
>> Last login: Fri Oct  7 00:13:52 on ttys000 
>> '/Applications/SageMath-7.3.app/Contents/Resources/sage/sage' 
>> --notebook=sagenb 
>> -bash: /Applications/mesasdk/bin/mesasdk_init.sh: No such file or 
>> directory 
>> users-MacBook-Pro:~ user$ 
>> '/Applications/SageMath-7.3.app/Contents/Resources/sage/sage' 
>> --notebook=sagenb 
>> sys:1: RuntimeWarning: not adding directory '' to sys.path since it's 
>> writable by an untrusted group. 
>> Untrusted users could put files in this directory which might then be 
>> imported by your Python code. As a general precaution from similar 
>> exploits, you should not execute Python code from this directory 
>> ┌┐ 
>> │ SageMath version 7.3, Release Date: 2016-08-04 │ 
>> │ Type "notebook()" for the browser-based notebook interface.│ 
>> │ Type "help()" for help.│ 
>> └┘ 
>> Please wait while the old SageNB Notebook server starts... 
>> Setting permissions of DOT_SAGE directory so only you can read and write 
>> it. 
>> Traceback (most recent call last): 
>> ...
>> OSError: [Errno 1] Operation not permitted: '*/Users/user/*.sage/' 
>> users-MacBook-Pro:~ user$ 
>>
>> Any suggestions? 
>>
>> Sam Dupree.
>>
>
> Did you install Sage before upgrading to macOS 10.12 Sierra?
> Or did you have Sage installed under OS X 10.11 El Capitan
> and then upgrade to macOS 10.12 Sierra?
>
> Progress on building Sage for macOS 10.12 Sierra is tracked
> at Sage trac ticket #21567:
>
>   https://trac.sagemath.org/ticket/21567
>
>
Yes, but pre-built binaries for OS X 10.11 work on OS X 10.12 (at least in 
my experience). My guess is that's what the poster is using.

  John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Element vs UniqueRepresentation

2016-10-07 Thread John H Palmieri
Can I define a class which inherits from both Element and 
UniqueRepresentation? It doesn't seem like it:

sage: from sage.structure.element import Element
sage: class A(Element, UniqueRepresentation): pass
---
TypeError Traceback (most recent call last)
 in ()
> 1 class A(Element, UniqueRepresentation): pass

TypeError: Error when calling the metaclass bases
metaclass conflict: the metaclass of a derived class must be a 
(non-strict) subclass of the metaclasses of all its bases

How can I work around this?

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Element vs UniqueRepresentation

2016-10-08 Thread John H Palmieri


On Friday, October 7, 2016 at 6:21:45 PM UTC-7, Nils Bruin wrote:
>
> On Friday, October 7, 2016 at 10:47:55 AM UTC-7, John H Palmieri wrote:
>>
>> TypeError: Error when calling the metaclass bases
>> metaclass conflict: the metaclass of a derived class must be a 
>> (non-strict) subclass of the metaclasses of all its bases
>>
> Yes, python doesn't support multiple metaclass inheritance (its design 
> really prevents it), so I'd think this is a hard obstruction.
>
> sage: M=UniqueRepresentation.__metaclass__
> sage: M.mro(M)
> [,
>  ,
>  ,
>  ]
> sage: E=Element.__getmetaclass__(1)
> sage: E.mro(E)
> [,
>  ,
>  ]
>
> prior to https://trac.sagemath.org/ticket/18329 your example worked.
>
> Of course, if you want UniqueRepresentation (do you really want that? it's 
> got a lot of drawbacks) you wouldn't really care about inheriting 
> comparison, but that doesn't help you.
>

What are all of the drawbacks?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Summation bug in Sage? In Maxima?

2016-11-02 Thread John H Palmieri
Sage is not computing a particular infinite sum correctly.

sage: sum(1/((n+1)*(2*n-1)), n, 0, 1000).n()
-0.205068171626375
sage: sum(1/((n+1)*(2*n-1)), n, 0, 1).n()
-0.204618542543703
sage: sum(1/((n+1)*(2*n-1)), n, 0, 10).n()  # seems to be converging
-0.204573546255870
sage: sum(1/((n+1)*(2*n-1)), n, 0, oo).n()  # but not to this number
-1.09345743518226

sage: sum(1/((n+1)*(2*n-1)), n, 0, oo)
2/3*log(2) - 14/9

I think the answer should be 2/3*log(2) - 2/3 -- that's what Mathematica 
says, and it is also consistent with the partial sums. (See 
https://ask.sagemath.org/question/35354/sage-seems-to-be-improperly-computing-an-infinite-sum-and-giving-an-incorrect-answer/.)
 
Is this a bug in Maxima? I don't know enough about Maxima's syntax to 
evaluate it directly there. Just for kicks, I also installed "giac", since 
that was listed as an option for the "algorithm" keyword for "sum":

sage: sum(1/((n+1)*(2*n-1)), n, 0, oo, algorithm='giac')
+Infinity

Not an improvement.

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Summation bug in Sage? In Maxima?

2016-11-02 Thread John H Palmieri
Thanks. The Sage trac ticket is https://trac.sagemath.org/ticket/21801 
(thanks to kcrisman).

  John


On Wednesday, November 2, 2016 at 4:17:00 PM UTC-7, Dima Pasechnik wrote:
>
> This is now https://sourceforge.net/p/maxima/bugs/3236/
>
>
> On Wednesday, November 2, 2016 at 11:06:45 PM UTC, Dima Pasechnik wrote:
>>
>> It is a bug in Maxima (I also checked with Maxima compiled with SBCL, 
>> another lisp compiler, more popular than ECL we use). I think it does not 
>> pay attention
>> to the 0th term being negative.
>> Indeed, if you sum from 1, not from 0, it correctly
>> outputs (2 log(2)+1)/3.
>>
>> Dima
>>
>> On Wednesday, November 2, 2016 at 7:09:13 PM UTC, John H Palmieri wrote:
>>>
>>> Sage is not computing a particular infinite sum correctly.
>>>
>>> sage: sum(1/((n+1)*(2*n-1)), n, 0, 1000).n()
>>> -0.205068171626375
>>> sage: sum(1/((n+1)*(2*n-1)), n, 0, 1).n()
>>> -0.204618542543703
>>> sage: sum(1/((n+1)*(2*n-1)), n, 0, 10).n()  # seems to be converging
>>> -0.204573546255870
>>> sage: sum(1/((n+1)*(2*n-1)), n, 0, oo).n()  # but not to this number
>>> -1.09345743518226
>>>
>>> sage: sum(1/((n+1)*(2*n-1)), n, 0, oo)
>>> 2/3*log(2) - 14/9
>>>
>>> I think the answer should be 2/3*log(2) - 2/3 -- that's what Mathematica 
>>> says, and it is also consistent with the partial sums. (See 
>>> https://ask.sagemath.org/question/35354/sage-seems-to-be-improperly-computing-an-infinite-sum-and-giving-an-incorrect-answer/.)
>>>  
>>> Is this a bug in Maxima? I don't know enough about Maxima's syntax to 
>>> evaluate it directly there. Just for kicks, I also installed "giac", since 
>>> that was listed as an option for the "algorithm" keyword for "sum":
>>>
>>> sage: sum(1/((n+1)*(2*n-1)), n, 0, oo, algorithm='giac')
>>> +Infinity
>>>
>>> Not an improvement.
>>>
>>> -- 
>>> John
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: SSL module not available

2016-11-11 Thread John H Palmieri


On Friday, November 11, 2016 at 2:31:38 AM UTC-8, Dima Pasechnik wrote:
>
> Could you try first
>
> sage -i openssl
>
> and only then
>
> sage -i pyopenssl
>
>
Do you need to run "sage -f python2" in between these, to make sure Python 
builds its ssl module?
 

>
>
> On Monday, November 7, 2016 at 1:10:56 PM UTC, Eden Harder wrote:
>>
>> There is some errors when I install pyopenssl
>>
>> eden:~ Eden$ sage -i pyopenssl
>>
>> /Library/Developer/CommandLineTools/usr/bin/make build/make/Makefile
>>
>> make[1]: `build/make/Makefile' is up to date.
>>
>> build/bin/sage-logger \
>>
>> "cd build/make && ./install 'all-toolchain'" logs/install.log
>>
>> *** ALL ENVIRONMENT VARIABLES BEFORE BUILD: ***
>>
>>
>> Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.sSTWvhcHlD/Render
>>
>> HOME=/Users/Eden
>>
>> LANG=en_US.UTF-8
>>
>> LOGNAME=Eden
>>
>> MAKE=make
>>
>> MAKEFLAGS=
>>
>> MAKELEVEL=1
>>
>>
>> MANPATH=/Users/Eden/.nvm/versions/node/v4.1.1/share/man:/Users/Eden/.cabal/share/man:/usr/share/man:/usr/local/share/man:/Library/Developer/CommandLineTools/usr/share/man
>>
>> MFLAGS=
>>
>> NVM_BIN=/Users/Eden/.nvm/versions/node/v4.1.1/bin
>>
>> NVM_CD_FLAGS=
>>
>> NVM_DIR=/Users/Eden/.nvm
>>
>> NVM_IOJS_ORG_MIRROR=https://iojs.org/dist
>>
>> NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist
>>
>> NVM_PATH=/Users/Eden/.nvm/versions/node/v4.1.1/lib/node
>>
>>
>> PATH=/Applications/SageMath-7.4.app/Contents/Resources/sage/build/bin:/Applications/SageMath-7.4.app/Contents/Resources/sage/src/bin:/Applications/SageMath-7.4.app/Contents/Resources/sage/local/bin:/Users/Eden/.nvm/versions/node/v4.1.1/bin:/Users/Eden/.cabal/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
>>
>> PWD=/Applications/SageMath-7.4.app/Contents/Resources/sage/build/make
>>
>> PYTHONPATH=/Applications/SageMath-7.4.app/Contents/Resources/sage/local
>>
>>
>> SAGE_EXTCODE=/Applications/SageMath-7.4.app/Contents/Resources/sage/local/share/sage/ext
>>
>> SAGE_LOCAL=/Applications/SageMath-7.4.app/Contents/Resources/sage/local
>>
>> SAGE_LOGS=/Applications/SageMath-7.4.app/Contents/Resources/sage/logs/pkgs
>>
>>
>> SAGE_ORIG_PATH=/Users/Eden/.nvm/versions/node/v4.1.1/bin:/Users/Eden/.cabal/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
>>
>> SAGE_ORIG_PATH_SET=True
>>
>> SAGE_ROOT=/Applications/SageMath-7.4.app/Contents/Resources/sage
>>
>>
>> SAGE_SHARE=/Applications/SageMath-7.4.app/Contents/Resources/sage/local/share
>>
>>
>> SAGE_SPKG_INST=/Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed
>>
>> SAGE_SRC=/Applications/SageMath-7.4.app/Contents/Resources/sage/src
>>
>> SAGE_VERSION=7.4
>>
>> SHELL=/bin/bash
>>
>> SHLVL=5
>>
>> SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.8KPRZOK9hq/Listeners
>>
>> TERM=xterm-256color
>>
>> TERM_PROGRAM=Apple_Terminal
>>
>> TERM_PROGRAM_VERSION=361.1
>>
>> TERM_SESSION_ID=76996F3D-68D2-4974-80A9-0D671234B318
>>
>> TMPDIR=/var/folders/1n/kzz_j7g519d482trw8xfx4xhgn/T/
>>
>> USER=Eden
>>
>> XPC_FLAGS=0x0
>>
>> XPC_SERVICE_NAME=0
>>
>> _=/usr/bin/env
>>
>> __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
>>
>> ***
>>
>> make base
>>
>> make[2]: Nothing to be done for `base'.
>>
>> env SAGE_BUILD_TOOLCHAIN=yes make toolchain
>>
>> make[2]: Nothing to be done for `toolchain'.
>>
>> make toolchain-deps
>>
>> make 
>> /Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/zlib-1.2.8.p0
>>
>> make[3]: 
>> `/Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/zlib-1.2.8.p0'
>>  
>> is up to date.
>>
>> make 
>> /Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/mpir-2.7.2
>>
>> make[3]: 
>> `/Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/mpir-2.7.2'
>>  
>> is up to date.
>>
>> make 
>> /Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/mpfr-3.1.4
>>
>> make[3]: 
>> `/Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/mpfr-3.1.4'
>>  
>> is up to date.
>>
>> make 
>> /Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/mpc-1.0.3.p0
>>
>> make[3]: 
>> `/Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/mpc-1.0.3.p0'
>>  
>> is up to date.
>>
>>
>> real 0m0.128s
>>
>> user 0m0.092s
>>
>> sys 0m0.028s
>>
>> Sage build/upgrade complete!
>>
>>
>> /Library/Developer/CommandLineTools/usr/bin/make build/make/Makefile
>>
>> make[1]: `build/make/Makefile' is up to date.
>>
>> build/bin/sage-logger \
>>
>> "cd build/make && ./install 'pyopenssl'" logs/install.log
>>
>> *** ALL ENVIRONMENT VARIABLES BEFORE BUILD: ***
>>
>>
>> Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.sSTWvhcHlD/Render
>>
>> HOME=/Users/Eden
>>
>> LANG=en_US.UTF-8
>>
>> LOGNAME=Eden
>>
>> MAKE=make
>>
>> M

[sage-support] Re: Development process

2016-12-06 Thread John H Palmieri


On Tuesday, December 6, 2016 at 1:41:22 PM UTC-8, Nils Bruin wrote:
>
> On Tuesday, December 6, 2016 at 1:03:46 PM UTC-8, Justin C. Walker wrote:
>>
>> Hi, all, 
>>
>> I have not done any real Sage development for a while (the last time, I 
>> think, there were wolves in Wales). 
>>
>> I want to work on an existing Trac ticket, and I'm not clear on how to 
>> start this work. 
>>
>
> I usually rely on the git-trac command doing what is supposed to be done:
>
> https://github.com/sagemath/git-trac-command
>  
> For basic operations it has some pretty straightforward commands that 
> don't seem to upset reviewers and release managers too much. For more 
> complicated things you can still fall back on git directly.
>

Me, too. I start with the "develop" branch and install and configure the 
git-trac command as it says in the Developer's Guide 
(http://doc.sagemath.org/html/en/developer/git_trac.html#installing-the-git-trac-command)
 
so I can do things like

git trac checkout 20745

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Displaying graphics from a Sage script

2017-01-13 Thread John H Palmieri
This question comes from 
http://stackoverflow.com/questions/41638257/graphics-in-sage-script: if I 
have a file "foo.sage" and I want to run "sage foo.sage" and have it pop up 
a window displaying a plot, how do I do this?

For example, if foo.sage contains

P = plot(sin(x))
P.show()

then it prints "Graphics object consisting of 1 graphics primitive" rather 
than displaying the plot. I know I can save the plot instead, but is there 
an easy way to display it directly?

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Displaying graphics from a Sage script

2017-01-13 Thread John H Palmieri


On Friday, January 13, 2017 at 3:55:24 PM UTC-8, William wrote:
>
> On Fri, Jan 13, 2017 at 3:50 PM, John H Palmieri  > wrote: 
> > This question comes from 
> > http://stackoverflow.com/questions/41638257/graphics-in-sage-script: if 
> I 
> > have a file "foo.sage" and I want to run "sage foo.sage" and have it pop 
> up 
> > a window displaying a plot, how do I do this? 
> > 
> > For example, if foo.sage contains 
> > 
> > P = plot(sin(x)) 
> > P.show() 
> > 
> > then it prints "Graphics object consisting of 1 graphics primitive" 
> rather 
> > than displaying the plot. I know I can save the plot instead, but is 
> there 
> > an easy way to display it directly? 
>
> I suspect 
>
>   echo "%load 'a.sage'" | sage 
>
> would have to work... 
>

That is an interesting idea, but it doesn't work for me: the graphics file 
is stored in a temporary directory which is deleted once Sage exits. Maybe 
that's a reason this won't work at all.

  John

 

>
> > 
> > -- 
> > John 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sage-support" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to sage-support...@googlegroups.com . 
> > To post to this group, send email to sage-s...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/sage-support. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> William (http://wstein.org) 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Displaying graphics from a Sage script

2017-01-13 Thread John H Palmieri


On Friday, January 13, 2017 at 4:05:59 PM UTC-8, John H Palmieri wrote:
>
>
>
> On Friday, January 13, 2017 at 3:55:24 PM UTC-8, William wrote:
>>
>> On Fri, Jan 13, 2017 at 3:50 PM, John H Palmieri  
>> wrote: 
>> > This question comes from 
>> > http://stackoverflow.com/questions/41638257/graphics-in-sage-script: 
>> if I 
>> > have a file "foo.sage" and I want to run "sage foo.sage" and have it 
>> pop up 
>> > a window displaying a plot, how do I do this? 
>> > 
>> > For example, if foo.sage contains 
>> > 
>> > P = plot(sin(x)) 
>> > P.show() 
>> > 
>> > then it prints "Graphics object consisting of 1 graphics primitive" 
>> rather 
>> > than displaying the plot. I know I can save the plot instead, but is 
>> there 
>> > an easy way to display it directly? 
>>
>> I suspect 
>>
>>   echo "%load 'a.sage'" | sage 
>>
>> would have to work... 
>>
>
> That is an interesting idea, but it doesn't work for me: the graphics file 
> is stored in a temporary directory which is deleted once Sage exits. Maybe 
> that's a reason this won't work at all.
>

I fixed this by adding "sleep(1)" at the end of the file.
 

>
>   John
>
>  
>
>>
>> > 
>> > -- 
>> > John 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> Groups 
>> > "sage-support" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an 
>> > email to sage-support...@googlegroups.com. 
>> > To post to this group, send email to sage-s...@googlegroups.com. 
>> > Visit this group at https://groups.google.com/group/sage-support. 
>> > For more options, visit https://groups.google.com/d/optout. 
>>
>>
>>
>> -- 
>> William (http://wstein.org) 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Displaying graphics from a Sage script

2017-01-13 Thread John H Palmieri


On Friday, January 13, 2017 at 4:12:44 PM UTC-8, John H Palmieri wrote:
>
>
>
> On Friday, January 13, 2017 at 4:05:59 PM UTC-8, John H Palmieri wrote:
>>
>>
>>
>> On Friday, January 13, 2017 at 3:55:24 PM UTC-8, William wrote:
>>>
>>> On Fri, Jan 13, 2017 at 3:50 PM, John H Palmieri  
>>> wrote: 
>>> > This question comes from 
>>> > http://stackoverflow.com/questions/41638257/graphics-in-sage-script: 
>>> if I 
>>> > have a file "foo.sage" and I want to run "sage foo.sage" and have it 
>>> pop up 
>>> > a window displaying a plot, how do I do this? 
>>> > 
>>> > For example, if foo.sage contains 
>>> > 
>>> > P = plot(sin(x)) 
>>> > P.show() 
>>> > 
>>> > then it prints "Graphics object consisting of 1 graphics primitive" 
>>> rather 
>>> > than displaying the plot. I know I can save the plot instead, but is 
>>> there 
>>> > an easy way to display it directly? 
>>>
>>> I suspect 
>>>
>>>   echo "%load 'a.sage'" | sage 
>>>
>>> would have to work... 
>>>
>>
>> That is an interesting idea, but it doesn't work for me: the graphics 
>> file is stored in a temporary directory which is deleted once Sage exits. 
>> Maybe that's a reason this won't work at all.
>>
>
> I fixed this by adding "sleep(1)" at the end of the file.
>

Also, I should add that %load doesn't work for me. I don't know what it's 
supposed to do. I used %attach instead. 

 
>
>>
>>   John
>>
>>  
>>
>>>
>>> > 
>>> > -- 
>>> > John 
>>> > 
>>> > -- 
>>> > You received this message because you are subscribed to the Google 
>>> Groups 
>>> > "sage-support" group. 
>>> > To unsubscribe from this group and stop receiving emails from it, send 
>>> an 
>>> > email to sage-support...@googlegroups.com. 
>>> > To post to this group, send email to sage-s...@googlegroups.com. 
>>> > Visit this group at https://groups.google.com/group/sage-support. 
>>> > For more options, visit https://groups.google.com/d/optout. 
>>>
>>>
>>>
>>> -- 
>>> William (http://wstein.org) 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Properly importing Python modules in Sage

2017-01-24 Thread John H Palmieri
If you are editing a file in the Sage library, you need to run 'sage -b' to 
incorporate your changes.

On Tuesday, January 24, 2017 at 12:58:26 AM UTC-8, pp wrote:
>
> Hi all,
> I'm trying to import one Python module in Sage 7.3 (using `import`). It is 
> properly working. The problem arises when I edit this Python file: Sage is 
> still using the first version of the file. Even after I delete the Python 
> file, it still uses the first version of this file. 
>
> Also, unlike Python, no `pyc` file is generated (I searched with `sudo 
> find . -name ".pyc"`). So, basically I cannot see any possible 
> way to import a Python module after it has been edited.
>
> Can anyone help?
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: [sage 7.4] Error building OpenBlas

2017-02-02 Thread John H Palmieri


On Thursday, February 2, 2017 at 1:53:43 PM UTC-8, João Alberto Ferreira 
wrote:
>
> Well, I read somewhere about this procedure of moving the directory before 
> starting sage, but the Installation Manual seems to tell the same thing.
>
> "The directory where you built Sage is *NOT* hardcoded. You should be 
> able to safely move or rename that directory. (It’s a bug if this is not 
> the case.)"
>  
>

> Chapter 2 describes this same procedure of moving the directory, but for 
> the precompiled binaries, that for me is the same thing.
>

We should fix the documentation. See https://trac.sagemath.org/ticket/22294.

  John

 

>
> But, in fact, what I experienced was what you said. 
>
> On Thursday, February 2, 2017 at 9:28:17 PM UTC+1, HG wrote:
>>
>> I think it has been said on the list : Keep sage where you compiled it !
>>
>> If you want to change it you have to compile source again !
>>
>> what I do because I work with git :
>>
>> I make a dir git 
>>
>> I compile it there and after I link sage in /usr/bin/sage
>>
>> sudo ln -s /path where is sage/sage /usr/bin/sage
>>
>>
>>
>> Le 02/02/2017 à 20:43, João Alberto Ferreira a écrit :
>>
>> Hi!
>>
>> I just removed "/home/mmsim/tools/lib/64bit" from the LD_LIBRARY_PATH 
>> environment variable and sage compiled.
>>
>> I compiled it in my home directory and moved it to /usr/local/ before 
>> starting it, and created a symbolic link in /usr/local/bin/, but it shows me
>>
>> python: error while loading shared libraries: libpython2.7.so.1.0: cannot 
>> open shared object file: No such file or directory
>>
>> It just works in the place where I compiled it. I will leave the things 
>> like that, but I'm curious to know why it do not work. Isn't that correct? 
>> Do I Have made something wrong?
>>
>> Thank you!
>>
>> On Thursday, February 2, 2017 at 12:14:51 PM UTC+1, Dima Pasechnik wrote: 
>>>
>>>
>>>
>>> On Thursday, February 2, 2017 at 10:36:41 AM UTC, João Alberto Ferreira 
>>> wrote: 



 On Wednesday, February 1, 2017 at 7:24:56 PM UTC+1, Dima Pasechnik 
 wrote: 
>
>
>
> On Wednesday, February 1, 2017 at 6:00:25 PM UTC, João Alberto 
> Ferreira wrote: 
>>
>> Well, not yet.
>>
>> openblas has compiled successfully. The problem now is with R. The R 
>> log follows.
>>
>> Apparently it needs libgomp-4 and if I understood correctrly, it 
>> found an older version. But the libgomp-4 is installed
>>
>> [defrancaferr_joa@javel sage-7.5.1]$ rpm -q libgomp
>> libgomp-4.4.7-17.el6.x86_64
>>
>
> your log says:
>  /home/mmsim/tools/lib/64bit/libgomp.so.1 : version `GOMP_4.0' not 
> found
>
> you have some rogue stuff in your PATH or something (LD_LIBRARY_PATH ?)
>

 The environment variables are at the beginning of the whole log file

>>>
>>> OK, I overlooked this...
>>>  
>>>


 LD_LIBRARY_PATH=/opt/rh/devtoolset-3/root/usr/lib64:/opt/rh/devtoolset-3/root/usr/lib:/usr/local/lib:/home/mmsim/tools/lib/64bit


 PATH=/home/defrancaferr_joa/sage-7.5.1/build/bin:/home/defrancaferr_joa/sage-7.5.1/src/bin:/home/defrancaferr_joa/sage-7.5.1/local/bin:/opt/rh/devtoolset-3/root/usr/bin:/home/xfab/xkit/x_all/cadence/xenv:/usr/local/ADS2014_01/bin:/usr/local/texlive/2016/bin/x86_64-linux:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/defrancaferr_joa/bin:/home/eclipse:/home/matlab/bin:/home/altera/15.0/quartus/bin:/home/altera/15.0/quartus/sopc_builder/bin:/home/altera/15.0/quartus/bin:/home/ic6.1/tools/bin:/home/ic6.1/tools/dfII/bin:/home/ic6.1/tools/plot/bin:/home/ic6.1/tools/dracula/bin:/home/assura/tools/bin:/home/assura/tools/assura/bin:/home/AMS_4.10/cds/bin:/home/AMS_4.10/programs/bin:/home/mmsim/tools/bin:/home/incisiv/tools/bin:/home/incisiv/tools/dfII/bin:/home/rc/tools/bin:/home/edi/tools/bin:/home/et/tools/bin:/home/ets/tools/bin:/home/ext/tools/bin:/home/confrml/tools/bin:/home/ctos/tools/bin:/home/pve:/home/pve/tools/bin


>>> yes, this is definitely the problem.
>>> You can just unset these for the particular invocation of make, i.e.
>>>
>>> export MAKE="make -j8" # or whatever numer of cores you have on the box
>>> PATH="/bin:/usr/bin:/sbin:/usr/sbin" LD_LIBRARY_PATH="" $MAKE
>>>
>>> Note that these wrong libraries could have been already selected by other
>>> parts that are already built, and this may lead to hard to understand 
>>> crashes etc.
>>>
>>> That is, I would rebuild from scratch, i.e. do first of all
>>>
>>> make distclean
>>>
>>> HTH
>>> Dima
>>>  
>>>
 [defrancaferr_joa@javel sage-7.5.1]$ find 
 /opt/rh/devtoolset-3/root/usr/lib64/ -name "libgomp*" -exec ls -ls {} \;
 [defrancaferr_joa@javel sage-7.5.1]$ find 
 /opt/rh/devtoolset-3/root/usr/lib/ -name "libgomp*" -exec ls -ls {} \;
 4 -rw-r--r--. 1 root root 82  3 oct.   2015 
 /opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2/libgomp.so
 4 -rw-r--r--. 1 root

[sage-support] Re: Sage Crash Report. appears to have loaded, failed to run.

2017-03-07 Thread John H Palmieri
Just about the last line in your crash report says

   ImportError: libgfortran.so.3: cannot open shared object file: No such file 
or directory


So you need to install gfortran, however that is done with Fedora. An 
internet search suggests something like "yum install gcc-gfortran".

-- 
John



On Tuesday, March 7, 2017 at 6:05:05 PM UTC-8, wem...@uccs.edu wrote:
>
>
>
> Team SageMath,
>
>  
>
> Thankyou for providing the email address
>
>  
>
> Sage will not load and run properly on my Fedora Linux System (used the 
> latest Linux build Sage-7.5.1-Fedora).  
>
>  
>
> Printed out readme file you provided, and executed it to the best of my 
> ability.  Sage crashed, not sure why.  No directory was specified regarding 
> installation, so I created a course directory cs5920 and installed it there.
>
>  
>
> However, I cannot get it to run.  I verified I had all the correct 
> programs gcc, make, m4, perl, rnalib, and tar.  I have 
> perl-ExtUtils-MakeMaker package as well allthough I did not know 
> (--vversion didn't work) until I tried to install the package, then Lenix 
> told me.
>
>  
>
> I am using Fedora 25 on an I5 core machine.
>
>  
>
> Any help getting it to run would be most appreciated.
>
>  
>
> Following are installed:
>
> $*gcc --version*
>
> gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
>
> Copyright (C) 2016 Free Software Foundation, Inc.
>
> This is free software; see the source for copying conditions. There is NO
>
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>  
>
> $*make --version*
>
> GNU Make 4.1
>
> Built for x86_64-redhat-linux-gnu
>
> Copyright (C) 1988-2014 Free Software Foundation, Inc.
>
> License GPLv3+: GNU GPL version 3 or later <
> http://gnu.org/licenses/gpl.html>
>
> This is free software: you are free to change and redistribute it.
>
> There is NO WARRANTY, to the extent permitted by law.
>
>  
>
> *$m4 --version*
>
> m4 (GNU M4) 1.4.17
>
> Copyright (C) 2013 Free Software Foundation, Inc.
>
> License GPLv3+: GNU GPL version 3 or later <
> http://gnu.org/licenses/gpl.html>.
>
> This is free software: you are free to change and redistribute it.
>
> There is NO WARRANTY, to the extent permitted by law.
>
> Written by Rene' Seindal.
>
>  
>
> $*perl --version*
>
>  
>
> This is perl 5, version 24, subversion 1 (v5.24.1) built for 
> x86_64-linux-thread-multi
>
> (with 63 registered patches, see perl -V for more detail)
>
> Copyright 1987-2017, Larry Wall
>
> Perl may be copied only under the terms of either the Artistic License or 
> the
>
> GNU General Public License, which may be found in the Perl 5 source kit.
>
> Complete documentation for Perl, including FAQ lists, should be found on
>
> this system using "man perl" or "perldoc perl". If you have access to the
>
> Internet, point your browser at http://www.perl.org/, the Perl Home Page.
>
>  
>
> *$ranlib --version*
>
> GNU ranlib version 2.26.1-1.fc25
>
> Copyright (C) 2015 Free Software Foundation, Inc.
>
> This program is free software; you may redistribute it under the terms of
>
> the GNU General Public License version 3 or (at your option) any later 
> version.
>
> This program has absolutely no warranty.
>
>  
>
> *$tar --version*
>
> tar (GNU tar) 1.29
>
> Copyright (C) 2015 Free Software Foundation, Inc.
>
> License GPLv3+: GNU GPL version 3 or later <
> http://gnu.org/licenses/gpl.html>.
>
> This is free software: you are free to change and redistribute it.
>
> There is NO WARRANTY, to the extent permitted by law.
>
> Written by John Gilmore and Jay Fenlason.
>
>  
>
> *$ dnf install perl-ExtUtils-MakeMaker*
>
> Last metadata expiration check: 0:55:22 ago on Sat Mar  4 14:07:46 2017.
>
> Package perl-ExtUtils-MakeMaker-7.24-1.fc25.noarch is already installed, 
> skipping.
>
> Dependencies resolved.
>
> Nothing to do.
>
> Complete!
>
>  
>
>  
>
>  
>
> V/r, Bill
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Multivariate polynomial coefficients including zeros

2017-03-15 Thread John H Palmieri
 As I posted at 
http://stackoverflow.com/questions/42812634/multivariate-polynomial-coefficients-including-zeros,
 
you could use lcm(f.monomials()) to get the least common multiple of the 
monomials in f, and then plug that into P.monomial_all_divisors(lcm(...)) 
to get all monomials which divide that, which should be the ones you want.

- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: OS X 10.12

2017-03-31 Thread John H Palmieri
 This looks strange. It ought to look like this the first time you run 
Sage, and this is what happens when I download and install from that file:

Rewriting paths for your new installation directory
===

This might take a few minutes but only has to be done once.

(and then hundreds of lines about patching files)


If you didn't see that, something is going wrong. Can you describe exactly 
what you did? Maybe you should delete the old dmg file and redownload it, 
in case it was corrupted somehow.

-- 
John



-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: OS X 10.12

2017-03-31 Thread John H Palmieri
Is is also possible that a homebrew installation is interfering? I have 
seen claims that it can interfere with building Sage from scratch, but I 
don't see why it would cause problems with installing from a pre-built 
binary.

  John


On Friday, March 31, 2017 at 4:09:05 PM UTC-7, Volker Braun wrote:
>
> There is supposed to be a script called "relocate-once.py" next to the 
> sage launch script that is missing for you. It runs automatically when you 
> start sage for the first time and then delets itself. I don't know how you 
> lost that file...
>
> On Tuesday, March 7, 2017 at 8:14:01 PM UTC+1, crown...@gmail.com wrote:
>>
>> Does SAGE work on OS X 10.12?  I moved SageMath to my applications 
>> directory and then
>>
>> ┐
>> │ SageMath version 7.5.1, Release Date: 2017-01-15   │
>> │ Type "notebook()" for the browser-based notebook interface.│
>> │ Type "help()" for help.│
>> └┘
>>
>> ERROR:  The Sage installation tree has moved
>>
>> from 
>> /Users/buildslave-sage/slave/binary_pkg/build/source/SageMath/jc4b6yulaujayb9sr94ia88eourzeqip0oidma
>>   to /Applications/SageMath
>>
>> This is not supported, and Sage will not work. To install Sage from a
>> binary package:
>>
>> 1. Open the .tar.bz2 archive (or .dmg on OSX)
>>
>> 2. Move the SageMath folder/app to where you want it to be. You can
>>also rename the directory now.
>>
>> 3. Start sage for the first time. This will then automatically patch
>>paths in binaries.
>>
>> After starting Sage for the first time you cannot change the
>> installation any more. To install Sage elsewhere, start over from the
>> binary package. Or recompi
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: OS X 10.12

2017-04-01 Thread John H Palmieri


On Friday, March 31, 2017 at 3:36:11 PM UTC-7, crown...@gmail.com wrote:
>
> I downloaded the dmg file, moved the sagemath directory to Applications, 
> then double clicked on sage. 
> I also tried it through home-brew and also got an error (below). Has 
> anyone done a fresh install with an apple running the latest version of OS 
> X?
>

Yes, I did this before my first response in this thread, to make sure it 
works for me. I downloaded both the dmg and the tar.bz2 files, installed 
from each, and it worked fine. I also build from source regularly on OS X 
10.12.4.

 

>
> The easiest thing for me to do was download linux in a virtual box and run 
> it sage off Linux, however I can’t connect to the sage server (even though 
> I can successfully SSH to the virtual machine). Any suggestions. 
>
>
> RecursionError: maximum recursion depth exceeded during compilation
> ┌┐
> │ SageMath version 7.5.1, Release Date: 2017-01-15   │
> │ Type "notebook()" for the browser-based notebook interface.│
> │ Type "help()" for help.│
> └┘
>
> ERROR:  The Sage installation tree has moved
>
> from 
> /Users/buildslave-sage/slave/binary_pkg/build/source/SageMath/jc4b6yulaujayb9sr94ia88eourzeqip0oidma
>   to /Applications/SageMath-7.5.1.app/Contents/Resources/sage
>
> This is not supported, and Sage will not work. To install Sage from a
> binary package:
>
> 1. Open the .tar.bz2 archive (or .dmg on OSX)
>
> 2. Move the SageMath folder/app to where you want it to be. You can
>also rename the directory now.
>
> 3. Start sage for the first time. This will then automatically patch
>paths in binaries.
>
> After starting Sage for the first time you cannot change the
> installation any more. To install Sage elsewhere, start over from the
> binary package. Or recompile Sage from scratch in the new location
> ("make distclean && make")
>
> snapdragon:~ joshua$ 
>
>
>
>
>
> On Mar 31, 2017, at 5:49 PM, John H Palmieri  > wrote:
>
>  This looks strange. It ought to look like this the first time you run 
> Sage, and this is what happens when I download and install from that file:
>
> Rewriting paths for your new installation directory
> ===
>
> This might take a few minutes but only has to be done once.
>
> (and then hundreds of lines about patching files)
>
>
> If you didn't see that, something is going wrong. Can you describe exactly 
> what you did? Maybe you should delete the old dmg file and redownload it, 
> in case it was corrupted somehow.
>
> -- 
> John
>
>
>
>
> -- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/sage-support/MRhTG336Fr0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> sage-support...@googlegroups.com .
> To post to this group, send email to sage-s...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: class question: addition in an Algebra

2008-04-15 Thread John H Palmieri



On Apr 14, 9:02 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Wed, Apr 9, 2008 at 1:21 PM, John Palmieri <[EMAIL PROTECTED]> wrote:
>
> >  I'm trying to define a class based on Algebra, and I'm having
> >  problems.  I think the issue is that I don't understand how coercion
> >  is supposed to work.
>
> >  Right now I have
>
> >   def class SteenrodAlgebra(Algebra)
>
> >  and
>
> >   def class SteenrodAlgebraElement(AlgebraElement)
>
> >  In the second one, I've defined an _add_ method.  Should I also define
> >  an __add__ method explicitly, or should I do something with coercion
> >  and the class SteenrodAlgebra?
>
> You should not define __add__.  Just define _coerce_impl.
>
> (Of course, you already know this since I looked over your
> code in person today.  But I'm answering this email for completeness.)

For more completeness, in case anyone else ever has the same problem
and finds this thread, my problem was that I was trying to add two
elements whose parents [excuse me while I stop being a mathematician
for a second] were equal but not identical.


>
> > I've tried reading the documentation
> >  (like section 11.5.2 in the reference manual), and I've tried reading
> >  various pieces of source code, but I'm just getting confused.
>
> >  Here's the relevant code.
>
> >  steenrod_prime = 2
>
> >  class SteenrodAlgebra(Algebra):
>
> > def __init__(self, p=steenrod_prime):
> > """
> > INPUT:
> > p: positive prime integer
>
> > return mod p Steenrod algebra
> > """
> > if is_prime(p):
> > self.prime = p
> > ParentWithGens.__init__(self, GF(p))
> > else:
> > raise ValueError, "%s is not prime." % p
>
> > def __repr__(self):
> > return "mod %d Steenrod algebra" % self.prime
>
> > def __eq__(self,right):
> > return type(self) == type(right) and \
> >self.prime == right.prime
>
> > def __call__(self, x):
> > if isinstance(x, SteenrodAlgebraElement) and x.parent() is
> >  self:
> > return x
> > else:
> > return SteenrodAlgebraElement(self,x)
>
> > # I don't know how to write this.
> > # I took this from FreeAlgebraQuotient, I think.
> > def _coerce_impl(self, x):
> > """
> > Return the coercion of x into this Steenrod algebra.
>
> > The algebras that coerce into this quotient ring are:
> >* this Steenrod algebra
> >* its base field
> > """
> > return self._coerce_try(x, [self, self.base_ring()])
>
> > def __contains__(self, x):
> > return isinstance(x, SteenrodAlgebraElement) and x.parent() ==
> >  self
>
> >  class SteenrodAlgebraElement(AlgebraElement):
>
> > def __init__(self, poly, p=steenrod_prime):
> > """
> > INPUT:
> > poly: dictionary with entries of form (monomial,
> >  coefficient)
> > Each coefficient is in GF(p), and each monomial is a tuple
> > of non-negative integers (a, b, c, ...), corresponding to
> > the Milnor basis element Sq(a, b, c, ...).
> > p: positive prime number (default steenrod_prime)
> > """
> > if is_prime(p):
> > if p == 2:
> > RingElement.__init__(self,SteenrodAlgebra(p))
> > F = parent(self).base_ring()
> > self.base_field = F
> > new_poly = {}
> > for mono in poly:
> > trimmed = check_and_trim(mono)
> > if new_poly.has_key(trimmed):
> > coeff = F(poly[mono] + new_poly[trimmed])
> > else:
> > coeff = F(poly[mono])
> > if not coeff.is_zero():
> > new_poly[trimmed] = coeff
> > self.elt = new_poly
> > else:
> > raise NotImplementedError, "Only the mod 2 Steenrod
> >  algebra has been implemented"
> > else:
> > raise ValueError, "%s is not prime." % p
>
> > def _add_(self, other):
> > F = self.base_field
> > poly1 = self.elt
> > poly2 = other.elt
> > for mono in poly2:
> > if poly1.has_key(mono):
> > coeff = F(poly1[mono] + poly2[mono])
> > else:
> > coeff = F(poly2[mono])
> > if coeff == 0:
> > del poly1[mono]
> > else:
> > poly1[mono] = coeff
> > return SteenrodAlgebraElement(poly1)
>
> >  # should I do this?
> >  # def __add__(self, other):
> >  # return (self._add_(other))
>
> --
> 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 

[sage-support] what are the optional packages?

2008-04-26 Thread John H Palmieri

What are the optional packages? Right now if I type 'sage -optional',
I get a list like this:

NOT INSTALLED:
biopython-1.44
database_sloane_oeis-2005-12

(etc.)

It would be very helpful if I got something like this instead:

NOT INSTALLED:
biopython-1.44   Python modules for
bioinformatics
database_sloane_oeis-2005-12   Encyclopedia of integer sequences

(etc.)

This information should also be present on the web page

  

I found some info by selecting individual packages from the page

  

but even that is pretty spotty, partly because some aren't documented,
and partly because the list from 'sage -optional' doesn't match the
list on that web page.  I still can't tell what "ace-5.0.p0" and
"fricas-1.0.2" are, for example...



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



[sage-support] bug in notebook?

2008-04-30 Thread John H Palmieri

This is with Sage 3.0, Firefox 2.0.0.14, linux.

If I check the little "Typeset" box at the top of the notebook, save
and quit the notebook, then re-enter it, the box is still checked, but
my output is not typeset.  If I uncheck it and then check it again, it
works.

Can anyone else reproduce this?

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



[sage-support] problem with 'view', question about 'view'

2008-05-07 Thread John H Palmieri

A problem: on my linux box, if I use 'view' (not in a notebook), an
xdvi window appears then immediately disappears.  If I run view with
'debug=True', toward the end I get this:

Output written on sage.dvi (1 page, 740 bytes).
Transcript written on sage.log.
gs: Unrecoverable error: limitcheck in .putdeviceprops
xdvik gs_io: Broken pipe
xdvik gs_io: Broken pipe
xdvik gs_io: Broken pipe
ghostscript died unexpectedly.
xdvi.bin: spcl_scan: shouldn't happen: POST encountered, offset 659

Has anyone seen this before?  (This works on my mac, just not on my
linux box.)

And a question: on my mac, suppose I want to use TeXShop instead of
xdvi to display the output of the view command.  Is there a way to do
this?

  John

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



[sage-support] Re: problem with 'view', question about 'view'

2008-05-09 Thread John H Palmieri



On May 9, 9:23 am, "Yi Qiang" <[EMAIL PROTECTED]> wrote:
> This actually bothered me for a while too. There is a patch on the
> trac ticket, please test it out on Linux :-)

Works okay for me.  (By the way, I am unable to reproduce my problem
from a few days ago, either before applying the patch or after.  Maybe
my computer was just acting up?)

> On Thu, May 8, 2008 at 5:16 PM, William Stein <[EMAIL PROTECTED]> wrote:
>
> > On Thu, May 8, 2008 at 5:12 PM, William Stein <[EMAIL PROTECTED]> wrote:
> >> On Wed, May 7, 2008 at 12:26 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
> >>> A problem: on my linux box, if I use 'view' (not in a notebook), an
> >>> xdvi window appears then immediately disappears.  If I run view with
> >>> 'debug=True', toward the end I get this:
>
> >>> Output written on sage.dvi (1 page, 740 bytes).
> >>> Transcript written on sage.log.
> >>> gs: Unrecoverable error: limitcheck in .putdeviceprops
> >>> xdvik gs_io: Broken pipe
> >>> xdvik gs_io: Broken pipe
> >>> xdvik gs_io: Broken pipe
> >>> ghostscript died unexpectedly.
> >>> xdvi.bin: spcl_scan: shouldn't happen: POST encountered, offset 659
>
> >>> Has anyone seen this before?  (This works on my mac, just not on my
> >>> linux box.)
>
> >> I have never seen that before.
>
> >>> And a question: on my mac, suppose I want to use TeXShop instead of
> >>> xdvi to display the output of the view command.  Is there a way to do
> >>> this?
>
> >> The use of xdvi is hardcoded in
>
> >> sage/misc/latex.py
>
> >> so the answer is I guess to change this and submit a patch
> >> or make it a trac ticket.   It's reasonable to consider this
> >> a bug, since view should I think just use the OS X open
> >> command as defined in sage/misc/viewer.py, i.e., use
> >> whatever is the default opener for a dvi file on your system.
>
> >> It's hardcoded xdvi right now since that was some of the first
> >> sage code I ever wrote and that was long before I ported
> >> Sage to run on OS X...
>
> > OK, I made this trac #3137:
>
> >  http://trac.sagemath.org/sage_trac/ticket/3137
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: axes_label in plot appears to be broken

2008-05-13 Thread John H Palmieri



On May 13, 2:31 pm, tkeller <[EMAIL PROTECTED]> wrote:
> Hi all,
> I'm trying to add some simple labels to plots, but axes_label appears
> to not be working in sage-3.0.1.  Ticket # 1508 
> (http://trac.sagemath.org/sage_trac/ticket/1508) reports this as
> fixed, but typing the example given in the ticket info:
>
> s=plot(x^2,(x,0,1))
> s.show(axes_label=['x-axis','y-axis'])

Try axes_labels  (with an s).


> yields
> Traceback (click to the left for traceback)
> ...
> TypeError: show() got an unexpected keyword argument 'axes_label'
>
> axes_label is not listed as an option in show or plot docstrings, has
> this functionality been removed?

If I do 's.show(' and hit TAB (in the notebook), axes_labels is listed
on the definition line, but not among the optional inputs.  This
should probably be fixed.

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



[sage-support] Re: axes_label in plot appears to be broken

2008-05-13 Thread John H Palmieri

On May 13, 2:47 pm, tkeller <[EMAIL PROTECTED]> wrote:
> I really should have thought about that for a couple more minutes.
> Thanks for the easy solution.
> Thomas

Well, the 'easy solution' should have been documented.  See this
ticket:

<http://trac.sagemath.org/sage_trac/ticket/2040>

> On May 13, 4:40 pm, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
> > On May 13, 2:31 pm, tkeller <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
> > > I'm trying to add some simple labels to plots, but axes_label appears
> > > to not be working in sage-3.0.1.  Ticket # 1508 
> > > (http://trac.sagemath.org/sage_trac/ticket/1508) reports this as
> > > fixed, but typing the example given in the ticket info:
>
> > > s=plot(x^2,(x,0,1))
> > > s.show(axes_label=['x-axis','y-axis'])
>
> > Try axes_labels  (with an s).
>
> > > yields
> > > Traceback (click to the left for traceback)
> > > ...
> > > TypeError: show() got an unexpected keyword argument 'axes_label'
>
> > > axes_label is not listed as an option in show or plot docstrings, has
> > > this functionality been removed?
>
> > If I do 's.show(' and hit TAB (in the notebook), axes_labels is listed
> > on the definition line, but not among the optional inputs.  This
> > should probably be fixed.
>
> > > Regards,
> > > Thomas
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] 3 == pi

2008-05-15 Thread John H Palmieri

Is this a bug?

sage: 3 == pi
3 == pi
sage: i == i
I == I

Shouldn't this return "False" and "True", respectively?  I know this
works:

sage: 3 == pi.n()
False
sage: 3 == RR(pi)
False

but I sort of expect pi to act like the number pi when used with
things like == or <, without using the .n() decoration.
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: 3 == pi

2008-05-15 Thread John H Palmieri



On May 15, 9:56 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Thu, May 15, 2008 at 9:48 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
>
>
> > Is this a bug?
>
> > sage: 3 == pi
> > 3 == pi
> > sage: i == i
> > I == I
>
> > Shouldn't this return "False" and "True", respectively?
>
> Those are symbolic equations:
>
> sage: type(I == I)
> 
>
> It's just a more general case of:
>
> sage: var('a,b,c,x')
> (a, b, c, x)
> sage: a*x^2 + b*x + c == 0
> a*x^2 + b*x + c == 0
> sage: type(a*x^2 + b*x + c == 0)
> 
> sage: solve(a*x^2 + b*x + c == 0, x)
> [x == (-sqrt(b^2 - 4*a*c) - b)/(2*a), x == (sqrt(b^2 - 4*a*c) - b)/(2*a)]

Yes, except I, pi, and e are constants, not variables.

I suppose "bug" is not the right word, but I would content that this
behavior is not at all what beginning users will expect.  I mean, if I
can do 'e**(i * pi)' and get -1, I would expect to be able to do '3 ==
pi' and get "False".

Or maybe I should say, if I can do 'a = 5; a == 7' and get "False", I
would expect to be able to do '3 == pi' and get "False".  Why is pi
treated as a symbolic variable and not as a number?

(Think about this from the beginning user's point of view.  If they
see odd behavior, they're going to be confused.  A goal should be to
not let this happen, or to provide a good way for them to figure out
why the behavior was actually reasonable in the first place. How do
you expect someone to react when they type in '3 == pi'?  If they're
puzzled, what do you reasonably expect them to be able to do to
clarify things?)

> That said, maybe something so obvious as I == I would best be simplified
> to True.  But then people would argue that it is very inconsistent that
> sometimes symbolic equations are simplified to True/False and sometimes
> they aren't.
>
> In all cases you can do bool( a symbolic equation ) to get True or False.
>
> sage: bool(I == I)
> True
>
> > I know this
> > works:
>
> > sage: 3 == pi.n()
> > False
> > sage: 3 == RR(pi)
> > False
>
> > but I sort of expect pi to act like the number pi when used with
> > things like == or <, without using the .n() decoration.
>
> Nope.  Pi is symbolic.
>
> I'm certainly open to doing some simplification to True/False of symbolic
> equalities though, when we can do so.  I think the main reason we don't
> now is simply that nobody implemented it.  Comments welcome.
>
>  -- William
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] python (?) help: equivalent of lisp's "let"

2008-05-28 Thread John H Palmieri

Here's the situation: in some sage code that I'm working on, I have a
variable, say 'output_format', which tells sage  how to print certain
kinds of objects (in particular, they are elements of a vector space,
and output_format essentially tells sage which basis to use and how to
print the basis elements).  Right now, users can change the value of
output_format explicitly, but I would like to add a method for the
class defining my elements so I can type
"x.basis('blah')" and have the output printed as if output_format were
set to 'blah'.

In lisp, I could do something like

(let ((output_format 'blah'))

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



[sage-support] Re: python (?) help: equivalent of lisp's "let"

2008-05-28 Thread John H Palmieri



On May 28, 11:13 am, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Wed, May 28, 2008 at 10:59 AM, John H Palmieri
>
>
>
> <[EMAIL PROTECTED]> wrote:
>
> > Here's the situation: in some sage code that I'm working on, I have a
> > variable, say 'output_format', which tells sage  how to print certain
> > kinds of objects (in particular, they are elements of a vector space,
> > and output_format essentially tells sage which basis to use and how to
> > print the basis elements).  Right now, users can change the value of
> > output_format explicitly, but I would like to add a method for the
> > class defining my elements so I can type
> > "x.basis('blah')" and have the output printed as if output_format were
> > set to 'blah'.
>
> > In lisp, I could do something like
>
> > (let ((output_format 'blah'))
>

Hi William,

I accidentally posted this before it was ready, and then deleted the
message from the group, but you read it before it got deleted.

> Can you give an example of the code users would currently write
> to change the property, followed by an example of the code you
> wish users could instead write to change the property?

I currently have a function, set_output_format, so users can do this:

sage: set_output_format('old')
'old'
sage: x = (blah); x
(x printed in 'old' format)

I would like to be able to do this:

sage: x.format('new')
(x printed in 'new' format)
sage: x   # output_format should still be set to 'old'
(x printed in 'old' format)

Anyway, I've almost solved my problem (using a try...finally...
block).  Now my question is this: is there an existing sage command
which does this:

if in notebook mode and typeset box is on:
   view(x)
else:
   print(x)

Then I can do:

try:
old = set_output_format()   # with no arguments, set_output_format
returns the current format
set_output_format(new)
fancy_print_command(x)# which behaves as I described above
finally:
set_output_format(old)

>  -- William

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



[sage-support] Re: python (?) help: equivalent of lisp's "let"

2008-05-28 Thread John H Palmieri



On May 28, 12:35 pm, Carl Witty <[EMAIL PROTECTED]> wrote:
> On May 28, 11:48 am, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
>
>
> > I currently have a function, set_output_format, so users can do this:
>
> > sage: set_output_format('old')
> > 'old'
> > sage: x = (blah); x
> > (x printed in 'old' format)
>
> > I would like to be able to do this:
>
> > sage: x.format('new')
> > (x printed in 'new' format)
> > sage: x   # output_format should still be set to 'old'
> > (x printed in 'old' format)
>
> > Anyway, I've almost solved my problem (using a try...finally...
> > block).  Now my question is this: is there an existing sage command
> > which does this:
>
> > if in notebook mode and typeset box is on:
> >view(x)
> > else:
> >print(x)
>
> > Then I can do:
>
> > try:
> > old = set_output_format()   # with no arguments, set_output_format
> > returns the current format
> > set_output_format(new)
> > fancy_print_command(x)# which behaves as I described above
> > finally:
> > set_output_format(old)
>
> You should look at the Python "with" statement (http://docs.python.org/
> ref/with.html; see alsohttp://docs.python.org/ref/context-managers.html).
> You could implement a function "output_format" so that:
>
>   with output_format(new):
>   fancy_print_command(x)
>
> is the equivalent of your try-finally block above.
>
> Carl

Thanks, that looks like a good thing to know about.

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



[sage-support] print or view depending on context (was Re: python (?) help: equivalent of lisp's "let")

2008-05-28 Thread John H Palmieri

In some code, I'd like to view or print an object depending on whether
in notebook mode with the "typeset" box checked or not.  Is this a
good way to do it?

from sage.misc.misc import embedded
from sage.misc.latex import pretty_print, view
import sys
if embedded() and sys.displayhook == pretty_print:
view(x)
else:
print(x)


> > > Now my question is this: is there an existing sage command
> > > which does this:
>
> > > if in notebook mode and typeset box is on:
> > >view(x)
> > > else:
> > >print(x)

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



[sage-support] Re: print or view depending on context (was Re: python (?) help: equivalent of lisp's "let")

2008-06-10 Thread John H Palmieri

On Jun 10, 7:12 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Wed, May 28, 2008 at 2:03 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
>
>
> > In some code, I'd like to view or print an object depending on whether
> > in notebook mode with the "typeset" box checked or not.  Is this a
> > good way to do it?
>
> >            from sage.misc.misc import embedded
> >            from sage.misc.latex import pretty_print, view
> >            import sys
> >            if embedded() and sys.displayhook == pretty_print:
> >                view(x)
> >            else:
> >                print(x)
>
> I think that is the *only* way to do it.   I don't think it is a "good way"
> though.  It could be made much nicer by adding a single function somewhere,
> e.g., in misc/*/  that has the lines of code you wrote above in it,
> and has a meaningful name.    Then other code that needs to do the
> same thing will be easier to write and read.  What do you think?

Well, I didn't know if 'sys.displayhook == pretty_print' was the right
way to check for the typeset box.  Anyway, here's a ticket (with a
patch):

<http://trac.sagemath.org/sage_trac/ticket/3396>

-- John

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



[sage-support] Re: print or view depending on context (was Re: python (?) help: equivalent of lisp's "let")

2008-06-11 Thread John H Palmieri



On Jun 10, 9:56 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Tue, Jun 10, 2008 at 9:35 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On Jun 10, 7:12 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> >> On Wed, May 28, 2008 at 2:03 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
> >> > In some code, I'd like to view or print an object depending on whether
> >> > in notebook mode with the "typeset" box checked or not.  Is this a
> >> > good way to do it?
>
> >> >            from sage.misc.misc import embedded
> >> >            from sage.misc.latex import pretty_print, view
> >> >            import sys
> >> >            if embedded() and sys.displayhook == pretty_print:
> >> >                view(x)
> >> >            else:
> >> >                print(x)
>
> >> I think that is the *only* way to do it.   I don't think it is a "good way"
> >> though.  It could be made much nicer by adding a single function somewhere,
> >> e.g., in misc/*/  that has the lines of code you wrote above in it,
> >> and has a meaningful name.    Then other code that needs to do the
> >> same thing will be easier to write and read.  What do you think?
>
> > Well, I didn't know if 'sys.displayhook == pretty_print' was the right
> > way to check for the typeset box.
>
> Well it works, and if we encapsulate it in a function (like you've done),
> then if we decide on a better way later it will be easy to change in only
> one place.
>
> > Anyway, here's a ticket (with a
> > patch):
>
> > <http://trac.sagemath.org/sage_trac/ticket/3396>
>
> Excellent.  If you add a doctest I'll give it a positive review :-)

I'm not sure how to add a doctest for this, since its behavior depends
on the situation, and since I don't know how to provide a doctest for
'view'.  Any suggestions?  (Besides, none of the other functions in
latex.py have doctests.  Well, maybe some of them do, but lots of them
don't.)

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



[sage-support] Re: exemple from prog.pdf does not work

2008-06-30 Thread John H Palmieri



On Jun 30, 9:47 am, ibrahim <[EMAIL PROTECTED]> wrote:
> Hello.
>
>  Trying to execute the exemple of page 33 : hello.spyx produces this
> error :
>
> Loading of file "/Users/ims/.sage/hello.spy" has type not implemented.
>
> nb : page 33
>
> hello.spyx contains
> def hello(name):
>    """
>    Print hello with the given name.
>    """
>    print("Hello %s"%name)
>
> and in sage :
> sage: load "hello.spyx"
> Compiling hello.spyx...
> sage: hello(’World’)
> Hello World

This looks like the sort of error you get when you try to load a .spyx
file from the notebook.  Are you using the notebook interface or just
the plain command line?

See the thread

http://groups.google.com/group/sage-support/browse_frm/thread/ab15557429e060c4/633fcbc85a307d95?lnk=gst&q=cython+notebook#

and

http://groups.google.com/group/sage-support/browse_frm/thread/b99c064b402ece4/cb55ac550f72d694?lnk=gst&q=notebook+spyx#cb55ac550f72d694

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



[sage-support] sign of a permutation

2008-06-30 Thread John H Palmieri

Suppose I have a tuple x of distinct non-negative integers.  Is there
a quick way to find the sign of this, as a permutation of Set(x)?  (I
want to view x as the one-line permutation notation form, so (3,6,4)
will have sign -1, while (5,3,8,6) will have sign 1.)

The things I can find in combinat/... don't quite seem to do what I
want.  I can build something myself, but if there is a quick solution,
I would prefer that.


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



[sage-support] Re: sign of a permutation

2008-06-30 Thread John H Palmieri



On Jun 30, 5:16 pm, "David Joyner" <[EMAIL PROTECTED]> wrote:
> Do you mean the tuple is represented in the disjoint cycle notation and
> is a cyclic permutation? In that case, you can use:
>
> sage: PermutationGroupElement('(3,6,4)').sign()
> 1
> sage: PermutationGroupElement('(5,3,6,4)').sign()
> -1
>

No, by "one-line permutation notation", I mean that (3,6,4) means the
permutation where 3 -> 3, 4 -> 6, and 6 -> 4, while (5,3,8,6) is the
permutation of (3,5,8,6) in which 3 and 5 have been interchanged, as
have 6 and 8.


> On Mon, Jun 30, 2008 at 7:17 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
>
>
> > Suppose I have a tuple x of distinct non-negative integers.  Is there
> > a quick way to find the sign of this, as a permutation of Set(x)?  (I
> > want to view x as the one-line permutation notation form, so (3,6,4)
> > will have sign -1, while (5,3,8,6) will have sign 1.)
>
> > The things I can find in combinat/... don't quite seem to do what I
> > want.  I can build something myself, but if there is a quick solution,
> > I would prefer that.
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: sign of a permutation

2008-06-30 Thread John H Palmieri



On Jun 30, 7:00 pm, "David Joyner" <[EMAIL PROTECTED]> wrote:
> In that case, this might do it
>
> sage: PermutationOptions(display='list')
> sage: L1 = [5,3,8,6]
> sage: L2 = copy(L1)
> sage: L1.sort()
> sage: L = [L2.index(x)+1 for x in L1]
> sage: p = Permutation(L); p; p.to_cycles()
> [2, 1, 4, 3]
> [(1, 2), (3, 4)]
> sage: p.signature()
> 1
> sage: p.to_permutation_group_element().sign()
> 1
>

Okay, thanks, that's a bit cleaner than what I had worked out.


> On Mon, Jun 30, 2008 at 9:12 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jun 30, 5:16 pm, "David Joyner" <[EMAIL PROTECTED]> wrote:
> >> Do you mean the tuple is represented in the disjoint cycle notation and
> >> is a cyclic permutation? In that case, you can use:
>
> >> sage: PermutationGroupElement('(3,6,4)').sign()
> >> 1
> >> sage: PermutationGroupElement('(5,3,6,4)').sign()
> >> -1
>
> > No, by "one-line permutation notation", I mean that (3,6,4) means the
> > permutation where 3 -> 3, 4 -> 6, and 6 -> 4, while (5,3,8,6) is the
> > permutation of (3,5,8,6) in which 3 and 5 have been interchanged, as
> > have 6 and 8.
>
> >> On Mon, Jun 30, 2008 at 7:17 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
> >> > Suppose I have a tuple x of distinct non-negative integers.  Is there
> >> > a quick way to find the sign of this, as a permutation of Set(x)?  (I
> >> > want to view x as the one-line permutation notation form, so (3,6,4)
> >> > will have sign -1, while (5,3,8,6) will have sign 1.)
>
> >> > The things I can find in combinat/... don't quite seem to do what I
> >> > want.  I can build something myself, but if there is a quick solution,
> >> > I would prefer that.
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Support for creating data bases; fast linear algebra over finite fields

2008-07-02 Thread John H Palmieri



On Jul 2, 5:36 am, Simon King <[EMAIL PROTECTED]> wrote:
> Dear Sage team,
>
> this time i have two groups of questions.
>
> 1.
> My main project is the creation of a data base of cohomology rings of
> finite p-groups (coefficients in GF(p), of course). For each group in
> the data base, it should provide
> - a quotient of a graded-commutative ring, isomorphic to the
> cohomology ring; these are data in Singular.

Do you mean, a quotient of a "free" graded-commutative ring, or
something like that?  Otherwise, why say "quotient"?

> - special subgroups, namely maximal elementary abelian subgroups and
> the greatest central elementary abelian subgroup; these are data in
> Gap.
> - the restriction map for each special subgroup; again, data in
> Singular.
>
> Question to group theorists:
> What further informations do you wish to be part of such data base?

I'm not a group theorist, but I play one in the occasional paper. How
about the action of the Steenrod operations? (I have a Sage package
which does mod 2 Steenrod operations currently under review.  I am
working on adding the odd primary version, too.) For normal subgroups,
would it make sense to somehow encode the behavior of the Lyndon-
Hochschild-Serre spectral sequence?  I don't know how you would do
this; maybe record some sort of minimal information about the nonzero
differentials? Barring this, if E is a subgroup (e.g., an elementary
abelian one), information about the action of the normalizer N(E) on
H^*(E): it would be nice to be able to see Quillen's theorem in
action.

What about non-trivial coefficients? Perhaps for some groups there are
naturally occurring modules M for which you should record the
cohomology H*(G;M) as a module over H*(G;k)?

>
> Question to everybody:
> What tools/packages are available for Sage that help to create and
> maintain a data base (please with hints to tutorials/manuals)?
>
> 2.
> There is a long thread about improving linear algebra (specifically
> over small fields) in 
> Sage:http://groups.google.com/group/sage-devel/browse_thread/thread/aa4edc...
>
> Has this improvement become part of the Sage distribution? Or is it an
> optional package? Personally, I specifically need fast operations
> "matrix times vector", "vector times scalar", "sum/difference of
> vectors", "echelon form of a matrix".
>
> Yours
>          Simon
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Efficient selection from a list: Is there a tric?

2008-07-02 Thread John H Palmieri



On Jul 2, 10:09 pm, Rolandb <[EMAIL PROTECTED]> wrote:
> Suppose you want to select all possible combinations a,b,c,d to from
> the range [1,2,3,4] , but a,b,c,d should be unique (thus not equal).
> The following approach seems clumsy:
>
> for a in range(1,5):
>  for b in range(1,5):
>   for c in range(1,5):
>    for d in range(1,5):
>     if a<>b<>c<>d:
>      print a,b,c,d
>
> Is there a smarter way? Thanks in advance!
> Roland

What about 'permutations([1,2,3,4])'?


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



[sage-support] coercion question

2008-07-04 Thread John H Palmieri

I'm running into a coercion problem.  I'm trying to define a class
SteenrodAlgebra (based on the Algebra class); there should be one
Steenrod algebra for each prime number p, and it is an algebra over
GF(p).  For example, you can do

sage: A5 = SteenrodAlgebra(5)
sage: A7 = SteenrodAlgebra(7)

I have coercion working properly for addition, but not multiplication,
and I really don't know why.  One way to define elements is to use a
method called "P":

sage: v = A5.P(1,2,3)
sage: w = A7.P(4,5)

The identity element of the Steenrod algebra is called P(0), and I
have a _coerce_impl method which seems to work: it seems to coerce a
scalar into the appropriate scalar multiple of P(0):

sage: 3 + v
3 P(0) + P(1,2,3)
sage: 11 + w  # addition here is mod 7
4 P(0) + P(4,5)

Multiplication is broken, though:

sage: 3 * v # this works
3 P(1,2,3)
sage: 11 * w

gives me a traceback, and it appears that the problem is that Sage is
testing whether A5.gen(0) is equal to A7.gen(0).  Why is A7.gen(0)
involved?  I mean, w is in A7, but why is Sage interested in its 0th
generator?  And why is A5.gen(0) involved in this at all, when I'm
trying to multiply an element of A7 by an integer (which should coerce
to an element of GF(7), and then into A7)?  If I interchange the order
of evaluation here, doing 11 * w before 3 * v, then 11 * w works,
while 3 * v gives the error.  By putting in some print statements in
various places, I can see that even when 3 * v works, it is still
calling A5.gen(0) the first time it is called; subsequent times, it
doesn't call this.  (Is Sage caching information about generators
somewhere, and is that perhaps causing problems, because I've done
something wrong and not distinguished sufficiently between Steenrod
algebras at different primes?)

So I'm very confused.  Any ideas what I should look at to try to fix
this?
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: coercion question

2008-07-04 Thread John H Palmieri



On Jul 4, 10:25 am, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> On Jul 4, 2008, at 7:12 AM, John H Palmieri wrote:
>
> > I'm running into a coercion problem.  I'm trying to define a class
> > SteenrodAlgebra (based on the Algebra class); there should be one
> > Steenrod algebra for each prime number p, and it is an algebra over
> > GF(p).  For example, you can do
>
> > sage: A5 = SteenrodAlgebra(5)
> > sage: A7 = SteenrodAlgebra(7)
>
> I just tried these lines, where do I import SteenrodAlgebra from? (Or  
> is it not in standard Sage yet?)

It's not in standard Sage yet.  I've put some sample source code here:

<http://faculty.washington.edu/jpalmier/test.py>

which seems to exhibit the behavior I'm talking about.

> > I have coercion working properly for addition, but not multiplication,
> > and I really don't know why.  One way to define elements is to use a
> > method called "P":
>
> > sage: v = A5.P(1,2,3)
> > sage: w = A7.P(4,5)
>
> > The identity element of the Steenrod algebra is called P(0), and I
> > have a _coerce_impl method which seems to work: it seems to coerce a
> > scalar into the appropriate scalar multiple of P(0):
>
> > sage: 3 + v
> > 3 P(0) + P(1,2,3)
> > sage: 11 + w      # addition here is mod 7
> > 4 P(0) + P(4,5)
>
> > Multiplication is broken, though:
>
> > sage: 3 * v     # this works
> > 3 P(1,2,3)
> > sage: 11 * w
>
> > gives me a traceback, and it appears that the problem is that Sage is
> > testing whether A5.gen(0) is equal to A7.gen(0).  Why is A7.gen(0)
> > involved?  I mean, w is in A7, but why is Sage interested in its 0th
> > generator?  And why is A5.gen(0) involved in this at all, when I'm
> > trying to multiply an element of A7 by an integer (which should coerce
> > to an element of GF(7), and then into A7)?  If I interchange the order
> > of evaluation here, doing 11 * w before 3 * v, then 11 * w works,
> > while 3 * v gives the error.  By putting in some print statements in
> > various places, I can see that even when 3 * v works, it is still
> > calling A5.gen(0) the first time it is called; subsequent times, it
> > doesn't call this.  (Is Sage caching information about generators
> > somewhere, and is that perhaps causing problems, because I've done
> > something wrong and not distinguished sufficiently between Steenrod
> > algebras at different primes?)
>
> > So I'm very confused.  Any ideas what I should look at to try to fix
> > this?
>
> Yes, Sage caches some information so it doesn't have to do the logic  
> anew on each arithmetic operation. One thing to check is if A5 == A7  
> succeeds. If you could post the traceback I could see if anything  
> stands out to me.

Here's an example.

sage: A5 = SteenrodAlgebra(5); A7 = SteenrodAlgebra(7)
sage: A5 == A7
False
sage: v = A5.P(2)
sage: w = A7.P(2,1)
sage: 2 * v
2 P(2)
sage: 3 * w
---
TypeError Traceback (most recent call
last)

/Users/palmieri/ in ()

/Users/palmieri/element.pyx in
sage.structure.element.RingElement.__mul__ (sage/structure/element.c:
8545)()

/Users/palmieri/coerce.pyx in
sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/
structure/coerce.c:5039)()

/Users/palmieri/coerce.pyx in
sage.structure.coerce.CoercionModel_cache_maps.get_action_c (sage/
structure/coerce.c:7864)()

/Users/palmieri/coerce.pyx in
sage.structure.coerce.CoercionModel_cache_maps.discover_action_c (sage/
structure/coerce.c:8522)()

/Users/palmieri/parent.pyx in
sage.structure.parent.Parent.get_action_c (sage/structure/parent.c:
1843)()

/Users/palmieri/parent.pyx in
sage.structure.parent.Parent.get_action_impl (sage/structure/parent.c:
2005)()

/Users/palmieri/parent.pyx in
sage.structure.parent.Parent.get_action_c_impl (sage/structure/
parent.c:2672)()

/Users/palmieri/parent.pyx in sage.structure.parent._register_pair
(sage/structure/parent.c:6360)()

/Users/palmieri/parent.pyx in sage.structure.parent.EltPair.__eq__
(sage/structure/parent.c:6183)()

/Applications/sage/local/lib/python2.5/site-packages/sage/algebras/
steenrod_algebra.py in __eq__(self, other)
   1528 Two elements are equal if their difference is zero.
   1529 """
-> 1530 difference = self - other
   1531 return len(difference._raw['milnor']) == 0
   1532

/Users/palmieri/element.pyx in
sage.structure.element.ModuleElement.__sub__ (sage/structure/element.c:
5421)()

/Users/palmieri/coerce.pyx in
sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/
structure/coerce.c:5338)()

TypeError: unsupported operand parent(s) for '-': 'mod 7 Steenrod
algebra' and 'mod 5 Steenrod algebra'



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



[sage-support] Re: coercion question

2008-07-04 Thread John H Palmieri



On Jul 4, 10:53 am, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> On Jul 4, 2008, at 10:44 AM, John H Palmieri wrote:
>
>
>
>
>
> >>> So I'm very confused.  Any ideas what I should look at to try to fix
> >>> this?
>
> >> Yes, Sage caches some information so it doesn't have to do the logic
> >> anew on each arithmetic operation. One thing to check is if A5 == A7
> >> succeeds. If you could post the traceback I could see if anything
> >> stands out to me.
>
> > Here's an example.
>
> > sage: A5 = SteenrodAlgebra(5); A7 = SteenrodAlgebra(7)
> > sage: A5 == A7
> > False
> > sage: v = A5.P(2)
> > sage: w = A7.P(2,1)
> > sage: 2 * v
> > 2 P(2)
> > sage: 3 * w
> > --
> > -
> > TypeError                                 Traceback (most recent call
> > last)
>
> > /Users/palmieri/ in ()
>
> > /Users/palmieri/element.pyx in
> > sage.structure.element.RingElement.__mul__ (sage/structure/element.c:
> > 8545)()
>
> > /Users/palmieri/coerce.pyx in
> > sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/
> > structure/coerce.c:5039)()
>
> > /Users/palmieri/coerce.pyx in
> > sage.structure.coerce.CoercionModel_cache_maps.get_action_c (sage/
> > structure/coerce.c:7864)()
>
> > /Users/palmieri/coerce.pyx in
> > sage.structure.coerce.CoercionModel_cache_maps.discover_action_c  
> > (sage/
> > structure/coerce.c:8522)()
>
> > /Users/palmieri/parent.pyx in
> > sage.structure.parent.Parent.get_action_c (sage/structure/parent.c:
> > 1843)()
>
> > /Users/palmieri/parent.pyx in
> > sage.structure.parent.Parent.get_action_impl (sage/structure/parent.c:
> > 2005)()
>
> > /Users/palmieri/parent.pyx in
> > sage.structure.parent.Parent.get_action_c_impl (sage/structure/
> > parent.c:2672)()
>
> > /Users/palmieri/parent.pyx in sage.structure.parent._register_pair
> > (sage/structure/parent.c:6360)()
>
> > /Users/palmieri/parent.pyx in sage.structure.parent.EltPair.__eq__
> > (sage/structure/parent.c:6183)()
>
> > /Applications/sage/local/lib/python2.5/site-packages/sage/algebras/
> > steenrod_algebra.py in __eq__(self, other)
> >    1528         Two elements are equal if their difference is zero.
> >    1529         """
> > -> 1530         difference = self - other
> >    1531         return len(difference._raw['milnor']) == 0
> >    1532
>
> > /Users/palmieri/element.pyx in
> > sage.structure.element.ModuleElement.__sub__ (sage/structure/
> > element.c:
> > 5421)()
>
> > /Users/palmieri/coerce.pyx in
> > sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/
> > structure/coerce.c:5338)()
>
> > TypeError: unsupported operand parent(s) for '-': 'mod 7 Steenrod
> > algebra' and 'mod 5 Steenrod algebra'
>
> Ah, it looks like your __eq__ method is assuming that self and other  
> are elements of the steenrod algebra. There are two solutions to this:
>
> 1) Use __cmp__ which (in Sage) will ensure that self and other have  
> the same parent before it's called
> 2) Fix your __eq__ (and any other comparison methods you might have)  
> to make sure self-other makes sense (or, as a quick fix, catch the  
> type error here).
>

I still don't understand two things: why the gen method is being used,
and why if I multiply an element of SteenrodAlgebra(7) by 3, somehow
elements of SteenrodAlgebra(5) are getting involved.

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



[sage-support] Re: coercion question

2008-07-05 Thread John H Palmieri



On Jul 5, 10:08 am, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> On Jul 4, 2008, at 1:52 PM, John H Palmieri wrote:
>
>
>
>
>
> > On Jul 4, 10:53 am, Robert Bradshaw <[EMAIL PROTECTED]>
> > wrote:
> >> On Jul 4, 2008, at 10:44 AM, John H Palmieri wrote:
>
> >>>>> So I'm very confused.  Any ideas what I should look at to try  
> >>>>> to fix
> >>>>> this?
>
> >>>> Yes, Sage caches some information so it doesn't have to do the  
> >>>> logic
> >>>> anew on each arithmetic operation. One thing to check is if A5  
> >>>> == A7
> >>>> succeeds. If you could post the traceback I could see if anything
> >>>> stands out to me.
>
> >>> Here's an example.
>
> >>> sage: A5 = SteenrodAlgebra(5); A7 = SteenrodAlgebra(7)
> >>> sage: A5 == A7
> >>> False
> >>> sage: v = A5.P(2)
> >>> sage: w = A7.P(2,1)
> >>> sage: 2 * v
> >>> 2 P(2)
> >>> sage: 3 * w
> >>> 
> >>> --
> >>> -
> >>> TypeError                                 Traceback (most recent  
> >>> call
> >>> last)
>
> >>> /Users/palmieri/ in ()
>
> >>> /Users/palmieri/element.pyx in
> >>> sage.structure.element.RingElement.__mul__ (sage/structure/
> >>> element.c:
> >>> 8545)()
>
> >>> /Users/palmieri/coerce.pyx in
> >>> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/
> >>> structure/coerce.c:5039)()
>
> >>> /Users/palmieri/coerce.pyx in
> >>> sage.structure.coerce.CoercionModel_cache_maps.get_action_c (sage/
> >>> structure/coerce.c:7864)()
>
> >>> /Users/palmieri/coerce.pyx in
> >>> sage.structure.coerce.CoercionModel_cache_maps.discover_action_c
> >>> (sage/
> >>> structure/coerce.c:8522)()
>
> >>> /Users/palmieri/parent.pyx in
> >>> sage.structure.parent.Parent.get_action_c (sage/structure/parent.c:
> >>> 1843)()
>
> >>> /Users/palmieri/parent.pyx in
> >>> sage.structure.parent.Parent.get_action_impl (sage/structure/
> >>> parent.c:
> >>> 2005)()
>
> >>> /Users/palmieri/parent.pyx in
> >>> sage.structure.parent.Parent.get_action_c_impl (sage/structure/
> >>> parent.c:2672)()
>
> >>> /Users/palmieri/parent.pyx in sage.structure.parent._register_pair
> >>> (sage/structure/parent.c:6360)()
>
> >>> /Users/palmieri/parent.pyx in sage.structure.parent.EltPair.__eq__
> >>> (sage/structure/parent.c:6183)()
>
> >>> /Applications/sage/local/lib/python2.5/site-packages/sage/algebras/
> >>> steenrod_algebra.py in __eq__(self, other)
> >>>    1528         Two elements are equal if their difference is zero.
> >>>    1529         """
> >>> -> 1530         difference = self - other
> >>>    1531         return len(difference._raw['milnor']) == 0
> >>>    1532
>
> >>> /Users/palmieri/element.pyx in
> >>> sage.structure.element.ModuleElement.__sub__ (sage/structure/
> >>> element.c:
> >>> 5421)()
>
> >>> /Users/palmieri/coerce.pyx in
> >>> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/
> >>> structure/coerce.c:5338)()
>
> >>> TypeError: unsupported operand parent(s) for '-': 'mod 7 Steenrod
> >>> algebra' and 'mod 5 Steenrod algebra'
>
> >> Ah, it looks like your __eq__ method is assuming that self and other
> >> are elements of the steenrod algebra. There are two solutions to  
> >> this:
>
> >> 1) Use __cmp__ which (in Sage) will ensure that self and other have
> >> the same parent before it's called
> >> 2) Fix your __eq__ (and any other comparison methods you might have)
> >> to make sure self-other makes sense (or, as a quick fix, catch the
> >> type error here).
>
> > I still don't understand two things: why the gen method is being used,
> > and why if I multiply an element of SteenrodAlgebra(7) by 3, somehow
> > elements of SteenrodAlgebra(5) are getting involved.
>
> I'm not seeing where the gen method is being used--it's probably to  
> get a "generic" element to see if multiplication is a viable option.  
> As for elements of SteenrodAlgebra(7) and SteenrodAlgebra(5) getting  
> compared, that's because it's looking up something in a (global-ish)  
> lookup table that happens to have SteenrodAlgebra(5) in it as well.  
> Obviously equality here should return False.
>

So, for example, for the definition of the __eq__ method for
SteenrodAlgebraElement, replacing

difference = self - other
return len(difference._raw['milnor']) == 0

with

if self.parent() == other.parent():
difference = self - other
return len(difference._raw['milnor']) == 0
else:
return False

would be good enough?  (That is, assuming I've defined a reasonable
__eq__ method for the parents, the SteenrodAlgebra class.)

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



[sage-support] Re: coercion question

2008-07-05 Thread John H Palmieri



On Jul 5, 10:08 am, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> On Jul 4, 2008, at 1:52 PM, John H Palmieri wrote:
>
>
>
>
>
> > On Jul 4, 10:53 am, Robert Bradshaw <[EMAIL PROTECTED]>
> > wrote:
> >> On Jul 4, 2008, at 10:44 AM, John H Palmieri wrote:
>
> >>>>> So I'm very confused.  Any ideas what I should look at to try  
> >>>>> to fix
> >>>>> this?
>
> >>>> Yes, Sage caches some information so it doesn't have to do the  
> >>>> logic
> >>>> anew on each arithmetic operation. One thing to check is if A5  
> >>>> == A7
> >>>> succeeds. If you could post the traceback I could see if anything
> >>>> stands out to me.
>
> >>> Here's an example.
>
> >>> sage: A5 = SteenrodAlgebra(5); A7 = SteenrodAlgebra(7)
> >>> sage: A5 == A7
> >>> False
> >>> sage: v = A5.P(2)
> >>> sage: w = A7.P(2,1)
> >>> sage: 2 * v
> >>> 2 P(2)
> >>> sage: 3 * w
> >>> 
> >>> --
> >>> -
> >>> TypeError                                 Traceback (most recent  
> >>> call
> >>> last)
>
> >>> /Users/palmieri/ in ()
>
> >>> /Users/palmieri/element.pyx in
> >>> sage.structure.element.RingElement.__mul__ (sage/structure/
> >>> element.c:
> >>> 8545)()
>
> >>> /Users/palmieri/coerce.pyx in
> >>> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/
> >>> structure/coerce.c:5039)()
>
> >>> /Users/palmieri/coerce.pyx in
> >>> sage.structure.coerce.CoercionModel_cache_maps.get_action_c (sage/
> >>> structure/coerce.c:7864)()
>
> >>> /Users/palmieri/coerce.pyx in
> >>> sage.structure.coerce.CoercionModel_cache_maps.discover_action_c
> >>> (sage/
> >>> structure/coerce.c:8522)()
>
> >>> /Users/palmieri/parent.pyx in
> >>> sage.structure.parent.Parent.get_action_c (sage/structure/parent.c:
> >>> 1843)()
>
> >>> /Users/palmieri/parent.pyx in
> >>> sage.structure.parent.Parent.get_action_impl (sage/structure/
> >>> parent.c:
> >>> 2005)()
>
> >>> /Users/palmieri/parent.pyx in
> >>> sage.structure.parent.Parent.get_action_c_impl (sage/structure/
> >>> parent.c:2672)()
>
> >>> /Users/palmieri/parent.pyx in sage.structure.parent._register_pair
> >>> (sage/structure/parent.c:6360)()
>
> >>> /Users/palmieri/parent.pyx in sage.structure.parent.EltPair.__eq__
> >>> (sage/structure/parent.c:6183)()
>
> >>> /Applications/sage/local/lib/python2.5/site-packages/sage/algebras/
> >>> steenrod_algebra.py in __eq__(self, other)
> >>>    1528         Two elements are equal if their difference is zero.
> >>>    1529         """
> >>> -> 1530         difference = self - other
> >>>    1531         return len(difference._raw['milnor']) == 0
> >>>    1532
>
> >>> /Users/palmieri/element.pyx in
> >>> sage.structure.element.ModuleElement.__sub__ (sage/structure/
> >>> element.c:
> >>> 5421)()
>
> >>> /Users/palmieri/coerce.pyx in
> >>> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/
> >>> structure/coerce.c:5338)()
>
> >>> TypeError: unsupported operand parent(s) for '-': 'mod 7 Steenrod
> >>> algebra' and 'mod 5 Steenrod algebra'
>
> >> Ah, it looks like your __eq__ method is assuming that self and other
> >> are elements of the steenrod algebra. There are two solutions to  
> >> this:
>
> >> 1) Use __cmp__ which (in Sage) will ensure that self and other have
> >> the same parent before it's called
> >> 2) Fix your __eq__ (and any other comparison methods you might have)
> >> to make sure self-other makes sense (or, as a quick fix, catch the
> >> type error here).
>
> > I still don't understand two things: why the gen method is being used,
> > and why if I multiply an element of SteenrodAlgebra(7) by 3, somehow
> > elements of SteenrodAlgebra(5) are getting involved.
>
> I'm not seeing where the gen method is being used--it's probably to  
> get a "generic" element to see if multiplication is a viable option.  

It's not apparent where it's used from the traceback, but if I put in
some print statements, e.g., print "gen" at the start of the gen
method, and similarly for _coerce_impl, and for _init_ and _mul_ for
the element class, then when I evaluate 3 * A5.P(2,1,4), gen gets used
before anything else.  There is a call to gen(0) in the method
_an_element_c_impl for Parent in parent.pyx; maybe that's where it's
coming from.  But mathematically, I still don't understand it...

> As for elements of SteenrodAlgebra(7) and SteenrodAlgebra(5) getting  
> compared, that's because it's looking up something in a (global-ish)  
> lookup table that happens to have SteenrodAlgebra(5) in it as well.  
> Obviously equality here should return False.
>
> - Robert
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: coercion question

2008-07-05 Thread John H Palmieri



On Jul 5, 5:48 pm, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> On Jul 5, 2008, at 12:42 PM, John H Palmieri wrote:
>
>
>
>
>
> >>>> Ah, it looks like your __eq__ method is assuming that self and  
> >>>> other
> >>>> are elements of the steenrod algebra. There are two solutions to
> >>>> this:
>
> >>>> 1) Use __cmp__ which (in Sage) will ensure that self and other have
> >>>> the same parent before it's called
> >>>> 2) Fix your __eq__ (and any other comparison methods you might  
> >>>> have)
> >>>> to make sure self-other makes sense (or, as a quick fix, catch the
> >>>> type error here).
>
> >>> I still don't understand two things: why the gen method is being  
> >>> used,
> >>> and why if I multiply an element of SteenrodAlgebra(7) by 3, somehow
> >>> elements of SteenrodAlgebra(5) are getting involved.
>
> >> I'm not seeing where the gen method is being used--it's probably to
> >> get a "generic" element to see if multiplication is a viable option.
> >> As for elements of SteenrodAlgebra(7) and SteenrodAlgebra(5) getting
> >> compared, that's because it's looking up something in a (global-ish)
> >> lookup table that happens to have SteenrodAlgebra(5) in it as well.
> >> Obviously equality here should return False.
>
> > So, for example, for the definition of the __eq__ method for
> > SteenrodAlgebraElement, replacing
>
> >     difference = self - other
> >     return len(difference._raw['milnor']) == 0
>
> > with
>
> >     if self.parent() == other.parent():
> >         difference = self - other
> >         return len(difference._raw['milnor']) == 0
> >     else:
> >         return False
>
> > would be good enough?  (That is, assuming I've defined a reasonable
> > __eq__ method for the parents, the SteenrodAlgebra class.)
>
> Yes, though that will mean something like A5.P(2) - A5.P(2) == 0 will  
> return False. This is why you are better off using _cmp_ instead of  
> __eq__, __ne__, __le__, __gt__, ... (also, the latter are deprecated  
> in Python). The _cmp_ method will always be called with two things of  
> the same parent, invoking coercion if necessary.
>

I think I understand this, but I have one more problem. I think you're
saying that I'm supposed to get rid of __eq__ and define __cmp__
instead, with no error checking -- assume that the two arguments have
the same parent.  I have done this, and __cmp__ just checks whether
the difference x-y is the zero element of the algebra.

Now I get the following, which is good:

sage: A5.P(2) == A7.P(2)
False
sage: A5.P(2) - A5.P(2) == 0
True
sage: 2 * A5.P(2)
2 P(2)
sage: 10 * A7.P(2)  # working mod 7
3 P(2)

On the other hand,

sage: cmp(A5.P(2), A7.P(2))

gives an error message: "unsupported operand parent(s) for '-': 'mod 5
Steenrod algebra' and 'mod 7 Steenrod algebra' "

(Same thing happens with 'A5.P(2).__cmp__(A7.P(2))', but cmp(A5(3),
3)  returns 0, as it should.)

Why doesn't cmp() work, or is this what's supposed to happen?  (I can
add type-checking to the definition of __cmp__, in which case the
above command returns -1, but it sounded like you were saying that I
shouldn't have to.)

Thanks for taking the time to answer all of my silly questions, by the
way.  I think this might be the last one for now.

  John

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



[sage-support] Re: coercion question

2008-07-05 Thread John H Palmieri



On Jul 5, 8:39 pm, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> On Jul 5, 2008, at 7:16 PM, John H Palmieri wrote:
>
>
>
>
>
> >>> would be good enough?  (That is, assuming I've defined a reasonable
> >>> __eq__ method for the parents, the SteenrodAlgebra class.)
>
> >> Yes, though that will mean something like A5.P(2) - A5.P(2) == 0 will
> >> return False. This is why you are better off using _cmp_ instead of
> >> __eq__, __ne__, __le__, __gt__, ... (also, the latter are deprecated
> >> in Python). The _cmp_ method will always be called with two things of
> >> the same parent, invoking coercion if necessary.
>
> > I think I understand this, but I have one more problem. I think you're
> > saying that I'm supposed to get rid of __eq__ and define __cmp__
> > instead, with no error checking -- assume that the two arguments have
> > the same parent.  I have done this, and __cmp__ just checks whether
> > the difference x-y is the zero element of the algebra.
>
> > Now I get the following, which is good:
>
> > sage: A5.P(2) == A7.P(2)
> > False
> > sage: A5.P(2) - A5.P(2) == 0
> > True
> > sage: 2 * A5.P(2)
> > 2 P(2)
> > sage: 10 * A7.P(2)  # working mod 7
> > 3 P(2)
>
> > On the other hand,
>
> > sage: cmp(A5.P(2), A7.P(2))
>
> > gives an error message: "unsupported operand parent(s) for '-': 'mod 5
> > Steenrod algebra' and 'mod 7 Steenrod algebra' "
>
> > (Same thing happens with 'A5.P(2).__cmp__(A7.P(2))', but cmp(A5(3),
> > 3)  returns 0, as it should.)
>
> > Why doesn't cmp() work, or is this what's supposed to happen?  (I can
> > add type-checking to the definition of __cmp__, in which case the
> > above command returns -1, but it sounded like you were saying that I
> > shouldn't have to.)
>
> > Thanks for taking the time to answer all of my silly questions, by the
> > way.  I think this might be the last one for now.
>
> What does A5 == A7 give you? Can you do A5.P(2) == A7.P(2)? I'm not  
> sure exactly what's going on here, but as long as the above is  
> working well enough for now it's probably worth holding off debugging  
> too much until the new coercion is in place (which is more likely  
> than not to resolve this).

Both of those things, A5 == A7 and A5.P(2) == A7.P(2), return False.
So I'll leave it as is.  Thanks.

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



[sage-support] Re: Converting/evaluating surd to float [ANSWER]

2008-07-11 Thread John H Palmieri



On Jul 11, 10:00 am, "John Cremona" <[EMAIL PROTECTED]> wrote:
> I don't think that sin(10) is a "surd", though it is certainly
> irrational and probably even transcendental.
>
> If you look up definitions of "surd" online you get a quite incredible
> collection of conflicting answers, many of which (even in high school
> revision guides) are almost complete nonsense.   But one thing I am
> confident about is that surds are algebraic!
>
> This is not strictly relevant to the point made by Brendan, but please
> can we have this put into the FAQ without using the word "surd"?  You
> could change "surd value" to "symbolic value" here.
>
> John Cremona
>
> 2008/7/11 Jason Grout <[EMAIL PROTECTED]>:
>
>
>
> > Brendan Arnold wrote:
> >> Hi there,
>
> >> Q: How do you evaluate or convert a surd value generated by SAGE into
> >> numerical output?
>
> >> A: Use the .n() method. i.e.
>
> >> sage: sin(10)
> >> sin(10)
> >> sage: sin(10).n()
> >> -0.544021110889370
>
> >> This bugged me for ages when trying to export data to another program.
>
> >> Perhaps this should be made clearer in the tutorial? (its only used
> >> once and as an aside)
>
> > It sounds like this could be added to the FAQ if it's not already there.
> >  You could add it:
>
> >http://wiki.sagemath.org/faq
>
> > Jason

Here's a proposed patch for the tutorial:



It should be quick to review.


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



[sage-support] Re: Fwd: sage tutorial oops

2008-08-18 Thread John H Palmieri



On Aug 18, 7:54 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> -- Forwarded message --
> From: Arnim Littek <[EMAIL PROTECTED]>
> Date: Tue, 19 Aug 2008 14:42:37 +1200
> Subject: sage tutorial oops
> To: [EMAIL PROTECTED]
>
> I'm just starting with Sage, and I must say, it makes a good first
> impression.  I'll have more feedback over time.
>
> Minor documentation nurgle:
>
> Tutorial Section 2.3, Note under the first function definition is
> redundant, as there is no ellipsis visible on the page I'm looking at.
>  Presumably this note is a historical artefact...

I think that it's not a historical artifact, rather it's that the
ellipses are not visible in the "live" version of the documentation,
but are visible in the static and pdf versions.  We haven't changed
the text of the tutorial to reflect this. Here's a suggestion for a
fix:



>
> Arnim Littek
> Sirtrack Ltd
> (division of NZ's Landcare Research)
>
> +
> Please consider the environment before printing this email
>
> WARNING: This email and any attachments may be confidential and/or privileged.
> They are intended for the addressee only and are not to be read, used, copied 
> or
> disseminated by anyone receiving them in error. If you are not the
> intended recipient,
> please notify the sender by return email and delete this message and
> any attachments.
>
> The views expressed in this email are those of the sender and do not
> necessarily reflect
> the official views of SirTrack. see  http://www.sirtrack.com
> +
>
> --
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: testing for equality

2008-09-02 Thread John H Palmieri



On Sep 2, 8:19 am, "John Cremona" <[EMAIL PROTECTED]> wrote:
> Putting == between two symbol expressions creates a symbolic equation,
> not a test for equality.  There is there fore a difference between
> these:
>
> sage: 3 == 3
> True
> sage: x == x
> x == x

In the same category as the latter:

sage: 3 == pi
3 == pi
sage: bool(3 == pi)
False

In your situation, 'bool(dSv==dSvq)' returns True.  (bool is a
function which 'Returns True when the argument x is true, False
otherwise'.)

> This behaviour of == is (I think) unique to the symbolic ring in Sage.
>  You can test for equality like this:
>
> sage: dSv-dSvq
> 0
> sage: (dSv-dSvq).is_zero()
> True
>
> though in more complicated examples the expessions might have to be
> simplified manually.
>
> In general in computer algebra, simplifying an expression which
> simplifies to 0 is easier than trying to find two simplifications of
> two expressions which appear to be the same.
>
> I'm sure there are computer algebra experts reading this who can
> explain it better.
>
> John
>
> 2008/9/2 Stan Schymanski <[EMAIL PROTECTED]>:
>
>
>
> > Dear all,
>
> > I must be doing something wrong here, but I don't know what. I'm sure
> > someone will see it straight away:
>
> > --
> > | SAGE Version 3.1.1, Release Date: 2008-08-17                       |
> > | Type notebook() for the GUI, and license() for information.        |
> > --
>
> > sage: var('myuv myub q qvb qbv')
> > (myuv, myub, q, qvb, qbv)
> > sage: dSv=myuv*qvb - myuv*qbv
> > sage: dSvq=myuv*qvb - myuv*qbv
> > sage: dsage: dSv-dSvq
> > myuv*qvb - myuv*qbv == myuv*qvb - myuv*qbv
>
> > Why does SAGE not return 'true'?
>
> > Just pointing me to the right page in the docu would help, too! Thanks
> > already.
>
> > Stan
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] why isn't QQ a FractionField?

2008-09-17 Thread John H Palmieri

sage: is_FractionField(FractionField(ZZ))
False

Oy. This seems to be intentional: there is a doctest very similar to
this. It doesn't seem right, though. How hard would it be to change?
Is it worth it?

Along the same lines, partial fraction decomposition should work for
rational numbers; this would work if elements of QQ were instances of
FractionFieldElement, right?


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



[sage-support] Re: why isn't QQ a FractionField?

2008-09-17 Thread John H Palmieri

On Sep 17, 9:09 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Wed, Sep 17, 2008 at 8:59 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
> > sage: is_FractionField(FractionField(ZZ))
> > False
>
> > Oy. This seems to be intentional: there is a doctest very similar to
> > this. It doesn't seem right, though. How hard would it be to change?
> > Is it worth it?
>
> In most cases in Sage (maybe all cases),  is_Foo is a data type
> check.  It's not making a mathematical assertion.  The implementation
> is almost always a call to isinstance.

Right, I saw that in the source code. How about we change it, in this
case, from

return isinstance(x, FractionField_generic)

to

return isinstance(x, (FractionField_generic, Field))

(Every field is its own fraction field.)  I can submit a trac ticket
with this change, unless someone convinces me that it's a really bad
idea.

>
> > Along the same lines, partial fraction decomposition should work for
> > rational numbers; this would work if elements of QQ were instances of
> > FractionFieldElement, right?
>
> Or you could just implement it, which would likely be a good idea.

It might be a good idea, but I don't know how to do it.  How do I
produce, given 1/20, the output 1/4 - 1/5?  That is, how do I tell
sage to output 1/4 - 1/5, as an element in QQ, I suppose, without
evaluating it and just printing 1/20?

>
> William
>

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



[sage-support] Re: why isn't QQ a FractionField?

2008-09-18 Thread John H Palmieri

On Sep 18, 5:31 am, Burcin Erocal <[EMAIL PROTECTED]> wrote:
> On Wed, 17 Sep 2008 21:48:37 -0700 (PDT)
> John H Palmieri <[EMAIL PROTECTED]> wrote:
>
> > On Sep 17, 9:09 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> > > On Wed, Sep 17, 2008 at 8:59 PM, John H Palmieri
> > > <[EMAIL PROTECTED]> wrote:
> 
>
> > > > Along the same lines, partial fraction decomposition should work
> > > > for rational numbers; this would work if elements of QQ were
> > > > instances of FractionFieldElement, right?
>
> > > Or you could just implement it, which would likely be a good idea.
>
> > It might be a good idea, but I don't know how to do it.  How do I
> > produce, given 1/20, the output 1/4 - 1/5?  That is, how do I tell
> > sage to output 1/4 - 1/5, as an element in QQ, I suppose, without
> > evaluating it and just printing 1/20?
>
> The partial_fraction_decomposition method of FractionFieldElement just
> returns a list. E.g.,
>
> sage: (1/20).partial_fraction_decomposition()
> [1/4, -1/5]

Depends on which partial fraction decomposition you mean. Look at this
trac ticket:

<http://trac.sagemath.org/sage_trac/ticket/4039>

*Should* it just return a list, or should it return an actual sum?

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



[sage-support] Re: why isn't QQ a FractionField?

2008-09-18 Thread John H Palmieri

On Sep 18, 1:01 am, "John Cremona" <[EMAIL PROTECTED]> wrote:
> 2008/9/18 John H Palmieri <[EMAIL PROTECTED]>:
>
> > On Sep 17, 9:09 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> >> On Wed, Sep 17, 2008 at 8:59 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
> >> > Along the same lines, partial fraction decomposition should work for
> >> > rational numbers; this would work if elements of QQ were instances of
> >> > FractionFieldElement, right?
>
> >> Or you could just implement it, which would likely be a good idea.
>
> > It might be a good idea, but I don't know how to do it.  How do I
> > produce, given 1/20, the output 1/4 - 1/5?  That is, how do I tell
> > sage to output 1/4 - 1/5, as an element in QQ, I suppose, without
> > evaluating it and just printing 1/20?
>
> I used to set this as an exercise in my undergaduate number theory
> class.  Shall I look for my model solution ? ;)

It wasn't the mathematics I was looking for, but how to output the
answer once I find it. If Sage computes that 1/20 = 1/4 - 1/5, how do
I get it to print the expression 1/4 - 1/5 without simplifying it to
1/20?  For example, if I compute the various parts and store them in a
list 'parts', then something naive like 'return sum(parts)' won't
work. How do I return an expression made up of rational numbers, +'s,
and -'s, with no simplification?

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



[sage-support] Re: why isn't QQ a FractionField?

2008-09-18 Thread John H Palmieri

On Sep 18, 7:41 am, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
> It wasn't the mathematics I was looking for, but how to output the
> answer once I find it. If Sage computes that 1/20 = 1/4 - 1/5, how do
> I get it to print the expression 1/4 - 1/5 without simplifying it to
> 1/20?  For example, if I compute the various parts and store them in a
> list 'parts', then something naive like 'return sum(parts)' won't
> work. How do I return an expression made up of rational numbers, +'s,
> and -'s, with no simplification?

One answer to my own question: I can define a new class whose
instances are rational numbers, but whose repr and latex methods are
in terms of their partial fraction decomposition.  Is there a better
way to do this?

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



[sage-support] Re: why isn't QQ a FractionField?

2008-09-18 Thread John H Palmieri



On Sep 18, 9:51 am, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Thu, Sep 18, 2008 at 9:49 AM, John Cremona <[EMAIL PROTECTED]> wrote:
>
> > This looks a bit like an additive version of what we already do with
> > factorizations.   I wonder if you could clever use the factorization
> > class for it?
>
> It's possible somebody might find this useful:
>
> sage: FormalSum([(1,1/4),(1,-1/5)])
> -1/5 + 1/4

It might be useful, except for this:

sage: FormalSum([(1,1/4),(1,-1/5)])
-1/5 + 1/4
sage: FormalSum([(1,1/4),(1,-1/5)]) == 1/4 - 1/5
False

I think that if you do

sage: (1/20).partial_fraction_decomposition()

then it makes the most sense if the return value is == to 1/20. That's
why I was thinking of using a new class with _repr_ and _latex_
methods for printing the decomposition.


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



[sage-support] Re: why isn't QQ a FractionField?

2008-09-18 Thread John H Palmieri

On Sep 18, 1:01 am, "John Cremona" <[EMAIL PROTECTED]> wrote:
> 2008/9/18 John H Palmieri <[EMAIL PROTECTED]>:
> > Right, I saw that in the source code. How about we change it, in this
> > case, from
>
> >    return isinstance(x, FractionField_generic)
>
> > to
>
> >    return isinstance(x, (FractionField_generic, Field))
>
> > (Every field is its own fraction field.)  I can submit a trac ticket
> > with this change, unless someone convinces me that it's a really bad
> > idea.
>
> I think that is a good idea.  If it does cause minor problems they can
> surely be fixed.

I created a trac ticket for this, <http://trac.sagemath.org/sage_trac/
ticket/4149>. There is some interesting discussion going on there;
please join in.

(Briefly, Mike Hansen feels that a function like is_FractionField
should just be a check on data-types.  My point is that its behavior
should make mathematical sense, not just programmatic sense,
especially since is_FractionField is a top-level import; otherwise it
will confuse casual users. Mike's current position seems to be that
this patch is a bad idea, and instead is_FractionField should changed
so that it is no longer a top-level import.)

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



[sage-support] bug? with plot3d

2008-09-23 Thread John H Palmieri

When passing a python function to plot3d, specifying the variable
names and including 'adaptive=True' makes plot3d fail, with the
message

AttributeError: 'function' object has no attribute 'subs'

In more detail:

sage: def f(x,y): return sin(x+y)

Then the following work and produce the same graph:
plot3d(f, (x, -5, 5), (y, -5, 5))
plot3d(f, (-5, 5), (-5, 5))
On the other hand,
plot3d(f, (-5, 5), (-5, 5), adaptive=True)
works, but
plot3d(f, (x, -5, 5), (y, -5, 5), adaptive=True)
barfs with the error message given above.

Is this a bug, or is this related to one of the issues raised in this
earlier thread
 ?

If it's not a bug, it should perhaps fail more gracefully, since the
plot works if 'adaptive=False'.
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] a different bug? with plot3d

2008-09-23 Thread John H Palmieri

Is the following a bug? I don't really know what 'adaptive=True' means
-- the documentation isn't very helpful -- so maybe it's not supposed
to work for functions like this...

def g(x,y):
if y <= 0 or y >= x**2:
return 0
else:
return 1

Then
plot3d(g, (-3, 3), (-3, 3), adaptive=True)
fails, with the message

Traceback (most recent call last):
  File "", line 1, in 
  File "/home/palmieri/.sage/sage_notebook/worksheets/admin/37/code/
7.py", line 6, in 
plot3d(g, (-Integer(3), Integer(3)), (-Integer(3), Integer(3)),
adaptive=True)
  File "/usr/local/share/sage/local/lib/python2.5/site-packages/
SQLAlchemy-0.4.6-py2.5.egg/", line 1, in 
  File "/home/palmieri/Documents/sage-3.1.2/local/lib/python2.5/site-
packages/sage/plot/plot3d/plot3d.py", line 157, in plot3d
P = plot3d_adaptive(f, urange, vrange, **kwds)
  File "/home/palmieri/Documents/sage-3.1.2/local/lib/python2.5/site-
packages/sage/plot/plot3d/plot3d.py", line 255, in plot3d_adaptive
G.set_texture(texture[k], opacity=opacity)
IndexError: list index out of range
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: bug? with plot3d

2008-09-23 Thread John H Palmieri

On Sep 23, 2:05 pm, John H Palmieri <[EMAIL PROTECTED]> wrote:
> When passing a python function to plot3d, specifying the variable
> names and including 'adaptive=True' makes plot3d fail, with the
> message
>
> AttributeError: 'function' object has no attribute 'subs'
>
> In more detail:
>
> sage: def f(x,y): return sin(x+y)
>
> Then the following work and produce the same graph:
>     plot3d(f, (x, -5, 5), (y, -5, 5))
>     plot3d(f, (-5, 5), (-5, 5))

Let me clarify: the first of these fails unless I do var('x y'). After
executing that, the first works, producing the same picture as the
second.

> On the other hand,
>     plot3d(f, (-5, 5), (-5, 5), adaptive=True)
> works, but
>     plot3d(f, (x, -5, 5), (y, -5, 5), adaptive=True)
> barfs with the error message given above.
>
> Is this a bug, or is this related to one of the issues raised in this
> earlier thread
> <http://groups.google.com/group/sage-support/browse_frm/thread/
> 9ad07eeddb850ab3/e0cab1daca9b0883?lnk=gst&q=plot3d#e0cab1daca9b0883> ?
>
> If it's not a bug, it should perhaps fail more gracefully, since the
> plot works if 'adaptive=False'.
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] problem with animate on OS X 10.5, Sage 3.1.2

2008-09-27 Thread John H Palmieri

Can anyone else reproduce this?

sage: a = animate([sin(x + float(k)) for k in srange(0,2*pi,0.3)],
xmin=0, xmax=2*pi, figsize=[2,1])
sage: a
Animation with 21 frames
sage: a.show()
dyld: Symbol not found: __cg_png_create_info_struct
  Referenced from:
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/
Fram\
eworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /Applications/sage/local/lib//libPng.dylib

sh: line 1: 75999 Trace/BPT trap  convert -delay 20 -loop 0
*.png
"/Users/palmieri/.sage/sage_notebook/worksheets/admin/46/cells/37/
sage0.\
gif"


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



[sage-support] Re: problem with animate on OS X 10.5, Sage 3.1.2

2008-09-29 Thread John H Palmieri



On Sep 29, 7:40 am, Jason Grout <[EMAIL PROTECTED]> wrote:
>
> See http://trac.sagemath.org/sage_trac/ticket/975for a solution that is
> already put in place.  Basically, use
> $SAGE_ROOT/local/bin/sage-native-execute, which does exactly what
> mabshoff says above.

So like the following?



By the way, is there a way to tell which calls to os.system should use
sage-native-execute, or should we just deal with case-by-case?

  John

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



[sage-support] aspect_ratio in 3d

2008-09-29 Thread John H Palmieri

I don't understand aspect_ratio for 3d plots, or maybe there are bugs.
If I do (from the notebook interface)

sage: var('x y')
sage: Q = plot3d(sin(x+y), (-3,3), (-2,2))
sage: Q.show()

then I get a nice picture, with a labeled frame showing x going from
-3 to 3, y from -2 to 2, z from -1 to 1. The different axes are scaled
differently, so that (for example) the x and y axes have the same
length. Also,

sage: Q.show(aspect_ratio=[1,1,1])

works as expected: the variables are displayed in the appropriate
ranges, and the axes seem to all be scaled the same. But if I do

sage: Q.show(aspect_ratio=[1,1,2])

then I get a picture with a labeled frame showing x going from -3 to
3, y going from -4 to 4 (!), z going from -2 to 2 (!), the x and z
axes scaled the same, and the y-axis is at about half the scale of the
x-axis.  This is not at all what I expected; I was thinking that
[1,1,2] would mean that the z-axis would be doubled (or maybe halved)
in scale, compared to the other two.

I'm puzzled; can anyone explain this? The documentation for
aspect_ratio in show says

(default: "automatic") -- aspect ratio of the coordinate system itQ.
Give [1,1,1] to make spheres look round.

This is not helpful to me.  (And what does itQ mean? Is it a typo? Oh,
I see, it should have said "itself", but "self" got replaced by "Q".)

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



[sage-support] Re: aspect_ratio in 3d

2008-09-29 Thread John H Palmieri

On Sep 29, 3:51 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Mon, Sep 29, 2008 at 2:22 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
> Try frame_aspect_ratio, which is probably what you really want
> given your questions.

Hmm.  You're right -- that it is probably what I really want -- but I
still don't understand aspect_ratio.  Why, if I change aspect_ratio
from [1,1,1] to [1,1,2], do the relative scalings of the x- and y-axes
change?  Shouldn't only the z-axis (relative to x and y) be affected?

I guess I find the behavior of aspect_ratio rather unpredictable. With

P = sphere()
P.show(aspect_ratio=[a,b,c])

it makes sense: the coordinate system, and hence the sphere, is
stretched by these factors.  However, with the plot that I mentioned
in my original post, it seems to behave oddly, as mentioned above:
changing from [1,1,1] to [1,1,2] altered the relative scales on the x
and y axes.
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Questions about Matrices and Solving Linear Systems

2008-10-01 Thread John H Palmieri



On Oct 1, 9:15 am, Jason Grout <[EMAIL PROTECTED]> wrote:
> Stephen Hartke wrote:
> > Martin and Jason:
>
> > Thanks for your responses!  They were exactly what I looking for.  I
> > knew there had to be easy ways of changing matrices, but none of these
> > things are listed in the documentation on the web at sagemath.org
> >  (at least, not that I could find).
>
> Aha, that's something we could fix, then.  Where did you look?  Where
> would you have expected the information?

Note that information about solving linear systems is in recent
versions of the tutorial (in the linear algebra section, ), but until today, the web site
had an out-dated version.  So I hope that part of this is taken care
of.

>
> Thanks,
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support?hl=en
-~--~~~~--~~--~--~---



[sage-support] Re: integer linear programming in Sage?

2008-10-08 Thread John H Palmieri

On Oct 7, 11:38 am, Paul Zimmermann <[EMAIL PROTECTED]> wrote:
>        Hi,
>
> a question of a colleague from my lab:
>
> can Sage solve linear systems A*x=b, where A is a matrix with positive
> integer coefficients, b is a vector with positive integer coefficients,
> and the unknown vector x is searched over the positive integers?
>
> I guess this is more or less equivalent to integer linear programming (ILP),
> see http://en.wikipedia.org/wiki/Integer_linear_programming#Integer_unknowns.

This may be a silly question, but integer linear programming seems to
be about maximizing some quantity relative to constraints given by a
matrix equality (or inequality), where everything is happening over
the integers.  How does this relate to finding integer solutions to a
matrix equation?

I find myself wanting to do something similar: find *all* solutions to
Ax = b, where A, x, and b have non-negative integer entries.  I'm
trying to figure out if the various responses here will help me.  In
the situation of interest to me, I know that there are only finitely
many solutions, and I know one solution.

  John


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



[sage-support] Re: Question re : ./sage -upgrade

2008-10-20 Thread John H Palmieri

On Oct 20, 12:57 am, Simon King <[EMAIL PROTECTED]> wrote:
> Dear William,
>
> On Oct 20, 5:47 am, "William Stein" <[EMAIL PROTECTED]> wrote:
>
> > Just do sage -upgrade again.
>
> Should this work already? Wasn't there some posts on Sage devel that
> for some reason upgrade to 3.1.3 or 3.1.4 was a problem?
>
> I tried a minute ago, and an upgrade (starting with 3.1.2) failed,
> since "make" claimed that there is nothing to do.
>

In fact I recently tried this with 3.1.3, and it tried to upgrade to
3.1.2.

  John


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



[sage-support] Re: Question re : ./sage -upgrade

2008-10-20 Thread John H Palmieri

On Oct 20, 7:50 am, "William Stein" <[EMAIL PROTECTED]> wrote:
>
> Sorry, my answer above was from an airport via my iphone,

Now you're just showing off...

  John

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



[sage-support] why is this so slow?

2008-10-23 Thread John H Palmieri

The setup:

sage: var('x y')
sage: F = sin(x^2 + y^2) * cos(y) * exp(-0.5*(x^2+y^2))
sage: G=F.derivative(x,x); G
-3.00*x^2*e^(-(0.500*(y^2 +
x^2)))*cos(y)*sin(y^2 + x^2) -
1.00*e^(-(0.500*(y^2 + x^2)))*cos(y)*sin(y^2 +
x^2) - 4.00*x^2*e^(-(0.500*(y^2 +
x^2)))*cos(y)*cos(y^2 + x^2) + 2*e^(-(0.500*(y^2 +
x^2)))*cos(y)*cos(y^2 + x^2)

Then the following takes a long time, between 5 and 10 seconds on my
2.4 GHz Intel iMac.

sage: G(1.2, 1.2)
0.193703001636676

(I tried using 'timeit(G(1.2, 1.2))' but got: AttributeError:
'SymbolicArithmetic' object has no attribute 'find'.)

Why is it so slow, and are there any tricks I can use to speed it up?
I'd like to use these calculations in a class (graphing the degree 2
Taylor approximation to a function in two variables), but if it takes
minutes to compute all of the relevant first and second derivatives,
it's annoying.  (If a student says, "Let's see what happens if we
compute the Taylor polynomial at a different point", I'd like to be
able to oblige them.)

  John


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



[sage-support] Re: why is this so slow?

2008-10-23 Thread John H Palmieri

On Oct 23, 8:05 am, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Thu, Oct 23, 2008 at 7:56 AM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
> > The setup:
>
> > sage: var('x y')
> > sage: F = sin(x^2 + y^2) * cos(y) * exp(-0.5*(x^2+y^2))
> > sage: G=F.derivative(x,x); G
> > -3.00*x^2*e^(-(0.500*(y^2 +
> > x^2)))*cos(y)*sin(y^2 + x^2) -
> > 1.00*e^(-(0.500*(y^2 + x^2)))*cos(y)*sin(y^2 +
> > x^2) - 4.00*x^2*e^(-(0.500*(y^2 +
> > x^2)))*cos(y)*cos(y^2 + x^2) + 2*e^(-(0.500*(y^2 +
> > x^2)))*cos(y)*cos(y^2 + x^2)
>
> > Then the following takes a long time, between 5 and 10 seconds on my
> > 2.4 GHz Intel iMac.
>
> > sage: G(1.2, 1.2)
> > 0.193703001636676
>
> > (I tried using 'timeit(G(1.2, 1.2))' but got: AttributeError:
> > 'SymbolicArithmetic' object has no attribute 'find'.)
>
> > Why is it so slow, and are there any tricks I can use to speed it up?
>
> Because (the way Sage uses!?) Maxima sucks.
>
> For two months now several of us have been working on completely
> replacing Sage's use of Maxima for symbolic manipulation with reliance
> on a C++ library called Ginac.  This will make its first appearance as
> a non-default option in Sage-3.2.
>
> William

My impression is that Ginac is in 3.2-alpha0, which I just installed.
Can I use it to do these computations? If so, how?

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



[sage-support] Re: why is this so slow?

2008-10-23 Thread John H Palmieri

On Oct 23, 8:56 am, "William Stein" <[EMAIL PROTECTED]> wrote:
> Here's me doing this in sage-3.2.alpha0.  Note that not all the same
> commands and conventions as with Sage's usual symbolic variables
> are yet supported.  However, the good thing is that the final substitution
> takes 1.81 ms on sage.math instead of 10 seconds.
>
> [EMAIL PROTECTED]:~/build/sage-3.2.alpha0$ ./sage
> --
> | SAGE Version 3.2.alpha0, Release Date: 2008-10-20                  |
> | Type notebook() for the GUI, and license() for information.        |
> --
>
> sage: var('x,y',ns=1)    #note the ns=1, which will go away in the future...
> (x, y)
> sage: F = sin(x^2 + y^2) * cos(y) * exp(-0.5*(x^2+y^2))
> sage: G=F.diff(x,1).diff(x,1); G

or G=F.diff(x,2)

> -exp(-(0.500)*x^2 - (0.500)*y^2)*sin(x^2 +
> y^2)*cos(y) + 2*exp(-(0.500)*x^2 -
> (0.500)*y^2)*cos(x^2 + y^2)*cos(y) -
> (3.00)*exp(-(0.500)*x^2 -
> (0.500)*y^2)*sin(x^2 + y^2)*cos(y)*x^2 -
> (4.00)*exp(-(0.500)*x^2 -
> (0.500)*y^2)*cos(x^2 + y^2)*cos(y)*x^2
> sage: G.subs(x=1.2).subs(y=1.2)
> 0.193703001636676
> sage: timeit('G.subs(x=1.2).subs(y=1.2)')
> 125 loops, best of 3: 1.81 ms per loop
>
> William

Great! That's much better.

  John


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



[sage-support] Re: why is this so slow?

2008-10-23 Thread John H Palmieri

Okay, using what William said, I produced this an 'interact' example,
showing the linear and quadratic Taylor approximations to a certain
function in two variables.  Right now it's using a combo of the old
and new symbolic stuff, because that seems to be the best way to get
things done...

var('x y')
F = sin(x^2 + y^2) * cos(y) * exp(-0.5*(x^2+y^2))
plotF = plot3d(F, (x, 0.4, 2), (y, 0.4, 2), adaptive=True,
color='blue')
var('xx yy', ns=1)
G = sin(xx^2 + yy^2) * cos(yy) * exp(-0.5*(xx^2+yy^2))
@interact
def _(x0=(0.8,1.6), y0=(0.8, 1.6), show_plane=("Show linear
approximation", False), show_quad=("Show quadratic approximation",
False)):
F0 = float(G.subs(xx=x0).subs(yy=y0))
F1 = float(G.diff(xx).subs(xx=x0).subs(yy=y0))
F2 = float(G.diff(yy).subs(xx=x0).subs(yy=y0))
F11 = float(G.diff(xx, 2).subs(xx=x0).subs(yy=y0))
F12 = float(G.diff(xx).diff(yy).subs(xx=x0).subs(yy=y0))
F22 = float(G.diff(yy, 2).subs(xx=x0).subs(yy=y0))
P = (x0, y0, F0)
dot = point3d(P, size=15, color='red')
plane = F0 + F1 * (x-x0) + F2 * (y-y0)
quad = plane + 1/2 * (F11 * (x-x0)^2 + 2 * F12 * (x-x0) * (y-y0) +
F22 * (y-y0)^2)
plane_string = 'z = %.2f + %.2f(x-x_0)+%.2f(y-y_0)'%(F0, F1, F2)
quad_string = plane_string + '+ \\frac{1}{2} \\left((%.2f) (x-
x_0)^2 + 2(%.2f) (x-x_0)(y-y_0) + (%.2f)(y-y_0)^2\\right)'%(F11, F12,
F22)
plot1 = plot3d(plane, (x, 0.4, 2), (y, 0.4, 2), color='green')
plot2 = plot3d(quad, (x, max(0.4, x0-0.5), min(2.0, x0+0.5)),
 (y, max(0.4, y0-0.5), min(2.0, y0+0.5)), color='purple')
plot = dot + plotF
if show_plane: plot += plot1
if show_quad: plot += plot2
html('$F(x,y) = e^{-(x^2+y^2)/2} \\cos(y) \\sin(x^2+y^2)$')
if show_plane: html('tangent plane: $%s$'%plane_string)
if show_quad: html('quad approx: $%s$'%quad_string)
show(plot)


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



[sage-support] Re: new user: latex fails

2008-10-29 Thread John H Palmieri

On Oct 29, 8:44 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Dear sage users, I installed sage and texlive on my small virtual
> server.
>
> LaTeXing does not work:
> %latex
> Ahoj

This looks like an earlier message: see the 4th message in the thread
 (or if the line breaks screw up the link,
search this group for "latex error slide").  The poster managed to fix
the problem, saying

> ok, it's working, I installed imagemagick, tex4ht, gv, gs (following
> the March 12 sage-devel latex in notebook instructions)

(The point in the March 12 thread (search sage-devel for "latex
notebook") was that dvipng needed to be installed, and installing some
subset of these packages was one way to do it.)

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



[sage-support] Re: Problem finding eigenvalues in sage

2008-11-06 Thread John H Palmieri

On Nov 6, 9:07 pm, "Mike Hansen" <[EMAIL PROTECTED]> wrote:
> I'm not sure how to covert those sqrt expressions into what you want.
> However, you can see that they are what you're expecting:
>
> sage: A = matrix([[-1,-1+I],[1,0]])
> sage: evs = A.eigenvalues(); evs
> [(-sqrt(4*I - 3) - 1)/2, (sqrt(4*I - 3) - 1)/2]
> sage: map(CC, evs)
> [-1.00 - 1.00*I, 1.00*I]

or

sage: [x.n() for x in evs]
[-1.00 - 1.00*I, 1.00*I]

or (since .n() has many synonyms)

sage: N(evs[0])
-1.00 - 1.00*I

(Note that (1+2i)^2 = -3 + 4i, so your expressions are (-1 +/- (1+2i))/
2, which gives the numbers you want.)

  John


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



[sage-support] Re: Drawing points on a sphere

2008-11-11 Thread John H Palmieri

On Nov 11, 9:01 pm, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> You can pass a "radius" or "size" parameter to the point command,  
> which will make them smaller or larger. Also, you can look at the  
> line3d command (pass it a list of points to get a curved line).

Also the parametric_plot3d command might be useful.

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



[sage-support] pth roots in fields of characteristic p

2008-11-18 Thread John H Palmieri

Does Sage know how to compute pth roots in any finite field of
characteristic p? That is, if I have a prime number p, a finite field
F of characteristic p, and an element b of F, will

sage: b.nth_root(p)

always return a value, or will it sometimes return a ValueError?  Does
it depend on the field, and if so, is there a way to test whether any
given field has an algorithm for computing pth roots?  (If I want to
implement something which depends on such an algorithm, I want to be
able to ignore the bad fields from the start.)

I don't know what infinite fields of characteristic p Sage knows
about, but one could ask similar questions for those: is there
something like an 'is_perfect' method, and for which perfect fields
does Sage know how to compute pth roots?

  John

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



[sage-support] Re: pth roots in fields of characteristic p

2008-11-18 Thread John H Palmieri

Thanks for the answers.  By the way:

> Infinite fields of characteristic p aren't perfect,

Isn't the algebraic closure of F_p perfect?  For fields of
characteristic p, perfect should mean that every element has a pth
root.  (I agree that some infinite fields of characteristic p aren't
perfect, but this is not true for all of them.)

  John

> because the definition
> of perfect is that "every finite extension is separable".
> In any case, Sage is I think very limited regarding non-finite characteristic
> p fields, unfortunately (e.g., function fields of curves over finite fields).
> This is one of those things that Magma is unusually good at.
>
> William
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



<    1   2   3   4   5   6   >