Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!ncoast!ppetto
From: ppetto@NCoast.ORG (Peter Petto)
Subject: J Function Question
Expires: Tue, 10 Mar 1992 05:00:00 GMT
Organization: North Coast Public Access *NIX, Cleveland, OH
Date: Mon, 2 Mar 1992 16:35:41 GMT
Message-ID: <1992Mar2.163541.2711@NCoast.ORG>
Summary: general question on J
Keywords: J APL
Sender: ppetto@ncoast.org
Lines: 28

I am looking for an answer to a problem I am having trying to define
a function in J.  Right now I have a function that is the central to
a variety of discounted cash flow calculations. It is:

   npv=.'+/y.' : '+/(y.%(1+x.)^(#\y.))'

And yields results such as the following:

      0.05 npv 1000 1200 1500 900
 4077
      0.06 npv 1000 1200 1500 900
 3983.71

I would like to define a "mystery function" that will apply a set of
left-side values to the same right-side values, yielding results as
follows:
      
      0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 mystfn 1000 1200 1500 900
 4077 3983.71 3893.76 3807.01 3723.31 3642.51 3564.49 3489.13

I know I'm missing something -- I'm just not sure what.  I'd appreciate
any and all advice.

---
Peter Petto        |     ppetto@ncoast.org
Bay Village, Ohio  |  73125.617@compuserve.com


