format numbers by importance of hyper coefficients

Let it all hang out

format numbers by importance of hyper coefficients

PostPosted by drab » Sat Oct 07, 2017 7:12 am

Usually, the most important things about a hyper number are the directions of the largest coefficients.

They could easily be formatted that way to show instant clarity.

I wrote a simple function to do that ...


fhc ⎕← 1 3i2 2i3 4j5 5j1k3 2j6k4 3l4 4l3
1i0j0k0l0ij0jk0kl0 3i2j0k0l0ij0jk0kl0 2i3j0k0l0ij0jk0kl0 4i0j5k0l0ij0jk0kl0 5i0j1k3l0ij0jk0kl0
2i0j6k4l0ij0jk0kl0 3i0j0k0l4ij0jk0kl0 4i0j0k0l3ij0jk0kl0
1 3i2 i3r2 j5r4 5k3j1 j6k4r2 S4r3 4S3

The new display is MUCH smaller and simpler and FAR easier to interpret!


I prefer to use single character indicators for each of the components

complex -- ri
quaternion -- rijk
octonian -- rijkSIJK

But others could be chosen.


Here it is:

z←fhc x;⎕io IC xc nc gmc i o xc1
⍝ format hyper numerics by importance of coefficients
⍝ the largest absolute magitudes come first
⍝ zeros are left out
⎕io←0
→(0<⍴⍴x)/nonscalar
IC←'rijkSIJK' ⍝ indicators for each coefficient
nc←⍴gmc←⍒∣xc←>x
z←''
i←0
go: o←gmc[i]
→(0=xc1←xc[o])/gone
z←z,IC[o],⍕xc1
→(nc>i←i+1)/go
gone: z←(IC[0]=↑z)↓z ⍝ omit real indicator if first
→0
nonscalar: z←∇¨x
drab
 
Posts: 315
Joined: Thu Oct 09, 2014 6:23 am

Re: format numbers by importance of hyper coefficients

PostPosted by drab » Sat Oct 07, 2017 7:16 am

Furthermore, it's nearly re-executable.

It could be made completely re-executable with some very minor tweaks.
drab
 
Posts: 315
Joined: Thu Oct 09, 2014 6:23 am


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron