Re: Controlling the order of evaluations
- To: mathgroup at smc.vnet.net
- Subject: [mg93018] Re: Controlling the order of evaluations
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 24 Oct 2008 02:27:57 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <gdms84$en$1@smc.vnet.net>
anguzman at ing.uchile.cl wrote:
*snip*
> So, what I always end up trying is something like:
>
>
> Plot[f[x,#]&/@{y1,y2,....,yn},{x,a,b}]
>
>
> Mathematica (5.2 Version for Windows) complains but finally interprets
> correctly what I meant and does the plot correctly (sometimes)with all
> the curves , but this errors are annoying. They are always of the form:
>
> \" bla bla.. f[x,y1] is not numerical at ....\"
*snip*
Clear[f]
f[x_?NumericQ, y_?NumericQ] := NIntegrate[2^(s*x), {s, 0, y}]
Plot[Evaluate[f[x, #] & /@ {2, 3, 4, 5}], {x, 0.5, 1.5}]
See the FAQ "How do I write a function which evaluates only when the
argument is a number?" at
http://support.wolfram.com/mathematica/kernel/features/evalwhennumber.html
Regards,
-- Jean-Marc