Given the symmetric matrix

   A
     0 5000.5 50.5
5000.5      0    0
  50.5      0    0

and the vector

   B
0 _1 0

your function fun is the sum of a quadratic part

   Q =: ] mp A mp ]

and a linear part

   L =: B mp ]

where mp is the matrix product +/ . *

Thus

   fun =: Q + L
   fun 5 3 2
151022
   fun 9 2 4
183652
   fun 8 6 3
482466
   fun 5 4 5
202541
   fun 7 2 5
143547

--Kip Murray


On Saturday, December 13, 2014, robert therriault <[email protected]>
wrote:

> Hey Skip,
>
> I'm sure that there are more elegant ways but, here goes.
>
>    fun=: 3 : 0
> ​'a b c'=. y
> ​(a*b*10000)+(a*c*100)+(a*b+c)-b
> ​)
>    fun 5 3 2
> 151022
>    fun 9 2 4
> 183652
>    fun 8 6 3
> 482466
>    fun 5 4 5
> 202541
>    fun 7 2 5
> 143547
>
>
> Cheers, bob
>
>
> On Dec 13, 2014, at 3:17 PM, Skip Cave <[email protected]
> <javascript:;>> wrote:
>
> > Oops! printing mistake...
> >
> >   fun 5 3 2
> > 151022
> >   fun 9 2 4
> > 183652
> >
> >   fun 8 6 3
> >
> > 482466
> >
> >   fun 5 4 5
> >
> > 202541
> >
> >   fun 7 2 5
> >
> > ???
> >
> >
> >
> > Skip Cave
> > Cave Consulting LLC
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



-- 
Sent from Gmail Mobile
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to