# Essays/Tensor Experiments/TensorExperiments01

```NB. ... script experimental.ijs ...

gXc =:(<0 0){[
gXw =:(<0 1){[
gXp0=:(<1 0){[
gXp1=:(<1 1){[
gXp2=:(<1 2){[
gXp3=:(<1 3){[
gXp4=:(<1 4){[

gXT=:gXcw,:gXpAll

cy0=:0{]
cy1=:1{]
cy2=:2{]
cy3=:3{]

cx0=:0{]
cx1=:1{]
cx2=:2{]
cx3=:3{]

sin=:1&o.
cos=:2&o.

arctant1=:(1p1+_3&o.@({:%{.))`((2p1+_3&o.@({:%{.))`(_3&o.@({:%{.))@.(>:&0@{:))@.(>&0@{.)
arctant0=:3r2p1"_`(1r2p1"_)@.(>&0@{:)`0:@.(=&0@{:)
arctan  =:arctant1`arctant0@.(=&0@{.)"1

aVn2=:~.@(](([-:"1/:~"1@])#]),/^:1@(],"1"1 _~^:1])@:(,"0)@])
aVn3=:~.@(](([-:"1/:~"1@])#]),/^:2@(],"1"1 _~^:2])@:(,"0)@])
aVn4=:~.@(](([-:"1/:~"1@])#]),/^:3@(],"1"1 _~^:3])@:(,"0)@])
aVn5=:~.@(](([-:"1/:~"1@])#]),/^:4@(],"1"1 _~^:4])@:(,"0)@])

qtsz=:\$@]\$[0:`(I.@([>!.0|@]))`]},@]
qteq=:*./@,@([((>@(0{])|@:->@(1{]))<:!.0>@(1{[)*>@(0{])>.&:|>@(1{]))(>@(0{[)qtsz>@(0{]));>@(0{[)qtsz>@(1{]))

nzstats=:((<./;>./)@:|@((0<!.0|)#]),<@(+/)@(0<!.0|))@,

pTsteps =:(1{])+((2{])-1{])*(i.@>:%])@(3{])
pTgen   =:(|.@:-,])@pTsteps`pTsteps@.((0{])=_"_)
pTtotal =:,/^:3@>@(,"1"1 _&.>/)@(<@:(,"0)@pTgen"1@])

NB. ... for checking verbs (avoid 0) ...

pTRandom=:[(?.@(>@(1{[)\$0{\$@]){])[pTselect pTtotal

smx=:+/@(*"1)"1 _"_
```

```NB. ... script experimental.ijs ...

cfXX0=:>@(0{])
cfXX1=:>@(1{])
cfXX2=:>@(2{])
cfXX3=:>@(3{])
cfXX4=:>@(4{])
cfXX5=:>@(5{])

cfAL          =:>@((<0 0){])
cfALdc        =:>@((<0 1){])
cfALdcdc      =:>@((<0 2){])
cfALdcdcdc    =:>@((<0 3){])
cfALdcdcdcdc  =:>@((<0 4){])
cfALdcdcdcdcdc=:>@((<0 5){])

cfAF          =:>@((<0 0){])
cfAFdR        =:>@((<0 1){])
cfAFdRdR      =:>@((<0 2){])
cfAFdRdRdR    =:>@((<0 3){])
cfAFdRdRdRdR  =:>@((<0 4){])
cfAFdRdRdRdRdR=:>@((<0 5){])

cfAR          =:>@((<1 0){])
cfARdc        =:>@((<1 1){])
cfARdcdc      =:>@((<1 2){])
cfARdcdcdc    =:>@((<1 3){])
cfARdcdcdcdc  =:>@((<1 4){])
cfARdcdcdcdcdc=:>@((<1 5){])
```

```NB. ... script experimental.ijs ...

cfFN=:cfAF

cfFNdc=:cfAFdR*cfARdc

cfFNdcdct0=:(   ])@(cfAFdR  *cfARdcdc        )
cfFNdcdct1=:(0|:])@(cfAFdRdR*cfARdc  */cfARdc)

cfFNdcdc=:cfFNdcdct0+cfFNdcdct1

cfFNdcdcdct0=:(     ])@(cfAFdR    *cfARdcdcdc                  )
cfFNdcdcdct1=:(  0|:])@(cfAFdRdR  *cfARdc    */cfARdcdc        )
cfFNdcdcdct2=:(0 2|:])@(cfAFdRdR  *cfARdc    */cfARdcdc        )
cfFNdcdcdct3=:(0 1|:])@(cfAFdRdR  *cfARdcdc  */cfARdc          )
cfFNdcdcdct4=:(1 0|:])@(cfAFdRdRdR*cfARdc    */cfARdc  */cfARdc)

cfFNdcdcdc=:cfFNdcdcdct0+cfFNdcdcdct1+cfFNdcdcdct2+cfFNdcdcdct3+cfFNdcdcdct4

cfFNdcdcdcdct00=:(       ])@(cfAFdR      *cfARdcdcdcdc                              )
cfFNdcdcdcdct01=:(    0|:])@(cfAFdRdR    *cfARdc      */cfARdcdcdc                  )
cfFNdcdcdcdct10=:(  0 3|:])@(cfAFdRdR    *cfARdc      */cfARdcdcdc                  )
cfFNdcdcdcdct11=:(  0 1|:])@(cfAFdRdR    *cfARdcdc    */cfARdcdc                    )
cfFNdcdcdcdct12=:(  1 0|:])@(cfAFdRdRdR  *cfARdc      */cfARdc    */cfARdcdc        )
cfFNdcdcdcdct20=:(0 2 3|:])@(cfAFdRdR    *cfARdc      */cfARdcdcdc                  )
cfFNdcdcdcdct21=:(0 3 1|:])@(cfAFdRdR    *cfARdcdc    */cfARdcdc                    )
cfFNdcdcdcdct22=:(1 3 0|:])@(cfAFdRdRdR  *cfARdc      */cfARdc    */cfARdcdc        )
cfFNdcdcdcdct30=:(0 1 3|:])@(cfAFdRdR    *cfARdcdc    */cfARdcdc                    )
cfFNdcdcdcdct31=:(0 1 2|:])@(cfAFdRdR    *cfARdcdcdc  */cfARdc                      )
cfFNdcdcdcdct32=:(1 2 0|:])@(cfAFdRdRdR  *cfARdc      */cfARdcdc  */cfARdc          )
cfFNdcdcdcdct40=:(1 0 3|:])@(cfAFdRdRdR  *cfARdc      */cfARdc    */cfARdcdc        )
cfFNdcdcdcdct41=:(1 0 2|:])@(cfAFdRdRdR  *cfARdc      */cfARdcdc  */cfARdc          )
cfFNdcdcdcdct42=:(2 0 1|:])@(cfAFdRdRdR  *cfARdcdc    */cfARdc    */cfARdc          )
cfFNdcdcdcdct43=:(2 1 0|:])@(cfAFdRdRdRdR*cfARdc      */cfARdc    */cfARdc  */cfARdc)

cfFNdcdcdcdct0=:cfFNdcdcdcdct00+cfFNdcdcdcdct01
cfFNdcdcdcdct1=:cfFNdcdcdcdct10+cfFNdcdcdcdct11+cfFNdcdcdcdct12
cfFNdcdcdcdct2=:cfFNdcdcdcdct20+cfFNdcdcdcdct21+cfFNdcdcdcdct22
cfFNdcdcdcdct3=:cfFNdcdcdcdct30+cfFNdcdcdcdct31+cfFNdcdcdcdct32
cfFNdcdcdcdct4=:cfFNdcdcdcdct40+cfFNdcdcdcdct41+cfFNdcdcdcdct42+cfFNdcdcdcdct43

cfFNdcdcdcdc=:cfFNdcdcdcdct0+cfFNdcdcdcdct1+cfFNdcdcdcdct2+cfFNdcdcdcdct3+cfFNdcdcdcdct4

cfFNdcdcdcdcdct000=:(         ])@(cfAFdR        *cfARdcdcdcdcdc                                            )
cfFNdcdcdcdcdct001=:(      0|:])@(cfAFdRdR      *cfARdc        */cfARdcdcdcdc                              )
cfFNdcdcdcdcdct010=:(    0 4|:])@(cfAFdRdR      *cfARdc        */cfARdcdcdcdc                              )
cfFNdcdcdcdcdct011=:(    0 1|:])@(cfAFdRdR      *cfARdcdc      */cfARdcdcdc                                )
cfFNdcdcdcdcdct012=:(    1 0|:])@(cfAFdRdRdR    *cfARdc        */cfARdc      */cfARdcdcdc                  )
cfFNdcdcdcdcdct100=:(  0 3 4|:])@(cfAFdRdR      *cfARdc        */cfARdcdcdcdc                              )
cfFNdcdcdcdcdct101=:(  0 4 1|:])@(cfAFdRdR      *cfARdcdc      */cfARdcdcdc                                )
cfFNdcdcdcdcdct102=:(  1 4 0|:])@(cfAFdRdRdR    *cfARdc        */cfARdc      */cfARdcdcdc                  )
cfFNdcdcdcdcdct110=:(  0 1 4|:])@(cfAFdRdR      *cfARdcdc      */cfARdcdcdc                                )
cfFNdcdcdcdcdct111=:(  0 1 2|:])@(cfAFdRdR      *cfARdcdcdc    */cfARdcdc                                  )
cfFNdcdcdcdcdct112=:(  1 2 0|:])@(cfAFdRdRdR    *cfARdc        */cfARdcdc    */cfARdcdc                    )
cfFNdcdcdcdcdct120=:(  1 0 4|:])@(cfAFdRdRdR    *cfARdc        */cfARdc      */cfARdcdcdc                  )
cfFNdcdcdcdcdct121=:(  1 0 2|:])@(cfAFdRdRdR    *cfARdc        */cfARdcdc    */cfARdcdc                    )
cfFNdcdcdcdcdct122=:(  2 0 1|:])@(cfAFdRdRdR    *cfARdcdc      */cfARdc      */cfARdcdc                    )
cfFNdcdcdcdcdct123=:(  2 1 0|:])@(cfAFdRdRdRdR  *cfARdc        */cfARdc      */cfARdc    */cfARdcdc        )
cfFNdcdcdcdcdct200=:(0 2 3 4|:])@(cfAFdRdR      *cfARdc        */cfARdcdcdcdc                              )
cfFNdcdcdcdcdct201=:(0 3 4 1|:])@(cfAFdRdR      *cfARdcdc      */cfARdcdcdc                                )
cfFNdcdcdcdcdct202=:(1 3 4 0|:])@(cfAFdRdRdR    *cfARdc        */cfARdc      */cfARdcdcdc                  )
cfFNdcdcdcdcdct210=:(0 3 1 4|:])@(cfAFdRdR      *cfARdcdc      */cfARdcdcdc                                )
cfFNdcdcdcdcdct211=:(0 4 1 2|:])@(cfAFdRdR      *cfARdcdcdc    */cfARdcdc                                  )
cfFNdcdcdcdcdct212=:(1 4 2 0|:])@(cfAFdRdRdR    *cfARdc        */cfARdcdc    */cfARdcdc                    )
cfFNdcdcdcdcdct220=:(1 3 0 4|:])@(cfAFdRdRdR    *cfARdc        */cfARdc      */cfARdcdcdc                  )
cfFNdcdcdcdcdct221=:(1 4 0 2|:])@(cfAFdRdRdR    *cfARdc        */cfARdcdc    */cfARdcdc                    )
cfFNdcdcdcdcdct222=:(2 4 0 1|:])@(cfAFdRdRdR    *cfARdcdc      */cfARdc      */cfARdcdc                    )
cfFNdcdcdcdcdct223=:(2 4 1 0|:])@(cfAFdRdRdRdR  *cfARdc        */cfARdc      */cfARdc    */cfARdcdc        )
cfFNdcdcdcdcdct300=:(0 1 3 4|:])@(cfAFdRdR      *cfARdcdc      */cfARdcdcdc                                )
cfFNdcdcdcdcdct301=:(0 1 4 2|:])@(cfAFdRdR      *cfARdcdcdc    */cfARdcdc                                  )
cfFNdcdcdcdcdct302=:(1 2 4 0|:])@(cfAFdRdRdR    *cfARdc        */cfARdcdc    */cfARdcdc                    )
cfFNdcdcdcdcdct310=:(0 1 2 4|:])@(cfAFdRdR      *cfARdcdcdc    */cfARdcdc                                  )
cfFNdcdcdcdcdct311=:(0 1 2 3|:])@(cfAFdRdR      *cfARdcdcdcdc  */cfARdc                                    )
cfFNdcdcdcdcdct312=:(1 2 3 0|:])@(cfAFdRdRdR    *cfARdc        */cfARdcdcdc  */cfARdc                      )
cfFNdcdcdcdcdct320=:(1 2 0 4|:])@(cfAFdRdRdR    *cfARdc        */cfARdcdc    */cfARdcdc                    )
cfFNdcdcdcdcdct321=:(1 2 0 3|:])@(cfAFdRdRdR    *cfARdc        */cfARdcdcdc  */cfARdc                      )
cfFNdcdcdcdcdct322=:(2 3 0 1|:])@(cfAFdRdRdR    *cfARdcdc      */cfARdcdc    */cfARdc                      )
cfFNdcdcdcdcdct323=:(2 3 1 0|:])@(cfAFdRdRdRdR  *cfARdc        */cfARdc      */cfARdcdc  */cfARdc          )
cfFNdcdcdcdcdct400=:(1 0 3 4|:])@(cfAFdRdRdR    *cfARdc        */cfARdc      */cfARdcdcdc                  )
cfFNdcdcdcdcdct401=:(1 0 4 2|:])@(cfAFdRdRdR    *cfARdc        */cfARdcdc    */cfARdcdc                    )
cfFNdcdcdcdcdct402=:(2 0 4 1|:])@(cfAFdRdRdR    *cfARdcdc      */cfARdc      */cfARdcdc                    )
cfFNdcdcdcdcdct403=:(2 1 4 0|:])@(cfAFdRdRdRdR  *cfARdc        */cfARdc      */cfARdc    */cfARdcdc        )
cfFNdcdcdcdcdct410=:(1 0 2 4|:])@(cfAFdRdRdR    *cfARdc        */cfARdcdc    */cfARdcdc                    )
cfFNdcdcdcdcdct411=:(1 0 2 3|:])@(cfAFdRdRdR    *cfARdc        */cfARdcdcdc  */cfARdc                      )
cfFNdcdcdcdcdct412=:(2 0 3 1|:])@(cfAFdRdRdR    *cfARdcdc      */cfARdcdc    */cfARdc                      )
cfFNdcdcdcdcdct413=:(2 1 3 0|:])@(cfAFdRdRdRdR  *cfARdc        */cfARdc      */cfARdcdc  */cfARdc          )
cfFNdcdcdcdcdct420=:(2 0 1 4|:])@(cfAFdRdRdR    *cfARdcdc      */cfARdc      */cfARdcdc                    )
cfFNdcdcdcdcdct421=:(2 0 1 3|:])@(cfAFdRdRdR    *cfARdcdc      */cfARdcdc    */cfARdc                      )
cfFNdcdcdcdcdct422=:(3 0 1 2|:])@(cfAFdRdRdR    *cfARdcdcdc    */cfARdc      */cfARdc                      )
cfFNdcdcdcdcdct423=:(3 1 2 0|:])@(cfAFdRdRdRdR  *cfARdc        */cfARdcdc    */cfARdc    */cfARdc          )
cfFNdcdcdcdcdct430=:(2 1 0 4|:])@(cfAFdRdRdRdR  *cfARdc        */cfARdc      */cfARdc    */cfARdcdc        )
cfFNdcdcdcdcdct431=:(2 1 0 3|:])@(cfAFdRdRdRdR  *cfARdc        */cfARdc      */cfARdcdc  */cfARdc          )
cfFNdcdcdcdcdct432=:(3 1 0 2|:])@(cfAFdRdRdRdR  *cfARdc        */cfARdcdc    */cfARdc    */cfARdc          )
cfFNdcdcdcdcdct433=:(3 2 0 1|:])@(cfAFdRdRdRdR  *cfARdcdc      */cfARdc      */cfARdc    */cfARdc          )
cfFNdcdcdcdcdct434=:(3 2 1 0|:])@(cfAFdRdRdRdRdR*cfARdc        */cfARdc      */cfARdc    */cfARdc  */cfARdc)

cfFNdcdcdcdcdct00=:cfFNdcdcdcdcdct000+cfFNdcdcdcdcdct001
cfFNdcdcdcdcdct01=:cfFNdcdcdcdcdct010+cfFNdcdcdcdcdct011+cfFNdcdcdcdcdct012
cfFNdcdcdcdcdct10=:cfFNdcdcdcdcdct100+cfFNdcdcdcdcdct101+cfFNdcdcdcdcdct102
cfFNdcdcdcdcdct11=:cfFNdcdcdcdcdct110+cfFNdcdcdcdcdct111+cfFNdcdcdcdcdct112
cfFNdcdcdcdcdct12=:cfFNdcdcdcdcdct120+cfFNdcdcdcdcdct121+cfFNdcdcdcdcdct122+cfFNdcdcdcdcdct123
cfFNdcdcdcdcdct20=:cfFNdcdcdcdcdct200+cfFNdcdcdcdcdct201+cfFNdcdcdcdcdct202
cfFNdcdcdcdcdct21=:cfFNdcdcdcdcdct210+cfFNdcdcdcdcdct211+cfFNdcdcdcdcdct212
cfFNdcdcdcdcdct22=:cfFNdcdcdcdcdct220+cfFNdcdcdcdcdct221+cfFNdcdcdcdcdct222+cfFNdcdcdcdcdct223
cfFNdcdcdcdcdct30=:cfFNdcdcdcdcdct300+cfFNdcdcdcdcdct301+cfFNdcdcdcdcdct302
cfFNdcdcdcdcdct31=:cfFNdcdcdcdcdct310+cfFNdcdcdcdcdct311+cfFNdcdcdcdcdct312
cfFNdcdcdcdcdct32=:cfFNdcdcdcdcdct320+cfFNdcdcdcdcdct321+cfFNdcdcdcdcdct322+cfFNdcdcdcdcdct323
cfFNdcdcdcdcdct40=:cfFNdcdcdcdcdct400+cfFNdcdcdcdcdct401+cfFNdcdcdcdcdct402+cfFNdcdcdcdcdct403
cfFNdcdcdcdcdct41=:cfFNdcdcdcdcdct410+cfFNdcdcdcdcdct411+cfFNdcdcdcdcdct412+cfFNdcdcdcdcdct413
cfFNdcdcdcdcdct42=:cfFNdcdcdcdcdct420+cfFNdcdcdcdcdct421+cfFNdcdcdcdcdct422+cfFNdcdcdcdcdct423
cfFNdcdcdcdcdct43=:cfFNdcdcdcdcdct430+cfFNdcdcdcdcdct431+cfFNdcdcdcdcdct432+cfFNdcdcdcdcdct433+cfFNdcdcdcdcdct434

cfFNdcdcdcdcdct0=:cfFNdcdcdcdcdct00+cfFNdcdcdcdcdct01
cfFNdcdcdcdcdct1=:cfFNdcdcdcdcdct10+cfFNdcdcdcdcdct11+cfFNdcdcdcdcdct12
cfFNdcdcdcdcdct2=:cfFNdcdcdcdcdct20+cfFNdcdcdcdcdct21+cfFNdcdcdcdcdct22
cfFNdcdcdcdcdct3=:cfFNdcdcdcdcdct30+cfFNdcdcdcdcdct31+cfFNdcdcdcdcdct32
cfFNdcdcdcdcdct4=:cfFNdcdcdcdcdct40+cfFNdcdcdcdcdct41+cfFNdcdcdcdcdct42+cfFNdcdcdcdcdct43

cfFNdcdcdcdcdc=:cfFNdcdcdcdcdct0+cfFNdcdcdcdcdct1+cfFNdcdcdcdcdct2+cfFNdcdcdcdcdct3+cfFNdcdcdcdcdct4

cfFN0=:cfFN;     _;       _;         _;           _;             _"_
cfFN1=:cfFN;cfFNdc;       _;         _;           _;             _"_
cfFN2=:cfFN;cfFNdc;cfFNdcdc;         _;           _;             _"_
cfFN3=:cfFN;cfFNdc;cfFNdcdc;cfFNdcdcdc;           _;             _"_
cfFN4=:cfFN;cfFNdc;cfFNdcdc;cfFNdcdcdc;cfFNdcdcdcdc;             _"_
cfFN5=:cfFN;cfFNdc;cfFNdcdc;cfFNdcdcdc;cfFNdcdcdcdc;cfFNdcdcdcdcdc
```