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