Well I should be more correct in what I am saying each function is the
derivative of the one function. I tried your program but I get this
error.

Code:
x = var('x')
f = (sin(x))**3+(sin(x))**2+sin(x)+1
colors = rainbow(len([0,1,..3]))
sum(plot(derivative((f, a) , (x,0,2*pi), color = colors[i],label="Plot
%d"%i) for i,a in enumerate([0,1,..3]))

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_11.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding:
utf-8 -*-\\n" +
_support_.preparse_worksheet_cell(base64.b64decode("eCA9IHZhcigneCcpCmYgPSAoc2luKHgpKSoqMysoc2luKHgpKSoqMitzaW4oeCkrMQpjb2xvcnMgPSByYWluYm93KGxlbihbMCwxLC4uM10pKQpzdW0ocGxvdChkZXJpdmF0aXZlKChmLCBhKSAsICh4LDAsMipwaSksIGNvbG9yID0gY29sb3JzW2ldLGxhYmVsPSJQbG90ICVkIiVpKSBmb3IgaSxhIGluIGVudW1lcmF0ZShbMCwxLC4uM10pKQ=="),globals())
+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>

  File "/tmp/tmpchwgnX/___code___.py", line 7

 
^
SyntaxError: invalid syntax

Since it is a syntax error I think it is something simple that I am
over looking.

On Oct 27, 5:09 pm, Jason Grout <[email protected]> wrote:
> On 10/27/11 6:51 PM, Eric Kangas wrote:
>
> > Hi,
>
> > I am working on a standard plot function for multiple plots. I would
> > like to have each plot in a different color to distinguish each
> > function, and also able to show a legend with the color, and function.
>
> > Here is what I have right now:
>
> > plot([derivative((f(x), a) for a in [0,1,..3]], (x,0,2*pi), color = ())
>
> Try something like:
>
> colors=rainbow(len([0,1,..3]))
> sum(plot(derivative((f(x), a) , (x,0,2*pi), color =
> colors[i],label="Plot %d"%i) for i,a in enumerate([0,1,..3]))
>
> Make each curve an individual plot, and then sum them together.
>
> Jason

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

Reply via email to