Ploting graphs

hi i need to plot xlogx^k for x small and positive and k=1,2,3... could anyone help me pls

Scott03's picture

RE: ploting graphs

You can either plot all the plots at the same time by entering the following code:

seq(assign(P || k, plot(x*log[10](x^k), x = -5 .. 5)), k = 1 .. 3);
plots:-display([seq(P || k, k = 1 .. 3)]);

 

You can then use the code above to have an animation by just adding insequence=true to the display command.  So the command would be as follows:

plots:-display([seq(P || k, k = 1 .. 3)], insequence = true);

A better animation would be to use the animate command from the plots package as follows:

plots:-animate(plot, [x*log[10](x^k), x = -5 .. 5], k = 1 .. 3);

This has the advantage of liksting the k values at the top of the animation.

 

Scott

Doug Meade's picture

plotting sequences and creating animations

I agree with Scott's general suggestions, but see no reason to introduce the individual plots at all. Here is the way I would create a single plot:

plot( [ x*log(x^k) $ k=1..3 ], x=0..5 );

One advantage of this is each curve is a different color.

Here is how I would create the animation:

plots:-animate( plot, [x*log(x^k), x=0..5], k=1..3, frames=3 );

Note the use of frames=3 to get only integer values of k in the animation.

If you do want the log base 10, replace log with log[10]. And, lastly, note that in Scott's plots there is nothing plotted for x<0 for even k. This is as expected. The original post indicated that x is small and positive.

I hope this is useful.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}