Linda, if you enter  50 0  and then enter  1 2 $ 50 0  the printed results 
appear the same, but the first has two items and the second only one item.  
What do you expect the average of a one-item array to be?  Can you figure out 
how to use rank to get what you want from  r 0 100 _2  ?

Sent from my iPad


On Feb 23, 2013, at 6:21 PM, "Linda Alvord" <lindaalv...@verizon.net> wrote:

> A should give an average.  The roots are  50 0 .
> 
> Shouldn't the average be 25 rather than 1 2  ?
> 
> Linda
> 
> -----Original Message-----
> From: programming-boun...@forums.jsoftware.com
> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of km
> Sent: Saturday, February 23, 2013 6:45 PM
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] The farmer's fence
> 
>    r 0 100 _2
> 50 0
>    $r 0 100 _2
> 1 2
> 
> Sent from my iPad
> 
> 
> On Feb 23, 2013, at 4:35 PM, "Linda Alvord" <lindaalv...@verizon.net> wrote:
> 
>> The roots of a polynomial:
>> 
>>  r=: 13 :'> }. p. y'
>>  r 0 100 _2    :
>> 50 0
>>  r
>> [: > [: }. p.
>> 
>> 
>> The average of the roots or  x  coordinate of axis of symmetry: 
>>  a=: 13 :'(+/y)%#y'
>>  a 50 0
>> 25
>>  a   
>> +/ % #
>> 
>> Find the maximum:
>> 
>>  0 100 _2 p. 25
>> 1250m
>> 
>> Sadly this doesn't work:
>> 
>>  a r 0 100 _2
>> 50 0
>> 
>> Any idea why not?
>> 
>> Linda
>> 
>> 
>> -----Original Message-----
>> From: programming-boun...@forums.jsoftware.com
>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Alex 
>> Giannakopoulos
>> Sent: Saturday, February 23, 2013 3:28 PM
>> To: J Programming forum
>> Subject: Re: [Jprogramming] The farmer's fence
>> 
>> Nice little gotcha there, assuming that the shape will be a square, 
>> since a square maximizes the contained area for a rectangle, while 
>> forgetting that the wall gives you extra perimeter for free, depending on
> the shape.
>> 
>> By the same analogy I'd tackle Roger's version of the problem, i.e.  
>> find ANY shape that will maximize the area:
>> Again, I suspect that going for a (semi)circle might be essentially 
>> the same gotcha.
>> 
>> I haven't got time to code it at the moment, but I'd investigate an 
>> (half) ellipse and also a parabola.
>> Will need some integration though, to find the expression for the 
>> length of their curves.
>> ----------------------------------------------------------------------
>> 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

Reply via email to