Re: Plots with Variable Limits?
- To: mathgroup at smc.vnet.net
- Subject: [mg24114] Re: [mg24100] Plots with Variable Limits?
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Wed, 28 Jun 2000 02:11:38 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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/