Finally got it. Thanks. Neutral is a great new concept to me.
On May 15, 2013, at 5:09 PM, Henry Rich <[email protected]> wrote:
> Look at the definition of u/ . u/ applied to empty returns an identity
> element (aka neutral). For *, the identity is 1 :
>
> * b. 1
> 1 $~ }.@$
>
>
> ] wouldn't do - it returns a list, and the wrong list at that.
>
> Determinant of a non-square matrix is not something I understand. -/ . *
> will operate according to the spec, and when it runs out of rows it will
> create a zero minor, I think. If you have more rows than columns it might
> get a nonzero result.
>
> Henry Rich
>
> On 5/15/2013 4:57 PM, Elton Wang wrote:
>> Thanks Henry and Raul,
>> I just confused on the last step of the recursion, for
>>
>> u =. -/
>> v =. *
>> f =. v/@,`({."1 u . v $:@minors)@.(0<{:@$)
>>
>> question 1: in the (0={:@$) case, how's v/ work on an empty array? can I
>> replace it to ]?
>>
>> question2: for y =. i. 3 1,
>> minor y is empty how is f y = ({."1 u . v f@minors) y == -/y?
>>
>> On May 15, 2013, at 4:17 PM, Henry Rich <[email protected]> wrote:
>>
>>> See what minors does:
>>>
>>> minors=: }."1 @ (1&([\.))
>>> minors i. 4 4
>>> 5 6 7
>>> 9 10 11
>>> 13 14 15
>>>
>>> 1 2 3
>>> 9 10 11
>>> 13 14 15
>>>
>>> 1 2 3
>>> 5 6 7
>>> 13 14 15
>>>
>>> 1 2 3
>>> 5 6 7
>>> 9 10 11
>>>
>>> Remove the first column, and each row, producing a brick of minors.
>>>
>>> v/@,`({."1 u . v $:@minors)@.(0<{:@$) @ ,. "2
>>>
>>> ,. applied at rank 2 has no effect on tables, and exists only to force an
>>> atom or a list to be a table; so we can ignore the ,.
>>>
>>> p`q@.(0<{:@$)
>>>
>>> means 'do p if y is empty, otherwise q'. This q is going to reduce the
>>> size of the array each time, and at the end, when there is no array left,
>>> v/ will return the neutral for v .
>>>
>>> ({."1 u . v $:@minors)
>>>
>>> This says recur on the minors ($:@minors) and then multiply the result on
>>> the minors by the first column, the one we discarded in minors. And the
>>> 'multiply' isn't just *, it's the DYAD of u . v, which for -/ . * means
>>> multiply scalar * row, and then alternately add and subtract, as you can
>>> see from considering -/\ i. 6 .
>>>
>>> Henry Rich
>>>
>>> On 5/15/2013 3:42 PM, Elton Wang wrote:
>>>> Can anyone please help me understand u. v on monad case?
>>>> For instance, -/ . * i.3, how's it get reduced step by step on the
>>>> definition below?
>>>>
>>>> DET=: 2 : 'v/@,`({."1 u . v $:@minors)@.(0<{:@$) @ ,. "2' minors=: }."1 @
>>>> (1&([\.))
>>>>
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm