Brian Schott already answered your question?

Remember we are working with polynomials.  So, from a results
perspective, these are equivalent:

   1 2 1 p. y
   1 2 1 0 0 p. y
   1 2 1 0 0 0 0 p. y

You will probably notice a relationship between these zeros and the
leading zeros in decimal numbers and the leading ones in array shape?

It's probably worth keeping in mind that originally, Iverson did not
want any length errors on arrays, but because length errors catch so
many problems they have been incorporated in the language.

In contexts where length errors are not appropriate, we have a variety
of mechanisms available to us:

We can find the length of both arrays and use take ({.) with their
maximum (best in explicit contexts) -- x dyad&((x>.y)&{.)

We can join the arrays using ,: and then reduce them (dyad/)@,:

We can use sparse arrays with an arbitrarily large array index  x
dyad&(9e9{.$.) y  -- note that _ does not work here, as a length, note
also that if we take this approach we will need to extract the array
size somehow, later, if we ever want a dense array, and finally note
that this use of "array shape" starts feeling more like the concept of
"type" popular in some other languages (as opposed to "dependent type"
-- here, it's just something arbitrary which distinguishes between
otherwise identically appearing structures).  We have some other
issues with sparse arrays, also...

And, of course, we can often find algorithmically relevant ways of
handing array length.  These tend to be related to the purpose of our
algorithms.

I hope this helps,

-- 
Raul

On Fri, Nov 2, 2012 at 5:36 PM, Linda Alvord <lindaalv...@verizon.net> wrote:
> I answered the wrong message.  What about the final two zero's in the
> result?
>
> Linda
>
>
> -----Original Message-----
> From: programming-boun...@forums.jsoftware.com
> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul Miller
> Sent: Friday, November 02, 2012 10:46 AM
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Taylor series
>
> On Fri, Nov 2, 2012 at 5:18 AM, Linda Alvord <lindaalv...@verizon.net>
> wrote:
>> Raul, I haven't gotten to t. yet, but I did manage not to use  (f*g)  or
> p.
>>
>>    f=: 1 2 1&p.
>>    g=: 1 3 3 1&p.
>>    x=: 10%~i=: i.8
>>    ]c=: (f*g) t. i        NB. This still has problems
>> 1 5 10 10 5 1 0 0
>
> What problems?
>
>    1 2 1 +//.@:(*/) 1 3 3 1
> 1 5 10 10 5 1
>
> Thanks,
>
> --
> Raul
> ----------------------------------------------------------------------
> 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

Reply via email to