MathGroup Archive 2001

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

Search the Archive

Re: FindRoot question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29906] Re: FindRoot question
  • From: klaus at biosci.cbs.umn.edu (Chris Klausmeier)
  • Date: Wed, 18 Jul 2001 02:08:48 -0400 (EDT)
  • References: <9j05h0$esi$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Just a follow-up on my own question.  Part of the problem was that I
was calling another homemade function that used FindRoot from within
FindRoot.  Problems arose when the inner FindRoot got non-numeric
values for its options.  From other messages I found that using
_?NumberQ for the inside function should help, but I was passing my
options as a list, which would not make it by  _?NumberQ.  _?ListQ
didn't help either, because {x,y} counts as a list as well as {1,2}. 
I ended up writing the following test for a list of numbers, which
helped.

ListOfNumbersQ[list_]:=Module[{n,ret},
If[ListQ[list]==False,ret=False,
n=Length[list];
ret=True;
Do[
If[NumberQ[list[[i]]]==False,ret=False]
,{i,1,n}];];
Return[ret]; ];

Thus:

In[21]:=
ListOfNumbersQ[{1,2}]

Out[21]=
True

In[23]:=
ListOfNumbersQ[{x,y}]

Out[23]=
False

My inside function then begins:

neq[xopts_?ListOfNumbersQ,ni_]:=Module[ ...

-- Chris


  • Prev by Date: Re: A question on machine numbers
  • Next by Date: Proof For Cov. Matrix equation?
  • Previous by thread: Re: FindRoot question
  • Next by thread: Re: Re: FindRoot question