On Mon, 25 Mar 2024 at 20:09, Charles R Harris <charlesr.har...@gmail.com>
wrote:

>
>
> On Mon, Mar 25, 2024 at 11:28 AM Luca Bertolotti <
> luca72.bertolo...@gmail.com> wrote:
>
>> Hello
>> in a vb program they use 3rd degree approx and get this value including
>> displacement:(SC)
>> [image: image.png]
>>
>> Ii think that i'm doing the same with numpy but I get different value
>> does anyone can help me please
>>
>> radious = [1821, 1284, 957, 603,450, 245]
>> y = [6722, 6940, 7227, 7864,8472, 10458]
>> p = np.polyfit(radious, y, 3,)
>> t = np.polyval(p, radious)
>> [ 6703.33694696  7061.23784145  7051.49974149  7838.84623289
>>   8654.47847319 10373.60076402]
>> You can see polyval is difference from the sc. of the table
>> Any help is really appreciated
>>
>
> What is sc?
>


At the beginning I thought it was the difference between the fitted y and
the measured y, but of course that is not the case.

For what is worth, doing it in Excel using LINEST:

*=LINEST(A2:A7, B2:B7^{1,2,3})*

And then back-calculating the results of the fit I get this for the
"fitted" y:

6703.34, 7061.24, 7051.50, 7838.85, 8654.48, 10373.60

Which are indeed the same numbers obtained by numpy polyfit. Also get the
same if you use the automatic line fitting in an Excel graph.

Not that I trust Excel with anything, it was just for fun.

Not entirely clear what the OP is doing with VB, but either we are missing
a crucial piece of information or the VB code is incorrect.

Andrea.
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to