Looks neat.  I think it has to be square,  and it doesn't need to be non-singular:
eg,

Here, y = x is a straight line,  and 5 data points overspecify it! ...

(,:(X np X)&p.) steps _1.5 1.5 5

_1.5 _0.9 _0.3 0.3 0.9 1.5

_1.5 _0.9 _0.3 0.3 0.9 1.5


Oddly enough,  I tried it out first on my iPad,  running J701.  On that

tablet I got :


   ~. X np Y  in J701/iPad !!!  ~. to save lines
_14.1014

I thought that was it for discrepancies.  I haven't kept J7.01 on the laptop,

but I do still have J8.07. I've just checked and find the same result there!


JVERSION

Engine: j807/j64/windows

Release-e: commercial/2019-11-04T09:51:03

Library: 8.07.26

Qt IDE: 1.7.9/5.9.6

Platform: Win 64

Installer: J807 install

InstallPath: c:/d/j807

Contact: www.jsoftware.com


   ~. X np Y    NB. in J807...
_14.1014

Old J - odd/old results.  I expect others will see why,


Cheers,


Mike



On 17/10/2020 23:10, Raul Miller wrote:
For what it's worth, here's an example of a "quite straightforward"
translation of the original 'np' to tacit form (assuming that the
newton matrix is always square -- I didn't spend enough time studying
here to feel comfortable leaving that assumption unstated, though I
did force a length error should that not be a valid assumption):

NB. divided differences
dd=: (2 -~/\ ]) % [ ({: - {.)\~ 2 + -&#

NB. Coefficients are the topmost entries
np=: [: {."1 dd ^:(i.@#@+)

X=: _3r2 _3r4 0 3r4 3r2
Y=: 3 o. X
load'plot stats'
plot(;(X np Y)&p.) steps _1.5 1.5 30

I hope this helps,




--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to