Help wanted with conjunctions & tacit verbs 
Author Message
 Help wanted with conjunctions & tacit verbs

I still have problems with parts of J speech other than verbs & nouns.
For example, I want to integrate a certain function numerically
between transformed limits - say exp(x) between 1^2 & 2^2.
I could apply a compound Simpson's rule
using the conjunction 'simpson' as follows:

        load 'examples\math\integrat.js'
        ^ simpson ((*: 1 2),1000)
     51.8798682

Is there a tacit function, 'expsimpsq' say, that does the same thing?  
i.e. that acts as follows:

        expsimpsq 1 2
     51.8798682

I suspect my inability to write one is because
of my difficulties with conjunctions etc.
Seeing a tacit 'expsimpsq' might clarify things for me.
Note that the following expression remains in script form

     exsimpsq=: 13 : '^ simpson ((*: y.),1000)'

DISCLAIMER: The above just exemplifies what I want to do;
the actual application does make considerably better sense!

     Many thanks, Ewart Shaw

--

  Department of Statistics,  University of Warwick,  Coventry CV4 7AL,  U.K.
  http://www.*-*-*.com/
yacc - the piece of code that understandeth all parsing



Sun, 09 Apr 2000 03:00:00 GMT  
 Help wanted with conjunctions & tacit verbs


J.E.H. Shaw writes on Wednesday, October 22:

Quote:
> I still have problems with parts of J speech other than verbs & nouns.
> For example, I want to integrate a certain function numerically
> between transformed limits - say exp(x) between 1^2 & 2^2.
> I could apply a compound Simpson's rule
> using the conjunction 'simpson' as follows:

>         load 'examples\math\integrat.js'
>         ^ simpson ((*: 1 2),1000)
>      51.8798682

> Is there a tacit function, 'expsimpsq' say, that does the same thing?
> i.e. that acts as follows:

>         expsimpsq 1 2
>      51.8798682

> I suspect my inability to write one is because
> of my difficulties with conjunctions etc.
> Seeing a tacit 'expsimpsq' might clarify things for me.
> Note that the following expression remains in script form

>      exsimpsq=: 13 : '^ simpson ((*: y.),1000)'

> DISCLAIMER: The above just exemplifies what I want to do;
> the actual application does make considerably better sense!

The problem is not that "simpson" is defined as a conjunction, but
that it is a conjunction that returns a noun result (taking a verb left
argument and a noun right argument to do so).

   simpson
2 : 0
('lower';'upper';'int')=. 3{.y.,128
size=. (upper-lower)%int
val=. x. lower+size*i.>:int
size * +/val * 3%~ 1,((int-1)$4 2),1
)

   4!:0 <'simpson'
2
   ^ simpson ((*:1 2),1000)
51.8799

In the last example, both sets of parentheses are necessary,
since "simpson" is a conjunction:

   ^ simpson (*:1 2),1000    <->    (^ simpson (*:1 2)),1000
   ^ simpson ((*:1 2),1000)  <->    ^ simpson 1 4 1000

"simpson" serves the purpose of estimating the integral of a function
in a specified interval, but because its syntax is unexpected
(conjunction returning a noun), difficulties arise in writing
tacit expressions involving it.  The solution is to write "simpson"
as an adverb:

simpson1=: 1 : 0
 'lower upper int'=. 3{.y.,128
 size=. (upper-lower)%int
 val=. u. lower+size*i.>:int
 size * +/val * 3%~ 1,((int-1)$4 2),1
)

Here, u. is the verb left argument to the adverb, and y. is the noun
right argument to the derived verb (u. simpson1) .

   ^ simpson1 (*:1 2),1000
51.8799

51.8799

   f 1 2
51.8799

It is also possible to write an adverbial "simpson" in a more
tacit style, where the adverb makes no explicit reference to the
argument of the derived verb, thus:

   arg      =: 3: {. ,&128





   ^ simpson2 (*:1 2),1000
51.8799

51.8799

   f 1 2
51.8799



Mon, 10 Apr 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. re please help with j's rank conjunction

2. Help - why doesn't this conjunction work?

3. J question. (noun0&verb)^:N noun1

4. Initialize verb & variable arrays

5. J: Amending entries, rows, blocks Ques: tacit def of conjunctions?

6. help on accept verb

7. Help with the ACCEPT verb

8. Newbie asks for help regarding irregular verbs

9. help wanted: apache & mod_python application on Linux

10. J2 explicit to tacit defs

11. Subroutine, lambda abstraction, tacit form

12. Tacit numerical integration?

 

 
Powered by phpBB® Forum Software