So, assuming you're really looking for the possible grade vector

   <:6 1 5 2 3 4
5 0 4 1 2 3

You could choose F like this for "W =. 3 9 [L =. 20 16 12"

F=: 4 : 0"0
   select. x*y
   case. 60 do. 4
   case. 180 do. 2
   case. 48 do. 1
   case. 144 do. 0
   case. 36 do. 3
   case. 108 do. 5
   end.
)

and you ravel the table produced by  "L F/ W",

   \:,L F/ W
5 0 4 1 2 3

But this hardly seems like a satisfactorily general "F".

A brute force approach also seems fruitless:
   F=: 4 : 'x^2 - y^2'
   ]targ=. <:6 1 5 2 3 4      NB. Targeting a possible grade vector
5 0 4 1 2 3

   $W=. {2$<_2 _1 0 1 2       NB. All pairs of these five items
5 5
   $L=. {3$<_3 _2 _1 0 1 2 3  NB. All triplets of these five items
7 7 7
   $\:"1 ,&>L(F/&.>)/W
7 7 7 5 5 6

   $(,/)^:4]\:"1 ,&>L(F/&.>)/W
8575 6
   (<targ) e. <"1 (,/)^:4]\:"1 ,&>L(F/&.>)/W
0
NB. Not here...
   $targ *./ . =~ (,/)^:4]\:"1 ,&>L(F/&.>)/W
8575
   1 e. targ *./ . =~ (,/)^:4]\:"1 ,&>L(F/&.>)/W
0

NB. Try a wider range...
   $W=. {2$<_20 _10 2 1 0 1 2 10 20
9 9
   3 3{.W
+-------+-------+-----+
|_20 _20|_20 _10|_20 2|
+-------+-------+-----+
|_10 _20|_10 _10|_10 2|
+-------+-------+-----+
|2 _20  |2 _10  |2 2  |
+-------+-------+-----+
   $L=. {3$<_30 _20 _10 _3 _2 _1 0 1 2 3 10 20 30
13 13 13
   ]targ=. <:6 1 5 2 3 4
5 0 4 1 2 3
   1 e. targ *./ . =~ (,/)^:4]\:"1 ,&>L(F/&.>)/W
0
NB. Not here either...

This problem seems woefully under-specified.

Regards,

Devon

On Thu, Feb 25, 2010 at 7:48 PM, Yuvaraj Athur Raghuvir <
[email protected]> wrote:

> I have to determine such an F. F is not given. The only known information
> is
> how the values are ordered.
>
> On Thu, Feb 25, 2010 at 4:44 PM, Henry Rich <[email protected]> wrote:
>
> > You are looking for a solution given any F?
> >
> > If F is [, no solution is possible.
> >
> > Henry Rich
> >
> > Yuvaraj Athur Raghuvir wrote:
> > > Dear J Forum,
> > >
> > > I have an interesting problem for which I need more insights to
> proceed.
> > >
> > > I have to determine three unknowns:
> > > (a) W where 2 = $W = w1, w2
> > > (b) L where 3 = $ L = l1 , l2 , l3
> > > (c) F a dyad that takes scalar inputs
> > >
> > > Such that
> > > (6 1 5 2 3 4) -: \:; L F"0 0/ W NB. the order of values is known.
> > >
> > > For example,
> > >     F =: *
> > >     (6 1 5 2 3 4) -: \:; L F"0 0/ W  [W =. 3 9 [L =. 20 16 12
> > > 0
> > >
> > > I designed a test that is essentially a blind brute force on the inputs
> > > assuming F is given:
> > > F =: 4 : 'x^2 - y^2' NB. for example
> > > odometer =: #: i.@(*/)
> > > test =: 3 : 0
> > >  n =. y
> > >  w =. odometer n,n
> > >  l =. odometer n,n,n
> > >  NB. I get a length error if I use bigger inputs. So chunking into
> 100's
> > >  for_i. i. 100 %~ {. $l do.
> > >   for_j. i. 100 %~ {. $w do.
> > >    b =. ('' -: I. (6 1 5 2 3 4) -:"1 1 (>@[ \:@,"_1@:(F"0 0/"1 1)
> >@])/
> > > (_100{.(100*>:i){. l);(_100{.(100*>:j){. w))
> > >    smoutput i,j
> > >    if. b<1 do. break. [smoutput 'found it';i;j end.
> > >   end.
> > >  end.
> > >  ''
> > > )
> > >
> > > I am not convinced that I can find a solution this way since the
> > functional
> > > forms are far too many to be tried out notwithstanding my other
> > assumptions.
> > >
> > >
> > > Any suggestions?
> > >
> > > Regards,
> > > Yuva
> > > ----------------------------------------------------------------------
> > > 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
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to