[sage-support] Re: sage ignores lines.color value in matplotlibrc

2011-08-01 Thread kcrisman
Two very random thoughts:

1. You may also have a more global matplotlibrc file somewhere - that
caused me no end of problems reviewing a patch once.

2. I'm not actually sure that matplotlibrc controls the colors of the
lines in plots - this may be set by Sage itself directly.  Can you
give the precise plots and what you changed in your file explicitly?

- kcrisman

On Jul 31, 12:16 am, andres.ordonez
andres.felipe.ordo...@gmail.com wrote:
 Hi, there's something weird going on with my matplotlibrc file. When I
 change the value of lines.color from blue to, for example, black the
 lines in the plots are still blue. However, changes in lines.linestyle
 are detected so I guess I'm editing the right file (/usr/local/
 sage-4.6/local/lib/python2.6/site-packages/matplotlib/mpl-data). Any
 ideas of what's going on?

 Sage 4.6.2
 Ubuntu 11.04

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


[sage-support] Re: how to import locally defined extension types?

2011-08-01 Thread john_perry_usm
Simon's solution looks like it would solve what I wanted at the time,
but right now I think I will return to one file, debug everything
(since things are still in a state of flux) then separate it into
several files  use a setup.py.

Thanks for the suggestions and insight!

john

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


[sage-support] Re: sage ignores lines.color value in matplotlibrc

2011-08-01 Thread John H Palmieri
On Saturday, July 30, 2011 9:16:10 PM UTC-7, andres.ordonez wrote:

 Hi, there's something weird going on with my matplotlibrc file. 


Are you talking about the file $HOME/.matplotlibrc?  Sage doesn't actually 
use that file, as far as I know.  Try putting a copy in 
$HOME/.sage/matplotlib-1.0.1/ (or a similarly named, already existing, 
directory).

The reason that Sage doesn't use this file is that some matplotlib 
configuration files are not compatible among different versions of 
matplotlib, so Sage needs to make sure that it is accessing configuration 
files suitable for the version of matplotlib included with Sage.  See 

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

and

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

-- 
John

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


[sage-support] Re: sage ignores lines.color value in matplotlibrc

2011-08-01 Thread andres.ordonez
I have these matplotlibrc files:

/etc/matplotlibrc
/home/andres/.matplotlib/matplotlibrc
/home/andres/.sage/matplotlibrc
/usr/local/sage-4.6/local/lib/python2.6/site-packages/matplotlib/mpl-
data/matplotlibrc

I think that the only one that is valid in sage is the last one,  /usr/
local/sage-4.6/local/lib/python2.6/site-packages/matplotlib/mpl-data/
matplotlibrc, this is what I did

I used a different linestyle in each of the matplotlibrc files:

lines.linestyle   :  --# different for each matplotlibrc
file
lines.color:  yellow # same in all matplotlibrc files

And then checked a plot to see what linestyle it had:

sage: plot(x,x,0,5)

The linestyle was the one in /usr/local/sage-4.6/local/lib/python2.6/
site-packages/matplotlib/mpl-data/matplotlibrc, however the color was
blue instead of yellow!
(I also checked with various linestyles in that file to see that the
process was independent of the linestyle used.)



On Aug 1, 8:27 am, kcrisman kcris...@gmail.com wrote:
 Two very random thoughts:

 1. You may also have a more global matplotlibrc file somewhere - that
 caused me no end of problems reviewing a patch once.

 2. I'm not actually sure that matplotlibrc controls the colors of the
 lines in plots - this may be set by Sage itself directly.  Can you
 give the precise plots and what you changed in your file explicitly?

 - kcrisman

 On Jul 31, 12:16 am, andres.ordonez







 andres.felipe.ordo...@gmail.com wrote:
  Hi, there's something weird going on with my matplotlibrc file. When I
  change the value of lines.color from blue to, for example, black the
  lines in the plots are still blue. However, changes in lines.linestyle
  are detected so I guess I'm editing the right file (/usr/local/
  sage-4.6/local/lib/python2.6/site-packages/matplotlib/mpl-data). Any
  ideas of what's going on?

  Sage 4.6.2
  Ubuntu 11.04

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


[sage-support] Re: sage ignores lines.color value in matplotlibrc

2011-08-01 Thread John H Palmieri


On Monday, August 1, 2011 9:22:58 AM UTC-7, andres.ordonez wrote:

 I have these matplotlibrc files: 

 /etc/matplotlibrc 
 /home/andres/.matplotlib/matplotlibrc 
 /home/andres/.sage/matplotlibrc 
 /usr/local/sage-4.6/local/lib/python2.6/site-packages/matplotlib/mpl- 
 data/matplotlibrc 


I don't know what's going on with the color -- I have a feeling that Sage is 
setting blue as the default color somewhere, overriding the settings in the 
rc files -- but when I put

   lines.linestyle   : --

in /home/palmieri/.sage/matplotlib-1.0.1/matplotlibrc, it gets used instead 
of the default.

-- 
John

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


[sage-support] Re: sage ignores lines.color value in matplotlibrc

2011-08-01 Thread kcrisman


On Aug 1, 1:28 pm, John H Palmieri jhpalmier...@gmail.com wrote:
 On Monday, August 1, 2011 9:22:58 AM UTC-7, andres.ordonez wrote:

  I have these matplotlibrc files:

  /etc/matplotlibrc
  /home/andres/.matplotlib/matplotlibrc
  /home/andres/.sage/matplotlibrc
  /usr/local/sage-4.6/local/lib/python2.6/site-packages/matplotlib/mpl-
  data/matplotlibrc

 I don't know what's going on with the color -- I have a feeling that Sage is
 setting blue as the default color somewhere, overriding the settings in the
 rc files -- but when I put

Yes, it does.

In line.py:

@options(alpha=1, rgbcolor=(0,0,1), thickness=1, legend_label=None)
def line2d(points, **options):

This is done with most Sage plotting things.  Notice that it does
*not* provide a default linestyle :)

My guess is that if you tried thickness or alpha you'd get the same
behavior?  I think this is intended to be a feature, but other ideas
on that are welcome.

- kcrisman

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


[sage-support] Re: sage ignores lines.color value in matplotlibrc

2011-08-01 Thread andres.ordonez
Indeed, lines.thickness in matplotlibrc has no effect in the plots.

Is it possible to just modify line.py and get the specified color in
the plots?
If so, I have several line.py and am not sure which to modify:

/usr/local/sage-4.6/devel/sage-main/.hg/store/data/sage/plot/line.py.i
/usr/local/sage-4.6/devel/sage-main/build/lib.linux-x86_64-2.6/sage/
plot/line.py
/usr/local/sage-4.6/devel/sage-main/build/sage/plot/line.py
/usr/local/sage-4.6/devel/sage-main/sage/plot/line.py
/usr/local/sage-4.6/local/lib/python2.6/networkx/generators/line.py
/usr/local/sage-4.6/local/lib/python2.6/site-packages/sympy/geometry/
line.py

On Aug 1, 2:03 pm, kcrisman kcris...@gmail.com wrote:
 On Aug 1, 1:28 pm, John H Palmieri jhpalmier...@gmail.com wrote:

  On Monday, August 1, 2011 9:22:58 AM UTC-7, andres.ordonez wrote:

   I have these matplotlibrc files:

   /etc/matplotlibrc
   /home/andres/.matplotlib/matplotlibrc
   /home/andres/.sage/matplotlibrc
   /usr/local/sage-4.6/local/lib/python2.6/site-packages/matplotlib/mpl-
   data/matplotlibrc

  I don't know what's going on with the color -- I have a feeling that Sage is
  setting blue as the default color somewhere, overriding the settings in the
  rc files -- but when I put

 Yes, it does.

 In line.py:

 @options(alpha=1, rgbcolor=(0,0,1), thickness=1, legend_label=None)
 def line2d(points, **options):

 This is done with most Sage plotting things.  Notice that it does
 *not* provide a default linestyle :)

 My guess is that if you tried thickness or alpha you'd get the same
 behavior?  I think this is intended to be a feature, but other ideas
 on that are welcome.

 - kcrisman

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


[sage-support] Re: sage ignores lines.color value in matplotlibrc

2011-08-01 Thread Jason Grout

On 8/1/11 12:33 PM, andres.ordonez wrote:

Indeed, lines.thickness in matplotlibrc has no effect in the plots.

Is it possible to just modify line.py and get the specified color in
the plots?


Try doing:

plot.options['rgbcolor']=(0,0,0)

That sets the Sage default color (what others pointed out in the 
@options.  If you want it to stay that way, you could put that line in 
the init.sage file.  You can set other Sage default options like that too.


Thanks,

Jason

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


[sage-support] Re: Sums of Modular Symbols

2011-08-01 Thread jack


On Jul 31, 10:35 pm, D. S. McNeil dsm...@gmail.com wrote:
  We would like to know if certain sums of modular symbols span the
  space.

 Is this the sort of thing you had in mind?

 sage: M=ModularSymbols(11,2);M
 Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with
 sign 0 over Rational Field
 sage: b = M.basis()
 sage:
 sage: s1 = 2*b[1] - b[2]
 sage: s2 = -b[0] + b[2]
 sage: s3 = -b[0] + b[1]
 sage: s1, s2, s3
 (2*(1,8) - (1,9), -(1,0) + (1,9), -(1,0) + (1,8))
 sage: s1.list()
 [0, 2, -1]
 sage:
 sage: V = span([s.list() for s in s1, s2, s3],QQ); V
 Vector space of degree 3 and dimension 3 over Rational Field
 Basis matrix:
 [1 0 0]
 [0 1 0]
 [0 0 1]
 sage:
 sage: s3 = s2
 sage: V = span([s.list() for s in s1, s2, s3],QQ); V
 Vector space of degree 3 and dimension 2 over Rational Field
 Basis matrix:
 [   1    0   -1]
 [   0    1 -1/2]

 Doug

Thanks for this.  There still seems to be a manual step in going from,
say,
s1 = 2*(1,8) - (1,9)
to
 s1 = 2*b[1] - b[2]

Now consider
sage: M=ModularSymbols(389,2);M
Modular Symbols space of dimension 65 for Gamma_0(389) of weight 2
with sign 0 over Rational Field

This manual step could become slow and error prone.
Any suggestions for automating this step?

Best,
Jack Fearnley


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


[sage-support] Re: sage ignores lines.color value in matplotlibrc

2011-08-01 Thread andres.ordonez
Great! I didn't know about sage.init. Thanks!

On Aug 1, 2:39 pm, Jason Grout jason-s...@creativetrax.com wrote:
 On 8/1/11 12:33 PM, andres.ordonez wrote:

  Indeed, lines.thickness in matplotlibrc has no effect in the plots.

  Is it possible to just modify line.py and get the specified color in
  the plots?

 Try doing:

 plot.options['rgbcolor']=(0,0,0)

 That sets the Sage default color (what others pointed out in the
 @options.  If you want it to stay that way, you could put that line in
 the init.sage file.  You can set other Sage default options like that too.

 Thanks,

 Jason

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


[sage-support] Re: sage ignores lines.color value in matplotlibrc

2011-08-01 Thread kcrisman


On Aug 1, 3:39 pm, Jason Grout jason-s...@creativetrax.com wrote:
 On 8/1/11 12:33 PM, andres.ordonez wrote:

  Indeed, lines.thickness in matplotlibrc has no effect in the plots.

  Is it possible to just modify line.py and get the specified color in
  the plots?

 Try doing:

 plot.options['rgbcolor']=(0,0,0)

 That sets the Sage default color (what others pointed out in the
 @options.  If you want it to stay that way, you could put that line in
 the init.sage file.  You can set other Sage default options like that too.

Good call, Jason.

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


[sage-support] Re: Optimized

2011-08-01 Thread Jason Grout

On 8/1/11 4:05 PM, William Stein wrote:

On Mon, Aug 1, 2011 at 2:28 PM, Spencermalibuworkc...@gmail.com  wrote:

Alright, it took a lot of rewrites but the optimizer is up and
running, and its really quick (the slow part is looking up and
processing stock info).  It allows for one to put in an accepted risk
free rate (as a proportion not a percent), or an index of acceptable
risk [0,inf] and then the program will find your proportions.  Short
selling is allowed and there is no way to turn it off yet (limiting
the answers to positive values would make the calculation much more
complicated).

Think I'll quickly pop in a confidence interval function then maybe go
on to spread unless there is something else I should do first.  I also
want to take some time to put CovMatrix up for review so that I don't
have to copy paste it into every worksheet I make.


Hi,

Using pastebin.com, I pasted this file:

def profit(n):
 return 1.1*n

Then I clicked on Raw to get this URL:
http://pastebin.com/raw.php?i=Y6zkrjUp

In a worksheet I can now paste the following, the file I put at
pastebin then gets loaded as a .sage file (so with full Sage
preparsing):

f = get_remote_file(http://pastebin.com/raw.php?i=Y6zkrjUp;)
import shutil; shutil.move(f, f+'.sage')
load f+'.sage'


Then I can use the code that was defined in that paste.  Anybody else
can do the same.

You can edit the code, but then I think it has to be a new paste,
which has a new URL.


If you use gist (by github), which keeps track of filenames, you can 
shorten your instructions.


Go to https://gist.github.com/

name this file: myfile.sage
type your code in.
Create public gist

Then click on raw to get the url, for example:

https://raw.github.com/gist/1119259/199adeabc1e4fdefa1ccac395149d96c65b9f938/myfile.sage

Then in sage:

load 
'https://raw.github.com/gist/1119259/199adeabc1e4fdefa1ccac395149d96c65b9f938/myfile.sage'


As a bonus, your paste is version controlled and people can make 
branches of it.


Thanks,

Jason

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


Re: [sage-support] Re: Optimized

2011-08-01 Thread William Stein
On Mon, Aug 1, 2011 at 4:43 PM, Jason Grout jason-s...@creativetrax.com wrote:
 On 8/1/11 4:05 PM, William Stein wrote:

 On Mon, Aug 1, 2011 at 2:28 PM, Spencermalibuworkc...@gmail.com  wrote:

 Alright, it took a lot of rewrites but the optimizer is up and
 running, and its really quick (the slow part is looking up and
 processing stock info).  It allows for one to put in an accepted risk
 free rate (as a proportion not a percent), or an index of acceptable
 risk [0,inf] and then the program will find your proportions.  Short
 selling is allowed and there is no way to turn it off yet (limiting
 the answers to positive values would make the calculation much more
 complicated).

 Think I'll quickly pop in a confidence interval function then maybe go
 on to spread unless there is something else I should do first.  I also
 want to take some time to put CovMatrix up for review so that I don't
 have to copy paste it into every worksheet I make.

 Hi,

 Using pastebin.com, I pasted this file:

 def profit(n):
     return 1.1*n

 Then I clicked on Raw to get this URL:
 http://pastebin.com/raw.php?i=Y6zkrjUp

 In a worksheet I can now paste the following, the file I put at
 pastebin then gets loaded as a .sage file (so with full Sage
 preparsing):

 f = get_remote_file(http://pastebin.com/raw.php?i=Y6zkrjUp;)
 import shutil; shutil.move(f, f+'.sage')
 load f+'.sage'


 Then I can use the code that was defined in that paste.  Anybody else
 can do the same.

 You can edit the code, but then I think it has to be a new paste,
 which has a new URL.

 If you use gist (by github), which keeps track of filenames, you can shorten
 your instructions.

 Go to https://gist.github.com/

 name this file: myfile.sage
 type your code in.
 Create public gist

 Then click on raw to get the url, for example:

 https://raw.github.com/gist/1119259/199adeabc1e4fdefa1ccac395149d96c65b9f938/myfile.sage

 Then in sage:

 load
 'https://raw.github.com/gist/1119259/199adeabc1e4fdefa1ccac395149d96c65b9f938/myfile.sage'

 As a bonus, your paste is version controlled and people can make branches of
 it.

Very, very nice!



 Thanks,

 Jason

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




-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

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


Re: [sage-support] Re: Sums of Modular Symbols

2011-08-01 Thread D. S. McNeil
 Thanks for this.  There still seems to be a manual step in going from,
 say,
 s1 = 2*(1,8) - (1,9)
 to
  s1 = 2*b[1] - b[2]

I may be misunderstanding you.  Are you saying you want to enter the line

s1 = 2*(1,8)-(1,9)

verbatim and have it work?  That I don't think I can do (unless you're
willing to type them not at the prompt but in a string or file which
is then parsed).  One option is to use a dictionary as an intermediary
step:

age: M = ModularSymbols(11,2);M
Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with
sign 0 over Rational Field
sage: m = dict((sage_eval(str(b)), b) for b in M.basis())
sage: m
{(1, 0): (1,0), (1, 8): (1,8), (1, 9): (1,9)}

This dictionary basically maps a tuple to the corresponding
ModularSymbolsElement in the basis.  [Yes, to be safer I should really
use ast.literal_eval.]  Then you could write:

sage: s = [2*m[1,8] - m[1,9],
:  -m[(1,0)] + m[(1,9)],
:  -m[(1,0)] + m[(1,8)]]
sage: s
[2*(1,8) - (1,9), -(1,0) + (1,9), -(1,0) + (1,8)]

Note that the parentheses () are optional.  Finally:

sage: V = span([sx.list() for sx in s],QQ)
sage: V
Vector space of degree 3 and dimension 3 over Rational Field
Basis matrix:
[1 0 0]
[0 1 0]
[0 0 1]


Would something like that work or do you have a particular format that
you can't escape?


Doug

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


Re: [sage-support] Re: Sums of Modular Symbols

2011-08-01 Thread D. S. McNeil
.. I suppose you could even add a convenience function

def b(*x):
return m[x]

after which

sage: s = [2*b(1,8) - b(1,9),
:  -b(1,0) + b(1,9),
:  -b(1,0) + b(1,8)]
sage: s
[2*(1,8) - (1,9), -(1,0) + (1,9), -(1,0) + (1,8)]

would work.


Doug

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


[sage-support] Re: Sums of Modular Symbols

2011-08-01 Thread jack


On Aug 1, 11:10 pm, D. S. McNeil dsm...@gmail.com wrote:
  Thanks for this.  There still seems to be a manual step in going from,
  say,
  s1 = 2*(1,8) - (1,9)
  to
   s1 = 2*b[1] - b[2]

 I may be misunderstanding you.  Are you saying you want to enter the line

     s1 = 2*(1,8)-(1,9)

 verbatim and have it work?  

No, s1 will be the result of a calculation on sums of modular symbols
over various residue classes.

Sorry if I was not expressing myself clearly enough.

Jack

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


[sage-support] Use latex tags in variable names?

2011-08-01 Thread Joon Ro

Hi,

I just started using Sage, and I have a question about variable names.
I skimmed through the documentation but could not find any answers.

Is it possible to used latex tags in variable names so when I do  
show(var) I get the latex output?

For example, I want to do:

p_1star = var('p_1^*')

but apparently it does not work. (latex(p_1star) yields p_{\mbox{1^*}})

Is there any way to do this?

Thank you,
Joon

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


[sage-support] Re: Use latex tags in variable names?

2011-08-01 Thread John H Palmieri
On Monday, August 1, 2011 8:28:57 PM UTC-7, Joon wrote:

 Hi,

 I just started using Sage, and I have a question about variable names. 
 I skimmed through the documentation but could not find any answers.

 Is it possible to used latex tags in variable names so when I do 
 show(var) I get the latex output?
 For example, I want to do:

 p_1star = var('p_1^*')


Try:

   sage: p_1star = var('p_1star', latex_name='p_1^*')

-- 
John

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