Here is a fun party trick:

   rt=. (] %: -@[) * [: ^ [: j. ] %~ 1p1 + 2p1 * i.@]
   pw=. ^ :. rt
   f=. 1 + ] pw 6:
   (f^:_1) 0
0.866025j0.5 6.12323e_17j1 _0.866025j0.5 _0.866025j_0.5 _1.83697e_16j_1 
0.866025j_0.5
   f (f^:_1) 0
_2.22045e_16j6.10623e_16 0j3.67394e_16 _2.22045e_16j_6.10623e_16 
_2.22045e_16j2.05391e_15 0j1.10218e_15 0j3.10862e_15

(Sadly, the inverter is not smart enough to invert e.g. 1 + pw&3 + pw&6, so p. is probably the more practical solution.)

 -E

On Sat, 23 Oct 2021, More Rice wrote:

Thank you for the notes - I'll keep it in my bookmark as reference!

I started out this morning with my pre-calculus book trying to practice J
sentences with.  I wanted the numeric answers for complex roots.  Like:

// matlab version
syms x
eqn = x^6+1 == 0
solve(eqn, x)

But, it seems J only gives the principal root (?), not all 6 of them; so,
another opportunity for practise.  But, I ended up writing like ...
"matlab":

  ^ 0j1 * (1p1 + 2p1 * i.6) % 6  NB. 1st version

That was why I was browsing NuVoc, looking for examples/ideas, hoping to
see something to make my J sentence looks more ... "J-idiomatic" (while
learning something out of the process).

This is all I can I come up with today:

  ^ 0j1 * 6 %~ 1p1 + 2p1 * i.6   NB. 2nd version

How would the same answer look like in the eyes of J Masters?


thanks for your thoughts.

On Sat, Oct 23, 2021 at 4:18 PM 'Pascal Jasmin' via Programming <
[email protected]> wrote:

a more hollistic explanation,

Most conjunctions, and including the & and @ famillies, produce verb
phrases when bound.  A verb or verb phrase can/has to produce different
results/computations depending on monadic or dyadic cases.  In u@v, u is
always monadic, and v is ambivalent.  in u&v, v is always monadic, and u is
the valence of the verb phrase.

A missing "composing conjunction" in J is ([ u v)  where u is always
dyadic and v is ambivalent.  But the fact that it is easy to write as a
fork suggests a dedicated conjunction is not needed.


On Saturday, October 23, 2021, 03:30:09 p.m. EDT, Raul Miller <
[email protected]> wrote:





https://www.jsoftware.com/help/dictionary/d631.htm

  x u&.v y ↔ vi (v x) u (v y)

Here:
  u is +
  v is *:
  vi is %: (or *:inv)
  x is 3
  y is 4

So these are equivalent
  3 +&.*: 4
  %: (*:3) + (*: 4)
  *:inv (*:3) + (*: 4)

I hope this makes sense.

--
Raul

On Sat, Oct 23, 2021 at 3:03 PM More Rice <[email protected]> wrote:
>
> Hello,
>
> (Sorry for the previous empty email - web page problem)
>
> please excuse another newbie question ...
>
> Ref: https://code.jsoftware.com/wiki/Vocabulary/starco
>
>    pythag =:  +&.*:
>    3 pythag 4
> 5
>
> + operated dyadically and acted on both x and y - ok.
>
> but how does *: know to act on x as well?  Isn't pythag using the monadic
> definition of *: to square y only?
>
> so magical ...
>
> thank you for the pointer and have a great weekend.
>
>
> Maurice
> ----------------------------------------------------------------------
> 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

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

Reply via email to