Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

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


  • Prev by Date: Re: How does Mathematica know whether a number is real or complex?
  • Next by Date: Re: Expressions with ellipsis (...)
  • Previous by thread: Controlling the order of evaluations
  • Next by thread: Re: Controlling the order of evaluations