       Re: FindFit with conditionals

• To: mathgroup at smc.vnet.net
• Subject: [mg57336] Re: [mg57307] FindFit with conditionals
• From: Andrzej Kozlowski <andrzej at akikoz.net>
• Date: Wed, 25 May 2005 06:02:40 -0400 (EDT)
• References: <200505240912.FAA19168@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```First , FindInstance does not hold its arguments (look at Attributes
[FindInstance]) so of course it tries to evaluate NIntegrate[...] and
you get he message complaining that the integrand is not numerical.
Secondly, FindInstance uses similar methods to Reduce, which means it
is esentially an "algebraic" function which uses exact methods. You
can use it with non-exact inputs but I believe it will still use
exact methods to find the answer, and it will not, I think,
internaly perform any non-exact computations of the kind that you are
trying to use. (Of course it will evaluate "non-exact" functions
suplied as argumetns and it may use some "exact numerical methods"
but still the main point is, I think, valid, and that it that like
Reduce, it attempts to give exact answers and is not suitable for
solving numerical (approximate) questions.

Andrzej Kozlowski

On 24 May 2005, at 18:12, Edward Peschko wrote:

> hey all,
>
> I'd like to do a FindInstance on a function with conditionals,
> something like
>
> FindInstance
> [
>     NIntegrate[m * (e^(-lambda) * lambda^x) / x! + n, {x,1,2}] == 1 &&
>         m * (e^-1 * 1^1)/1! + n == 0 &&
>         m * (e^-2 * 2^2)/2! + n == 0,
>     { lambda, m, n}
> ]
>
> What I was *hoping* that mathematica would do would be to substitute
> lambda, m, and n inside the expression passed to NIntegrate, which
> would then
> calculate the integral based on individual values, and then find an
> instance
> which fits all three criteria. However, it doesn't seem to do this,
> it complains that 'Integrand ... is not numerical'.
>
> A side note - can you do interval arithmetic in FindInstance? ie:
> could you say:
>
> FindInstance
> [
>     NIntegrate[m * (e^(-lambda) * lambda^x) / x! + n, {x,1,2}] ==
>                              Interval[.999,1.001] &&
>         m * (e^-1 * 1^1)/1! + n == Interval[-.001, .001] &&
>         m * (e^-2 * 2^2)/2! + n == Interval[-.001, .001] &&
>     { lambda, m, n}
> ]
>
> to get around machine precision issues?
>
> Anyways, this would be much more helpul behavior (evaluating
> lambda, m, and n
> in subexpressions) than what it does now. Any ideas on how to
> implement this?
>
> Ed
>
> (
> ps - any ideas on how to solve something like this in other ways,
> aside
> from FindInstance?
> )
>
>

```

• Prev by Date: Re: Please explain this error message. I typed the code right out of the text.
• Next by Date: Re: Re: plot hyperbola (OT)
• Previous by thread: Re: FindFit with conditionals
• Next by thread: Re: FindFit with conditionals