Re: POLY_FIT gives wrong answer ! [message #20052 is a reply to message #19941] |
Thu, 11 May 2000 00:00   |
Henk Schets
Messages: 4 Registered: May 2000
|
Junior Member |
|
|
David Fanning wrote:
> Henk Schets (Henk.Schets@oma.be) writes:
>
>> David Fanning wrote:
>>
>>> Henk Schets (Henk.Schets@oma.be) writes:
>>>
>>>> Maybe all of you already know this, but I didn't and I could not find
>>>> any documentation about it.
>>>> The problem : I have two long arrays (x- and y-values) and I made
>>>> subarrays out of them by using an array as subscript, like
>>>> x = fltarray(l)
>>>> y = fltarray(l)
>>>> indexarr = longarray(l)
>>>> (you know, the way to sort different arrays together)
>>>> However, when I do something like out =
>>>> poly_fit(x[indexarr],y[indexarr]), the outcome is simply wrong ! I know
>>>> this because other programs gave another solution (all the same).
>>>> The only way to do it right is by making other arrays like x2 and y2 and
>>>> doing a poly_fit on it.
>>>>
>>>> Is this a known issue ?
>>>
>>> I don't know. What is known is that things are not always
>>> the way they seem to be. I'm guessing this is one of those
>>> times. :-)
>>>
>>> Cheers,
>>>
>>> David
>>>
>>> --
>>> David Fanning, Ph.D.
>>
>> Could you be a littlebit more cryptic, please ?
>
> I'm just saying that about 5 times out of 10 when users
> describe problems to you, they are offering red herrings.
> I think this is one of those times. There is no explanation
> that I can think of why a subscripted array is not identical
> to a variable made from that subscripted array. Subscripted
> arrays are, of course, passed into the program by value, while
> variables are passed in by reference. But since the input
> variables don't change when they are passed into POLY_FIT,
> I think we can rule this out as a suspect.
>
> And from what I learned from my Sherlock Holmes, if you
> eliminate everyone who can't possibly have committed the
> crime, who you are left with--no matter how improbable--
> is the murderer. My list of suspects is pretty much narrowed
> down to programmer error in the absence of a working
> (or mis-working, in this case) example. :-)
>
> Cheers,
>
> David
OK, so if you think I am wrong, why is it that when I just plot the data with the
array as a subscript, the outcome is the same as if I made a totally new array ?
Isn't this an indication of some bug in poly_fit ?
Henk
|
|
|