« first day (1852 days earlier)      last day (803 days later) » 

1:36 AM
i am blown away right now. i wrote this degree to radians script: dtr←○180÷⍨⊢
and i now wanted degrees to radians... for fun and curiousity on how ⍣ worked, i tried doing (dtr⍣¯1) and somehow that actually worked???? and i am absolutely amazed at this magic... like how in the world does dyalog apl know what i want??
 
@BrianBED ○180÷⍨⊢ is a linear sequence of operations on the argument (divide by 180, multiply by pi), so it's not that hard to reverse that sequence and do the opposite for each
 
so does ⍣¯1 just reverse the operators?
 
⍣¯1 can do many things, but here it just needs to apply the reversed operations in reverse order
 
wow... still amazed tho. like dude when it worked you should have seen my face
is there an equivilent way of doing that in other languages like python or js?
 
not really
 
1:43 AM
insane :o
 
(Dyalog also has a numerical solver in the inverses if a simpler approach fails, so you can solve polynomials with it or something)
Jan 12 '21 at 0:00, by dzaima
@MartinJaniczek inverses and under are my favorite part of APL
 
:OOOOOOO
duuuddeeee imma copy that and use it in math class. (we're allowed calculators)
:D
ok wow i just looked at the code a bit closer... thats so insanly cool!
 
 
13 hours later…
3:12 PM
@dzaima congratulations on your nerdsnipe
⋄mkp←{(⍎'(',')⍣¯1',⍨((⊂'+⊢×')(1↓∘,,⍤0)⍕¨⌽1↓⍵),⍥∊'+' (⍕⊃⍵) '×⊢')0}⋄mkp 4 3 2 1
 
@KamilaSzewczyk ¯0.6058295862
 
      ⎕fix'file:///home/palaiologos/workspace/apl-misc-math/mm.apl'⋄mm.setup
ok
      50 mm.durand_kerner 4 3 2 1
¯0.07208520690586594J¯0.6383267351483765 ¯0.072085206905866J0.6383267351483765

      ¯0.605829586188268
      'cmpx'⎕cy'dfns'
      cmpx '⊃⌽50 mm.durand_kerner 4 3 2 1' 'mkp 4 3 2 1'
  ⊃⌽50 mm.durand_kerner 4 3 2 1 → 3.3E¯4 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  mkp 4 3 2 1                   → 5.2E¯5 | -85% ⎕⎕⎕⎕⎕⎕

      ⎕⎕⎕⎕⎕⎕⎕⎕⎕
surprisingly it's not that slow, but also very imprecise and not that useful.
      50 mm.durand_kerner 1 0 1
0J¯1 0J1
      mkp 1 0 1
DOMAIN ERROR
mkp[0] mkp←{(⍎'(',')⍣¯1',⍨((⊂'+⊢×')(1↓∘,,⍤0)⍕¨⌽1↓⍵),⍥∊'+'(⍕⊃⍵)'×⊢')0}
            ∧
when you try to corner dyalog into producing an imaginary result, it errors.
if it uses newton raphson under the hood, i wonder if it's possible to trick this implementation.
⋄mkp←{(⍎'(',')⍣¯1',⍨((⊂'+⊢×')(1↓∘,,⍤0)⍕¨⌽1↓⍵),⍥∊'+' (⍕⊃⍵) '×⊢')0}⋄mkp 27 0 ¯3 1
 
@KamilaSzewczyk ¯0.4415726524
 
this would error with an improperly picked starting point
 
 
2 hours later…
5:01 PM
This is a somewhat complicated "engineering" type question. I've been using sharpplot to display statistical data and
it's working very well - as long as all the code is in a single Namespace. I liked the results so much I wanted to plot
some data I was computing in another Namespace. I figured the best way to do this would be to put the plotting code in
a single plot namespace then )COPY it into the individual namespaces I wanted to plot from. I must be doing something wrong
since I can't figure out how to make this work. When I try to plot from, say a namespace A where:
 
@bwanab Your usage of a workspace with scripted namespaces here is very unusual. Your ⎕CYs are running when the namespaces are defined, rendering the namespaces different from their source. You then save those in your workspace in these modified forms.
I suggest having a #.utils namespace for the things from dfns.dws, and importing SharpPlot to # too, once and for all, then use those locations with .s
 
5:53 PM
OK, I'm not sure exactly what you mean, but trying to follow what you're
saying, I've found a way to make it work. Let me know if I'm on the right
path.

I changed all the references to Causeway and System in plot
to #.Causeway and #.System. In A, I changed the
refernce to plot.line_chart to #.plot.line_chart.

Then, in a session:
-------------------
clear ws
)copy sharpplot
/Applications/Dyalog-18.0.app/Contents/Resources/Dyalog/ws/sharpplot.dws saved T
ue Jun 8 08:17:58 2021
)copy A
/Users/src/stats_apl/A.dws saved Sun Feb 20 12:43:52 2022
 
@bwanab Using namespaces for organising code is exactly what they are intended for, however, namespace sources (:namespace…) were never intended to execute actual code (including copying things in). Now you seem to be using separate workspaces (plot and A) which you copy into a flat unnamed workspace, giving you no organisation.
Unless you really want to work with workspaces, I suggest you create two :namespace files, one A.apln and one plot.apln and maybe a file init.aplf with a niladic tradfn which copies in sharpplot and the items from dfns.dws that you need.
Then, starting with a clear workspace, use ]link.create /Users/src/stats_apl and then init and take it from there.
 
 
2 hours later…
8:21 PM
]OK, this is promising. I created a test directory ns_test and created
plot.apln, A.apln and init.aplf as you suggested. In a clear ws
I did ]link.create # /Users/src/ns_test, then Init.

Everything works, but one last question. In order to make it
work, I've had to specify #.func for all the dfns functions
that I'm using in plot. Here's a small chunk:

:Namespace plot
⎕IO←0
chart_opt_default←('heading' 'key_text')('Chart'('Line'))
line_chart_opt_default←{
num←⍵
lcod←chart_opt_default #.alset'heading' 'Crine Chart'
 
@bwanab How does the line in init look that copies these functions?
I suppose it is something like
 'do' 'segs' 'alget' 'alpush' 'alset' 'alpop' ⎕CY 'dfns'
If you make it
 'do' 'segs' 'alget' 'alpush' 'alset' 'alpop' plot.⎕CY 'dfns'
 
Init
'do' 'segs' 'alget' 'alpush' 'alset' 'alpop' ⎕CY 'dfns'
'InitCauseway' 'View' ⎕CY 'sharpplot'
 
… then it will import into plot instead.
 
Thanks. That works. I hope I'm on the path to enlightenment now!
 
 
3 hours later…
11:33 PM
why it is 99 in (⌷⍤¯1 99)?
is there no other way to specify "the whole array as argument"
 
11:44 PM
@LdBeth Conceptually, "the whole array as argument" is rank infinity, but APL doesn't have the infinity value (no such literal, and if you try to calculate it then you get an error), so 99 is used instead as a "high-enough value".
(In Dyalog APL, arrays have the maximum rank of 16, so any value above 16 technically works)
 
Ah, thanks. I'd be a little sad hearing there is an actual limit of max rank.
I realize when I write APL for problems, it is full of "magic numbers" that are not occurred in the problem specification ;)
 

« first day (1852 days earlier)      last day (803 days later) »