On Mon, Sep 29, 2008 at 7:36 PM, Henry Rich <[EMAIL PROTECTED]> wrote:
> If you pick one possible result, that's pretty arbitrary > and not interesting to me. > > If you pick all the possible results, then the inverse > of p.^:_1 is not p. . ... unless ... > > Your pInv seems good enough to me. > > Henry Rich > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Dan Bron > > Sent: Monday, September 29, 2008 5:18 PM > > To: Programming forum > > Subject: [Jprogramming] p.^:_1 > > > > The primitive p. is defined > > > > (x p. y) = +/x*y^i.#x > > > > for all open x . > > > > > > Its inverse, according to the interpreter, is undefined: > > > > 6 5 4 p. 2 > > 32 > > > > 6 5 4 p.^:_1: 32 > > |domain error > > | 6 5 4 p.^:_1:32 > > > > > > What are the major reasons for this? That is, given: > > > > z =: x p. y > > > > why can't we have : > > > > y = x p.^:_1 z > > > > ? > > > > I'm no mathematician, but it seems to me that producing y > > from x and z is just a matter of solving a polynomial, > > and we already have a polynomial solver. > > > > In broad strokes, we could do something like this: > > > > > > x =: 6 5 4 > > y =: 2 > > > > ] z =: x p. y > > 32 > > > > p. (({.x)-z),}.x > > +-+-------+ > > |4|_3.25 2| > > +-+-------+ > > > > pInv =: ((-~ {.) p.@, [EMAIL PROTECTED])~ > > x pInv z > > +-+-------+ > > |4|_3.25 2| > > +-+-------+ > > > > y e. > {: x pInv z > > 1 > > > > > > Now, if p.'s inverse has been left undefined because it's > > multivalued, then we have a few options: > > > > (A) Give all the values, as pInv does. But this loses > > the value of things like (-: ]&.(x&p.)) . > > > > (B) Select one input. This has the drawback of biasing > > results, but > > (i) That's not so bad. For example, %: is > > multivalued but only one value is selected. > > (ii) Users could always substitute the user-written > > pInv for p.^:_1 if they always wanted a result. > > > > To (B) , if we had to select a single output, I'd say pick > > the "normalest" one. Prefer real to complex, > > positive to negative, whole to fractional, etc. > > > > Of course, there are still problems with pInv : > > > > 12 pInv 32 > > |domain error: pInv > > | 12 pInv 32 > > > > and probably more that I haven't noticed, which may be the > > reason it wasn't implemented in the first place. > > > > -Dan > > > > > > ---------------------------------------------------------------------- > > For information about J forums see > > http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Use Reply-To: & thread your email after the first: or it may take a while, as I get 2000+ emails per day. -- Roy A. Crabtree UNC '76 gaa.lifer# (For TN contact, email me to set up a confirmed date/time) voicemail inbound only [When you hear/read/see/feel what a y*ehudi plays/writes/sculpts/holds] [(n)either violinist {Menuhin} (n)or writer {"The Y*ehudi Principle"} (n)or molder (n)or older] [you must strive/think/look/sense all of it, or you will miss the meanings of it all] [EMAIL PROTECTED] Forwards only to: [EMAIL PROTECTED] [EMAIL PROTECTED] CC: auto to ^ http://musings-roy-crabtree.blogspot.com [& others] http://www.authorsden.com/royacrabtree http://skyscraper.fortunecity.com/activex/720/resume/full.doc -- (c) RAC/IP, ARE,PRO,PAST (Copyright) Roy Andrew Crabtree/In Perpetuity All Rights/Reserved Explicitly Public Reuse Only Profits Always Safe Traded ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
