Re: Functions inside list
- To: mathgroup at smc.vnet.net
- Subject: [mg70407] Re: Functions inside list
- From: "Philpp" <piotr at bigpond.net.au>
- Date: Sun, 15 Oct 2006 00:20:22 -0400 (EDT)
- References: <egq2rf$83m$1@smc.vnet.net>
Akil,
Your problem is that instead of providing the function maxWidth you are
providing its value at beta in
{{xLow, xHigh}, maxWidth[beta]}
If NumericQ[beta] evaluates to False, maxWidth[beta] doesn't evaluate
at all and the call
In[]:= maxWidth[beta]
returns
Out[]= maxWidth[beta]
(N.B. I have no clue, why it would evaluate to Infinity)
So, if you want to store function as an element of a list, for whatever
purpose, you need to provide the function symbol, i.e.,
{{xLow, xHigh}, maxWidth}
Cheers,
Phil.
P.S. I really do not understand as to why you define maxWidth function;
it seems that for your purposes both functions return "incorrect
results."
P.
akil wrote:
> I have a function berekenMaxWidth[beta_] which only gives the correct output
> when beta is numeric so I use
> maxWidth[beta_?NumericQ]:=berekenMaxWidth[beta]. Otherwise I get incorrect
> results, for instance when trying to plot berekenMaxWidth[beta].
>
> This function represents a curve that will be of importance between two
> x-values.
>
> My problem arises when I try to give the function to a list of the shape
> {{xLow,xHigh},relevant curve function}.
>
> If I do: {{xLow,xHigh},maxWidth[beta]} , I get {{xLow,xHigh},Infinity} in my
> list instead of the function. This is incorrect. I need the list for
> instance to find intersections between curves in the x-domain. So for the
> input in the list I need the correct function to be returned instead of
> Infinity.
>
> So how can I give along the function to the list so that it works correctly?