MathGroup Archive 2011

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

Search the Archive

Re: strange error

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122271] Re: strange error
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 23 Oct 2011 06:22:41 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

On 10/22/11 at 6:09 AM, klemen_dovrtel at yahoo.com (Klemen Dovrtel)
wrote:

>I defined a simple function that is composed of three functions,
>each for different range of argument/variable. The function was
>composed using If[] conditions. The problem is that i can't FindRoot
>of this composed function. I get an error "the function value is not
>a list of numbers with dimensions {1}", which is not true. Any idea
>how can i solve this?

Change your function to specify it takes numeric arguments. That
is instead of

test[m_] := Module[{ret},
   If[m < 100, ret = 2 m];
   If[100 <= m <= 200, ret = 200 + 1 (m - 100)];
   If[200 < m, ret = 300 + .5 (m - 200)];
   N[ret]]

Use

test[m_?NumericQ] := Module[{ret},
   If[m < 100, ret = 2 m];
   If[100 <= m <= 200, ret = 200 + 1 (m - 100)];
   If[200 < m, ret = 300 + .5 (m - 200)];
   N[ret]]




  • Prev by Date: a bug in Integrate (2nd message)
  • Next by Date: Integral points on elliptic curves
  • Previous by thread: Re: strange error
  • Next by thread: Re: strange error