MathGroup Archive 2010

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

Search the Archive

Re: A general problem with numerical functions defined

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108706] Re: A general problem with numerical functions defined
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Sun, 28 Mar 2010 04:08:20 -0500 (EST)

This kind of issue has been addressed before.  See, e.g., mg39711.

The method:  change the definition so that it reads:

   f[x_?NumericQ]:= ....

On 3/27/2010 6:10 AM, ValeX wrote:
> let's say that i have a numerical function f[x] which is defined in a
> quite messy way.
> For example, it could be defined as a Module that contains If, Whiles,
> interpolation functions, Import, ..
> This function works well without any error if I simply evaluate it,
> for example if i write f[5] and hit the enter key.
>
> The (my) problem is that often when i plug such a function in other
> routines, like FindMinimum, i get all sorts of errors and it doesn't
> work.
> Is there a way to tell Mathematica to just compute f[x] and then use
> that result for other things?
>

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: Can one have different Coloring to show which local symbols are not used in a module?
  • Next by Date: Combinations Dispositions Permutations TREE
  • Previous by thread: Re: Running Mathematica code using DOS
  • Next by thread: Combinations Dispositions Permutations TREE