I am a relative newbie and am trying to teach myself the intricacies by addressing a simple problem: some geometric operations on the surface of a unit sphere.  The first step is to take latitude and longitude angles and create a Cartesian vector pointing from the center of the sphere to that point.  I can do that via:

vec =: ((1 o. }:)*(2 o. {:)),((1 o. }:)*(1 o. {:)),(2 o. }:)

this verb yields the desired vector

    [vec o. (1.25,_0.55)

0.110616 0.698401 _0.707107

   +/([vec o. (1.25,_0.55))^2

1

Is there a shorter, less verbose way of writing the verb 'vec'?

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to