Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'problem when Plotting a List of functions...' topicStudent Support Forum > General > Archives > "problem when Plotting a List of functions..."

Next Comment >Help | Reply To Topic
Author Comment/Response
Walter MERLAT
07/20/99 7:49pm

Hi!

I am desperately trying to plot several functions --listed in a variable of type List-- with the Plot command. as a Mathematica beginner, i thought it would be straigtforward, ... but I am facing a strange problem related to lists of functions and the way Plot handles them.

let's define a list of two functions:
l := {Cos[x], Sin[x]}

now let's try to plot the two functions on the same graphics:
Plot[l, {x, 0, 10}]
...well it doesn't work!
Mathematica displays a series of messages:''
Plot::''plnr'': l is not a machine-size real number at x = 4.16666666666666607`*^-7.''
and then an empty graphics


Can someone explain why this doesn't work??

note that the following commands work:
Plot[{Cos[x], Sin[x]}, {x, 0, 10}]
Plot[{First[l], Last[l]}, {x, 0, 10}]

... even though {Cos[x], Sin[x]} == {First[l], Last[l]} == l !!!!!

as in general, my list of functions is of a priori unknown size, i can't use the trick with First and Last. any idea on how to plot my list of functions?

Thanks a lot for your time
Walter


URL: ,

Subject (listing for 'problem when Plotting a List of functions...')
Author Date Posted
problem when Plotting a List of functions... Walter MERLAT 07/20/99 7:49pm
Re: problem when Plotting a List of functions... Forum Modera... 07/26/99 00:00am
Re: problem when Plotting a List of functions... Bruno 07/27/99 11:53am
Re: problem when Plotting a List of functions... Walter MERLAT 07/27/99 12:49pm
Next Comment >Help | Reply To Topic