[sage-support] Re: new cell in worksheet

2009-03-24 Thread Jose Guzman

William Stein wrote:
 On Mon, Mar 23, 2009 at 11:07 AM, Jose Guzman n...@neurohost.org wrote:
   
 Stan Schymanski wrote:
 
 In this context, I'm having trouble inserting a calculation cell before
 a html cell or between two html cells in Sage 3.4. The Alt-Enter or
 Ctrl-Enter methods don't not work in html cells. If I want to insert a
 calculation cell before an html cell, I can't just press Alt-Enter in
 the foregoing calculation cell, because this creates a new calculation
 cell AFTER the html cell. Is there another way?

 Cheers,
 Stan

 kcrisman wrote:

   
 Dear Kwankyu,



 
 If I write and evaluate in a cell in a worksheet and if there are
 already cells below the one which I am evaluating, then the cursor
 moves into the cell just below instead of creating a new cell for next
 input. Is this behavior preferable? This is annoying at least to me.


   
 One of the designers can answer for the technical reasons for this
 design decision, but let me tell you it is very useful when you are
 running through a worksheet you have already created, but changing a
 few things (e.g. some initial constant defined at the top)!

 But actually, if you click on Help you will see that Alt-Enter
 actually does what you require, while Ctrl-Enter splits the cell and
 evaluates both things.  I didn't know either of these until I looked
 just now, and will definitely use them now too.

 Enjoy!

 - kcrisman



 
   
 I found this problem very annoying too. This is a purely  pragmatic
 solution, but what I do is to go to the edit button and change the
 source code to add a new cell just typing {{{id=X \\\}}} where X is an
 integer not present in my worksheet.

 Hope it helps
 

 You should be able to put a new cell in just by typing
 {{{
 }}}

 Note that (1) the id=X thing isn't needed at all, and (2) it's three
 *forward* slashes, not three backward slashes like it says above, but
 those aren't needed either.

 William
   
Thank you very much for your information Willian. As I mentioned, these 
are trial and error tricks, I was not awared that the solution was so easy.

Thanks!

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



[sage-support] Re: new cell in worksheet

2009-03-24 Thread Stan Schymanski

Hi Jason,

Thanks a lot for that! Your proposal sounds good. Pity it hasn't been
implemented yet, but perhaps the tickets you submitted will help. I'll
contribute my thoughts when I have an account.

Stan

On Mar 23, 4:01 pm, Jason Grout jason-s...@creativetrax.com wrote:
 Stan Schymanski wrote:
  Thanks for your feedback, Jason! Could you submit a ticket for this to
  be fixed/enhanced? Unfortunately, I can't do it myself.

 We should get you a trac account, then.  You can follow the instructions
 onhttp://trac.sagemath.org/sage_trac/

 The bugs are nowhttp://trac.sagemath.org/sage_trac/ticket/5591

 and

 The bug is nowhttp://trac.sagemath.org/sage_trac/ticket/5592

 As for the alt-enter and ctrl-enter thing, can you look at my proposal
 in the last few messages in this 
 thread:http://groups.google.com/group/sage-devel/browse_thread/thread/5892dd...

 (specifically,http://groups.google.com/group/sage-devel/msg/e351edd7b62437b9)

 That proposal deals with splitting cells.

 Note that two adjacent text cells are merged whenever the sheet is saved
 and reopened.  I don't know that alt-enter and ctrl-enter makes sense
 right now (however, maybe the text cells shouldn't be merged, and maybe
 alt-enter and ctrl-enter should make sense...)

 Jasno



  Cheers,
  Stan

  Jason Grout wrote:
  Stan Schymanski wrote:

  In this context, I'm having trouble inserting a calculationcellbefore
  a htmlcellor between two html cells in Sage 3.4. The Alt-Enter or
  Ctrl-Enter methods don't not work in html cells.

  Both of these are because they have not been implemented.  Contributions
  are definitely welcome!

  If I want to insert a
  calculationcellbefore an htmlcell, I can't just press Alt-Enter in
  the foregoing calculationcell, because this creates anewcalculation
 cellAFTER the htmlcell. Is there another way?

  Hmmm...I'd consider this a bug.  The Alt-enter should make anew
  calculationcellright after the old calculationcell(before the
  following htmlcell).

  Jason

  Cheers,
  Stan

  kcrisman wrote:

  Dear Kwankyu,

  If I write and evaluate in acellin aworksheetand if there are
  already cells below the one which I am evaluating, then the cursor
  moves into thecelljust below instead of creating anewcellfor next
  input. Is this behavior preferable? This is annoying at least to me.

  One of the designers can answer for the technical reasons for this
  design decision, but let me tell you it is very useful when you are
  running through aworksheetyou have already created, but changing a
  few things (e.g. some initial constant defined at the top)!

  But actually, if you click on Help you will see that Alt-Enter
  actually does what you require, while Ctrl-Enter splits thecelland
  evaluates both things.  I didn't know either of these until I looked
  just now, and will definitely use them now too.

  Enjoy!

  - kcrisman


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



[sage-support] Re: maximum recursion depht exceded

2009-03-24 Thread christophe van der putten

Thank you for your help, i will test that.

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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread Stan Schymanski

The following displays a plot in my notebook (Sage3.4) if I put it all 
in the same cell:

sage: var('t'); # symbolic variable
sage: var('g'); # symbolic variable
sage:  f(t) = g*(t**2-1)/(2*(t-1)) # try to simplify this function later...
sage: plot(f.subs(g=9.81), 0, 10)

Does this not work for you?

Stan


Jose Guzman wrote:
   
 By the way, if you type

sage: plot(f.subs(g=9.81), 0, 10)

 then the plot will be displayed -- you don't need to save the plot and
 then 'show' it.


   
 
 I tried this and it works only with the console. If you use the notebook 
 you have to use the show() command. Anyway, thank you very much for the 
 tip!!1

 Jose.

 
   


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



[sage-support] Re: Magma Problem

2009-03-24 Thread Santanu Sarkar
My operating system is Linux Ubuntu 8.04 on a computer with Dual CORE
Intel(R).
if you start sage and do

 sage: !magma  then output is
sh: magma: not found

On Sat, Mar 21, 2009 at 2:11 AM, William Stein wst...@gmail.com wrote:


 On Fri, Mar 20, 2009 at 7:48 AM, Santanu Sarkar
 sarkar.santanu@gmail.com wrote:
  I have installed both Magma and Sage. How can I use Magma in the Sage
  notebook (with Mozilla Firefox)? I always get RuntimeError: Unable to
 start
  magma because the command 'magma -n' failed. Probably Sage does not know
  where to find my magma installation. How can I specify it?

 Precisely what operating system are you using?

 What happens if you start sage and do

  sage: !magma

 William

 


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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread Jose Guzman

Stan Schymanski wrote:
 The following displays a plot in my notebook (Sage3.4) if I put it all 
 in the same cell:

 sage: var('t'); # symbolic variable
 sage: var('g'); # symbolic variable
 sage:  f(t) = g*(t**2-1)/(2*(t-1)) # try to simplify this function later...
 sage: plot(f.subs(g=9.81), 0, 10)

 Does this not work for you?

 Stan


 Jose Guzman wrote:
   
   
 
 By the way, if you type

sage: plot(f.subs(g=9.81), 0, 10)

 then the plot will be displayed -- you don't need to save the plot and
 then 'show' it.


   
 
   
 I tried this and it works only with the console. If you use the notebook 
 you have to use the show() command. Anyway, thank you very much for the 
 tip!!1

 Jose.

 
   
 


 
   
Yes it works! for some strange reason it did not work in my old sheet. I 
though to plot one should use a combination of plot() and show() 
commands. Actually, I created a small tutorial for private use to learn 
more about sage commands to plot, which talks about the use of plot() 
and show(). I expected to use it for my future curse of Sage for 
scientist in my institute. :P You can see in http://sagenb.org/home/pub/399




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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread Jason Grout

Jose Guzman wrote:

 Yes it works! for some strange reason it did not work in my old sheet. I 
 though to plot one should use a combination of plot() and show() 
 commands. Actually, I created a small tutorial for private use to learn 
 more about sage commands to plot, which talks about the use of plot() 
 and show(). I expected to use it for my future curse of Sage for 
 scientist in my institute. :P You can see in http://sagenb.org/home/pub/399


This looks great.  Would you be willing to contribute it to Sage as a 
primer?  (A Sage primer is a short, focused exploration of a specific 
functionality of Sage.)

Jason


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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread Jason Grout

Jose Guzman wrote:

 Yes it works! for some strange reason it did not work in my old sheet. I 
 though to plot one should use a combination of plot() and show() 
 commands. Actually, I created a small tutorial for private use to learn 
 more about sage commands to plot, which talks about the use of plot() 
 and show(). I expected to use it for my future curse of Sage for 
 scientist in my institute. :P You can see in http://sagenb.org/home/pub/399


In looking at your code, I had an idea about specifying colors.  Why 
don't we have some default color objects defined in Sage, like red, 
blue, yellow, green, etc.  Methods could include .darker(), .lighter(), 
etc.  So you could specify a plot as:

plot(x^2, (x,0,1), color=red)
plot(x^3, (x,0,1), color=blue.darker())
plot(x^4, (x,0,1), color=green.lighter())
plot(x^5, (x,0,1), color=red+blue) #gives purple :)

and then for the more esoteric names (all of the standard web colors, 
all of the standard x11 colors, etc.), use the color namespace.

plot(sin(x), (x,0,1), color=color.goldenrod)

Thoughts?

Jason


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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread Jose Guzman

Jason Grout wrote:
 Jose Guzman wrote:

   
 Yes it works! for some strange reason it did not work in my old sheet. I 
 though to plot one should use a combination of plot() and show() 
 commands. Actually, I created a small tutorial for private use to learn 
 more about sage commands to plot, which talks about the use of plot() 
 and show(). I expected to use it for my future curse of Sage for 
 scientist in my institute. :P You can see in http://sagenb.org/home/pub/399
 


 This looks great.  Would you be willing to contribute it to Sage as a 
 primer?  (A Sage primer is a short, focused exploration of a specific 
 functionality of Sage.)

 Jason

   
Dear Jason,

I would be happy to contribute to any form with the  
development/expansion of Sage :D. Feel free to use this document. 
However, somebody would have to check it just before publishing. The 
document is only a very short introduction, I was planning to add some 
other features (ie. plot_list() ) and  the 3D plotting capabilities of Sage.

You may want to have a look to the other worksheet I published online 
about limit calculations, just enter: http://sagenb.org/home/pub/398/

As I commented before, I am planning to do a series of basic 
documentation of that type related with Sage for scientific purposes.

Feel free to contact me any time.

Jose.

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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread kcrisman



 In looking at your code, I had an idea about specifying colors.  Why
 don't we have some default color objects defined in Sage, like red,
 blue, yellow, green, etc.  Methods could include .darker(), .lighter(),
 etc.  So you could specify a plot as:

 plot(x^2, (x,0,1), color=red)
 plot(x^3, (x,0,1), color=blue.darker())
 plot(x^4, (x,0,1), color=green.lighter())
 plot(x^5, (x,0,1), color=red+blue) #gives purple :)

 and then for the more esoteric names (all of the standard web colors,
 all of the standard x11 colors, etc.), use the color namespace.

 plot(sin(x), (x,0,1), color=color.goldenrod)

This sounds great; presumably it wouldn't be too hard to do, if very
annoying (particularly because some of the plot methods only allow
rgbcolor, others allow cmap options, etc.) - though what if I want red
to stand for some other Python/Sage object?  And of course only
English colors would be there, and what about gray/grey ...

By the way, other readers of this thread please note:

sage: plot(x^2, (x,0,1), color='red')

works fine!

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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread Jose Guzman

kcrisman wrote:

   
 In looking at your code, I had an idea about specifying colors.  Why
 don't we have some default color objects defined in Sage, like red,
 blue, yellow, green, etc.  Methods could include .darker(), .lighter(),
 etc.  So you could specify a plot as:

 plot(x^2, (x,0,1), color=red)
 plot(x^3, (x,0,1), color=blue.darker())
 plot(x^4, (x,0,1), color=green.lighter())
 plot(x^5, (x,0,1), color=red+blue) #gives purple :)

 and then for the more esoteric names (all of the standard web colors,
 all of the standard x11 colors, etc.), use the color namespace.

 plot(sin(x), (x,0,1), color=color.goldenrod)
 

 This sounds great; presumably it wouldn't be too hard to do, if very
 annoying (particularly because some of the plot methods only allow
 rgbcolor, others allow cmap options, etc.) - though what if I want red
 to stand for some other Python/Sage object?  And of course only
 English colors would be there, and what about gray/grey ...

 By the way, other readers of this thread please note:

 sage: plot(x^2, (x,0,1), color='red')

 works fine!

 - kcrisman
 
   
I particularly like the  rgbcolor notation. That's the only way I found 
to have vector graphic environment (i.e inkscape) to match with 
matplotlib or sage . On the other hand I usually use some kind of ...

plot (x**2, (0,1), rgbcolor=(0.5,0.5,0) ) # dark green

because I found the default green color (rgbcolor=(0,1,0)) looks too 
brilliant with some beamers when you give a talk. Anyway, I tried with 
rgbcolor='blue' ,'red','green','yellow','black','orange' and worked fine.

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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread Jason Grout

Jose Guzman wrote:
 kcrisman wrote:
   
 In looking at your code, I had an idea about specifying colors.  Why
 don't we have some default color objects defined in Sage, like red,
 blue, yellow, green, etc.  Methods could include .darker(), .lighter(),
 etc.  So you could specify a plot as:

 plot(x^2, (x,0,1), color=red)
 plot(x^3, (x,0,1), color=blue.darker())
 plot(x^4, (x,0,1), color=green.lighter())
 plot(x^5, (x,0,1), color=red+blue) #gives purple :)

 and then for the more esoteric names (all of the standard web colors,
 all of the standard x11 colors, etc.), use the color namespace.

 plot(sin(x), (x,0,1), color=color.goldenrod)
 
 This sounds great; presumably it wouldn't be too hard to do, if very
 annoying (particularly because some of the plot methods only allow
 rgbcolor, others allow cmap options, etc.) - though what if I want red
 to stand for some other Python/Sage object?  And of course only
 English colors would be there, and what about gray/grey ...

 By the way, other readers of this thread please note:

 sage: plot(x^2, (x,0,1), color='red')

 works fine!

 - kcrisman
   
 I particularly like the  rgbcolor notation. That's the only way I found 
 to have vector graphic environment (i.e inkscape) to match with 
 matplotlib or sage . On the other hand I usually use some kind of ...
 
 plot (x**2, (0,1), rgbcolor=(0.5,0.5,0) ) # dark green
 
 because I found the default green color (rgbcolor=(0,1,0)) looks too 
 brilliant with some beamers when you give a talk. Anyway, I tried with 
 rgbcolor='blue' ,'red','green','yellow','black','orange' and worked fine.


Yes, I'm saying that in addition to being able to pass a tuple or 
string, we'd be able to pass a sage color object.

Jason


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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread William Stein

On Tue, Mar 24, 2009 at 9:27 AM, Jason Grout
jason-s...@creativetrax.com wrote:

 Jose Guzman wrote:
 kcrisman wrote:

 In looking at your code, I had an idea about specifying colors.  Why
 don't we have some default color objects defined in Sage, like red,
 blue, yellow, green, etc.  Methods could include .darker(), .lighter(),
 etc.  So you could specify a plot as:

 plot(x^2, (x,0,1), color=red)
 plot(x^3, (x,0,1), color=blue.darker())
 plot(x^4, (x,0,1), color=green.lighter())
 plot(x^5, (x,0,1), color=red+blue) #gives purple :)

 and then for the more esoteric names (all of the standard web colors,
 all of the standard x11 colors, etc.), use the color namespace.

 plot(sin(x), (x,0,1), color=color.goldenrod)

 This sounds great; presumably it wouldn't be too hard to do, if very
 annoying (particularly because some of the plot methods only allow
 rgbcolor, others allow cmap options, etc.) - though what if I want red
 to stand for some other Python/Sage object?  And of course only
 English colors would be there, and what about gray/grey ...

 By the way, other readers of this thread please note:

 sage: plot(x^2, (x,0,1), color='red')

 works fine!

 - kcrisman

 I particularly like the  rgbcolor notation. That's the only way I found
 to have vector graphic environment (i.e inkscape) to match with
 matplotlib or sage . On the other hand I usually use some kind of ...

 plot (x**2, (0,1), rgbcolor=(0.5,0.5,0) ) # dark green

 because I found the default green color (rgbcolor=(0,1,0)) looks too
 brilliant with some beamers when you give a talk. Anyway, I tried with
 rgbcolor='blue' ,'red','green','yellow','black','orange' and worked fine.


 Yes, I'm saying that in addition to being able to pass a tuple or
 string, we'd be able to pass a sage color object.

That's a great idea, which is why I implemented it over a year ago :-)

sage: C = Color('red')# a Sage color object
sage: C
RGB color (1.0, 0.0, 0.0)
sage: C.html_color()
'#ff'
sage: plot(x^2, (x,0,1), color=C)

I think the only strings allowed in the Color constructor are:

red   : (1.0,0.0,0.0),
orange: (1.0,.5,0.0),
yellow: (1.0,1.0,0.0),
green : (0.0,1.0,0.0),
blue  : (0.0,0.0,1.0),
purple: (.5,0.0,1.0),
white : (1.0,1.0,1.0),
black : (0.0,0.0,0.0),
grey  : (.5,.5,.5)

You can also use any html color strings.

To give the functionality you want, you could add methods lighter()
and darker() to the existing color object.

William

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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread Jason Grout

William Stein wrote:
 On Tue, Mar 24, 2009 at 9:27 AM, Jason Grout
 jason-s...@creativetrax.com wrote:
 Jose Guzman wrote:
 kcrisman wrote:
 In looking at your code, I had an idea about specifying colors.  Why
 don't we have some default color objects defined in Sage, like red,
 blue, yellow, green, etc.  Methods could include .darker(), .lighter(),
 etc.  So you could specify a plot as:

 plot(x^2, (x,0,1), color=red)
 plot(x^3, (x,0,1), color=blue.darker())
 plot(x^4, (x,0,1), color=green.lighter())
 plot(x^5, (x,0,1), color=red+blue) #gives purple :)

 and then for the more esoteric names (all of the standard web colors,
 all of the standard x11 colors, etc.), use the color namespace.

 plot(sin(x), (x,0,1), color=color.goldenrod)

 This sounds great; presumably it wouldn't be too hard to do, if very
 annoying (particularly because some of the plot methods only allow
 rgbcolor, others allow cmap options, etc.) - though what if I want red
 to stand for some other Python/Sage object?  And of course only
 English colors would be there, and what about gray/grey ...

 By the way, other readers of this thread please note:

 sage: plot(x^2, (x,0,1), color='red')

 works fine!

 - kcrisman

 I particularly like the  rgbcolor notation. That's the only way I found
 to have vector graphic environment (i.e inkscape) to match with
 matplotlib or sage . On the other hand I usually use some kind of ...

 plot (x**2, (0,1), rgbcolor=(0.5,0.5,0) ) # dark green

 because I found the default green color (rgbcolor=(0,1,0)) looks too
 brilliant with some beamers when you give a talk. Anyway, I tried with
 rgbcolor='blue' ,'red','green','yellow','black','orange' and worked fine.

 Yes, I'm saying that in addition to being able to pass a tuple or
 string, we'd be able to pass a sage color object.
 
 That's a great idea, which is why I implemented it over a year ago :-)
 
 sage: C = Color('red')# a Sage color object
 sage: C
 RGB color (1.0, 0.0, 0.0)
 sage: C.html_color()
 '#ff'
 sage: plot(x^2, (x,0,1), color=C)
 
 I think the only strings allowed in the Color constructor are:
 
 red   : (1.0,0.0,0.0),
 orange: (1.0,.5,0.0),
 yellow: (1.0,1.0,0.0),
 green : (0.0,1.0,0.0),
 blue  : (0.0,0.0,1.0),
 purple: (.5,0.0,1.0),
 white : (1.0,1.0,1.0),
 black : (0.0,0.0,0.0),
 grey  : (.5,.5,.5)
 
 You can also use any html color strings.
 
 To give the functionality you want, you could add methods lighter()
 and darker() to the existing color object.


So how about:

* predefining a bunch of colors in the global namespace (maybe just what 
is available in the current strings?)
* predefining a huge number of colors, but sticking them in the colors 
namespace
* making some nicely matched color sets (color schemes, if you will).
* make a generic mixing function (which takes the weighted average of 
self and other, according to a specifiable fraction)
* make darker/lighter functions
* adding together colors averages them
* a linear combination takes a weighted average (hmmm...have to think 
about how to do this one...maybe it'd make more sense to do a different 
average?)

Here is what MMA does with colors: 
http://reference.wolfram.com/mathematica/guide/Colors.html


Sounds like a great get-your-feet-wet student project...

Jason


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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread William Stein

On Tue, Mar 24, 2009 at 11:03 AM, Jason Grout
jason-s...@creativetrax.com wrote:

 William Stein wrote:
 On Tue, Mar 24, 2009 at 9:27 AM, Jason Grout
 jason-s...@creativetrax.com wrote:
 Jose Guzman wrote:
 kcrisman wrote:
 In looking at your code, I had an idea about specifying colors.  Why
 don't we have some default color objects defined in Sage, like red,
 blue, yellow, green, etc.  Methods could include .darker(), .lighter(),
 etc.  So you could specify a plot as:

 plot(x^2, (x,0,1), color=red)
 plot(x^3, (x,0,1), color=blue.darker())
 plot(x^4, (x,0,1), color=green.lighter())
 plot(x^5, (x,0,1), color=red+blue) #gives purple :)

 and then for the more esoteric names (all of the standard web colors,
 all of the standard x11 colors, etc.), use the color namespace.

 plot(sin(x), (x,0,1), color=color.goldenrod)

 This sounds great; presumably it wouldn't be too hard to do, if very
 annoying (particularly because some of the plot methods only allow
 rgbcolor, others allow cmap options, etc.) - though what if I want red
 to stand for some other Python/Sage object?  And of course only
 English colors would be there, and what about gray/grey ...

 By the way, other readers of this thread please note:

 sage: plot(x^2, (x,0,1), color='red')

 works fine!

 - kcrisman

 I particularly like the  rgbcolor notation. That's the only way I found
 to have vector graphic environment (i.e inkscape) to match with
 matplotlib or sage . On the other hand I usually use some kind of ...

 plot (x**2, (0,1), rgbcolor=(0.5,0.5,0) ) # dark green

 because I found the default green color (rgbcolor=(0,1,0)) looks too
 brilliant with some beamers when you give a talk. Anyway, I tried with
 rgbcolor='blue' ,'red','green','yellow','black','orange' and worked fine.

 Yes, I'm saying that in addition to being able to pass a tuple or
 string, we'd be able to pass a sage color object.

 That's a great idea, which is why I implemented it over a year ago :-)

 sage: C = Color('red')    # a Sage color object
 sage: C
 RGB color (1.0, 0.0, 0.0)
 sage: C.html_color()
 '#ff'
 sage: plot(x^2, (x,0,1), color=C)

 I think the only strings allowed in the Color constructor are:

     red   : (1.0,0.0,0.0),
     orange: (1.0,.5,0.0),
     yellow: (1.0,1.0,0.0),
     green : (0.0,1.0,0.0),
     blue  : (0.0,0.0,1.0),
     purple: (.5,0.0,1.0),
     white : (1.0,1.0,1.0),
     black : (0.0,0.0,0.0),
     grey  : (.5,.5,.5)

 You can also use any html color strings.

 To give the functionality you want, you could add methods lighter()
 and darker() to the existing color object.


 So how about:

 * predefining a bunch of colors in the global namespace (maybe just what
 is available in the current strings?)

I would say -1, except Mathematica does that, and I'm for general
mathematica-style api compatibility.  So I'm +1 on that.

 * predefining a huge number of colors, but sticking them in the colors
 namespace

I don't care...

 * making some nicely matched color sets (color schemes, if you will).
 * make a generic mixing function (which takes the weighted average of
 self and other, according to a specifiable fraction)

That sounds useful.

 * make darker/lighter functions

That couldn't hurt.

 * adding together colors averages them

That makes sense.

 * a linear combination takes a weighted average (hmmm...have to think
 about how to do this one...maybe it'd make more sense to do a different
 average?)

Well if you do A + B + C, then Python will do A+B then (A+B)+C, so
the previous point determines this one.

 Here is what MMA does with colors:
 http://reference.wolfram.com/mathematica/guide/Colors.html


 Sounds like a great get-your-feet-wet student project...

 Jason


 




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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread Robert Bradshaw

On Mar 24, 2009, at 11:03 AM, Jason Grout wrote:

 William Stein wrote:
 On Tue, Mar 24, 2009 at 9:27 AM, Jason Grout
 jason-s...@creativetrax.com wrote:
 Jose Guzman wrote:
 kcrisman wrote:
 In looking at your code, I had an idea about specifying  
 colors.  Why
 don't we have some default color objects defined in Sage, like  
 red,
 blue, yellow, green, etc.  Methods could include .darker 
 (), .lighter(),
 etc.  So you could specify a plot as:

 plot(x^2, (x,0,1), color=red)
 plot(x^3, (x,0,1), color=blue.darker())
 plot(x^4, (x,0,1), color=green.lighter())
 plot(x^5, (x,0,1), color=red+blue) #gives purple :)

 and then for the more esoteric names (all of the standard web  
 colors,
 all of the standard x11 colors, etc.), use the color namespace.

 plot(sin(x), (x,0,1), color=color.goldenrod)

 This sounds great; presumably it wouldn't be too hard to do, if  
 very
 annoying (particularly because some of the plot methods only allow
 rgbcolor, others allow cmap options, etc.) - though what if I  
 want red
 to stand for some other Python/Sage object?  And of course only
 English colors would be there, and what about gray/grey ...

 By the way, other readers of this thread please note:

 sage: plot(x^2, (x,0,1), color='red')

 works fine!

 - kcrisman

 I particularly like the  rgbcolor notation. That's the only way  
 I found
 to have vector graphic environment (i.e inkscape) to match with
 matplotlib or sage . On the other hand I usually use some kind  
 of ...

 plot (x**2, (0,1), rgbcolor=(0.5,0.5,0) ) # dark green

 because I found the default green color (rgbcolor=(0,1,0)) looks  
 too
 brilliant with some beamers when you give a talk. Anyway, I  
 tried with
 rgbcolor='blue' ,'red','green','yellow','black','orange' and  
 worked fine.

 Yes, I'm saying that in addition to being able to pass a tuple or
 string, we'd be able to pass a sage color object.

 That's a great idea, which is why I implemented it over a year  
 ago :-)

 sage: C = Color('red')# a Sage color object
 sage: C
 RGB color (1.0, 0.0, 0.0)
 sage: C.html_color()
 '#ff'
 sage: plot(x^2, (x,0,1), color=C)

 I think the only strings allowed in the Color constructor are:

 red   : (1.0,0.0,0.0),
 orange: (1.0,.5,0.0),
 yellow: (1.0,1.0,0.0),
 green : (0.0,1.0,0.0),
 blue  : (0.0,0.0,1.0),
 purple: (.5,0.0,1.0),
 white : (1.0,1.0,1.0),
 black : (0.0,0.0,0.0),
 grey  : (.5,.5,.5)

 You can also use any html color strings.

 To give the functionality you want, you could add methods lighter()
 and darker() to the existing color object.


 So how about:

 * predefining a bunch of colors in the global namespace (maybe just  
 what
 is available in the current strings?)

I like all your comments but this one--the global namespace is huge  
enough as it is. Also, colors.* gives nice tab completion, etc. I  
could be OK with the limited set defined above.

 * predefining a huge number of colors, but sticking them in the colors
 namespace
 * making some nicely matched color sets (color schemes, if you will).
 * make a generic mixing function (which takes the weighted average of
 self and other, according to a specifiable fraction)
 * make darker/lighter functions
 * adding together colors averages them
 * a linear combination takes a weighted average (hmmm...have to think
 about how to do this one...maybe it'd make more sense to do a  
 different
 average?)

 Here is what MMA does with colors:
 http://reference.wolfram.com/mathematica/guide/Colors.html

+1. As well as rgb, we should offer hsb, hsv ways of constructing  
colors.

- Robert



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



[sage-support] Re: Problem plotting a function with plot()

2009-03-24 Thread Jason Grout

Robert Bradshaw wrote:


 * predefining a bunch of colors in the global namespace (maybe just  
 what
 is available in the current strings?)
 
 I like all your comments but this one--the global namespace is huge  
 enough as it is. Also, colors.* gives nice tab completion, etc. I  
 could be OK with the limited set defined above.
 
 * predefining a huge number of colors, but sticking them in the colors
 namespace
 * making some nicely matched color sets (color schemes, if you will).
 * make a generic mixing function (which takes the weighted average of
 self and other, according to a specifiable fraction)
 * make darker/lighter functions
 * adding together colors averages them
 * a linear combination takes a weighted average (hmmm...have to think
 about how to do this one...maybe it'd make more sense to do a  
 different
 average?)

 Here is what MMA does with colors:
 http://reference.wolfram.com/mathematica/guide/Colors.html
 
 +1. As well as rgb, we should offer hsb, hsv ways of constructing  
 colors.


Okay, see:

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

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

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

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

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

If anyone wants to do these, feel free!

Jason


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