MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Plots with Variable Limits?


on 6/27/00 1:51 PM, A. E. Siegman at siegman at stanford.edu wrote:

> I want to make a test plot of a function  f[x,a]  versus  x  for some
> trial value of the parameter  a  without fixing that parameter for
> subsequent cells, e.g. something like
> 
> Plot[ f[r,a], {x,-2a,2a} ]  /.  a->10
> 
> If I try this, Mathematica gives me a  "Plot::plln"  error -- but then
> goes ahead and makes the correct plot anyway.
> 
> I can of course turn off the error -- but what's a better, but still
> clean and simple, way to accomplish this.
> 
> Thanks   siegman at stanford.edu
> 

The problem is that ReplaceAll (which is the same thing as /. ) evaluates
its arguments. That means that Mathematica tries to make a plot before a
gets the value 10, fails and issues the error message. It then returns Plot[
f[r,a], {x,-2a,2a} ] to ReplaceAll[ ,a->10], which then evaluetes correctly.
The simplest wait to avoid the problem is to use:

Unevaluated[Plot[ x^a, {x, -2a, 2a} ] ] /.  a -> 10

Andrzej
-- 
Andrzej Kozlowski
Toyama International University
JAPAN

http://platon.c.u-tokyo.ac.jp/andrzej/
http://sigma.tuins.ac.jp/



  • Prev by Date: RE: Plots with Variable Limits?
  • Next by Date: Re: Plots with Variable Limits?
  • Previous by thread: RE: Plots with Variable Limits?
  • Next by thread: Re: Plots with Variable Limits?