I wrote:
> Find secret base
John responded:
> I like this as an application of your point.
Thanks, though I admit I only picked so I could say my proposal can be used to
"find secret bases".
> Under these circumstances the equation will
> have a unique root.
I've probably misunderstand this statement, but doesn't the following
demonstrate that the root isn't unique?
pInv =. ((-~ {.) p.@, [EMAIL PROTECTED])~
NB. polynomial inverse
normalest =. \: (0 = {:@+.) ,. (=<.) ,. (0 <: [EMAIL PROTECTED])
,. -@| NB. "intuitive" selection of root
pI =: [EMAIL PROTECTED]@>@{:@pInv f.
NB. p.^:_1
x =. 47822
NB. same inputs as before
y =. 11 10 12 14
x pInv~ |. y
+--+-------------------------------------+
|11|_8.45455j14.1477 _8.45455j_14.1477 16|
+--+-------------------------------------+
'b0 b1 b2'=.> {: x pInv~ |. y
x = b0 #. y
1
x = b1 #. y
1
x = b2 #. y
1
Now, if you're saying that 16 is the only non-negative integer root, then I
agree (obviously; that's why this is an interesting
application for my arbitrary root-selector).
> If you take x=:2, y=:50 _14 1, there are
> two possible values of b, at 6 and 8.
Yep! And my definition of normalest will choose 6, as it is closer to zero:
x =. 2
y =. 1 _14 50 NB. Remember coeffs are reversed for #.
b =. x pI~ |. y
x = b #. y
1
b
6
Since both are equally valid, there is no disadvantage in this choice.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm