[Jprogramming] Gustafson's Unums Revisited
Skip Cave
skip at caveconsulting.com
Wed Aug 17 19:35:00 UTC 2016
All,
I agree that the unum for _0.25 should be "_0.5j0"
My previous statement was wrong in its declaration of what *should be*, but
it wasn't wrong about what *is wrong in the lab*.
I said: "Shouldn't converting _0.25 to a SORN, then back to a
J number produce _0j0.5, NOT _0.5? "
I should have said:
"Shouldn't converting _0.25 to a SORN, then back to a
J number produce
_0.5j0, NOT _0.5? "
The key here is the words "NOT _0.5".
Here are the lab results copied directly from the session:
JNFS SFJN 0.25
0j0.5
JNFS SFJN _0.25
_0.5
So as I tried to state in my previous post: The lab is producing wrong
results for conversions of _0.25 to SORNS and back to J numbers. The lab
should produce "
_0.5j0
" for the result of
JNFS SFJN _0.25
For that matter, the lab produces wrong results for the whole interval from
0 < x < 0.5
JNFS SFJN _0.25
_0.5
JNFS SFJN _0.35
_0.5
JNFS SFJN _0.1
_0.5
JNFS SFJN _0.499
_0.5
JNFS SFJN _0.5
_1r2
I believe that all these results should be "
_0.5j0
" in the lab.
Then the lab gets it right again once we cross the _1r2 border (heading
negatively):
JNFS SFJN _0.6
_1j_0.5
Skip
Skip Cave
Cave Consulting LLC
On Wed, Aug 17, 2016 at 10:47 AM, roger stokes <rogerstokes811 at gmail.com>
wrote:
> Typo in my last: "gives 0.5j0" should be "Gives "_0.5j0"
>
> Sorry.
>
> On Wed, Aug 17, 2016 at 4:43 PM, roger stokes <rogerstokes811 at gmail.com>
> wrote:
>
> > Skip,
> >
> > you wrote "Shouldn't converting _0.25 to a SORN, then back to a
> > J number produce _0j0.5, NOT _0.5? "
> > I believe the result given is correct, because _0.25 is in the
> > interval (_0.5 0) in 4-bit precision.
> >
> > A =: SFJN _0.25
> >
> >
> > (> A) # UNUMS
> > +------+
> > ¦_1r2 0¦
> > +------+
> >
> > Rendering this as a complex number, with real for lower bound _1r2
> > and imaginary for upper bound 0 gives 0.5j0 which is presented by J
> > as a real number because imag = 0
> >
> > ] B =: JNFS A
> > _0.5
> > datatype B
> > complex
> > B = _0.5j0
> > 1
> >
> >
> > I rest my case.
> >
> > These conversions are not yet finished nor documented, in fact the whole
> > thing is pretty rough. On that subject, let me mention that until I get
> it
> > cleaned up, users should avoid one-character lower case variables,
> because
> > of my sloppy style of doing global assigns to what should be local.
> >
> > I thought it would be best to use rationals for the values, rather than
> > reals,
> > so that the computations for the lookup tables would be exact.
> >
> > Regards
> >
> > On Wed, Aug 17, 2016 at 3:02 PM, Skip Cave <skip at caveconsulting.com>
> > wrote:
> >
> >> Playing with 4-bit unums (compact SORNS), I thought I would see how the
> >> J-to-SORN & SORN-to-J conversions worked:
> >>
> >> JNFS SFJN _3
> >>
> >> __j_2
> >>
> >> JNFS SFJN _2.5
> >>
> >> __j_2
> >>
> >> JNFS SFJN _2
> >>
> >> _2
> >>
> >> JNFS SFJN _1.5
> >>
> >> _2j_1
> >>
> >> JNFS SFJN _1
> >>
> >> _1
> >>
> >> JNFS SFJN _0.5
> >>
> >> _1r2
> >>
> >> JNFS SFJN _0.25
> >>
> >> _0.5 NB. ??
> >>
> >> JNFS SFJN _0
> >>
> >> 0
> >>
> >> JNFS SFJN 0
> >>
> >> 0
> >>
> >> JNFS SFJN 0.25
> >>
> >> 0j0.5
> >>
> >> JNFS SFJN 0.5
> >>
> >> 1r2
> >>
> >> JNFS SFJN 0.75
> >>
> >> 0.5j1
> >>
> >> JNFS SFJN 1
> >>
> >> 1
> >>
> >> JNFS SFJN 1.5
> >>
> >> 1j2
> >>
> >> JNFS SFJN 1.75
> >>
> >> 1j2
> >>
> >> JNFS SFJN 2
> >>
> >> 2
> >>
> >> JNFS SFJN 2.5
> >>
> >> 2j_
> >>
> >> JNFS SFJN 3
> >>
> >> 2j_
> >>
> >> JNFS SFJN _
> >>
> >> 2j_
> >>
> >> JNFS SFJN __
> >>
> >> __
> >>
> >>
> >> This would have been easier if JNFS and SFJN could handle vectors. In
> any
> >> case, everything looked good, once I understood how Roger was
> representing
> >> intervals in J as complex numbers, EXCEPT converting _0.25. Shouldn't
> >> converting _0.25 to a SORN, then back to a J number produce _0j0.5, NOT
> >> _0.5?
> >>
> >>
> >> Skip
> >>
> >>
> >> Skip Cave
> >> Cave Consulting LLC
> >>
> >> On Wed, Aug 17, 2016 at 7:21 AM, Skip Cave <skip at caveconsulting.com>
> >> wrote:
> >>
> >> > Is there a way for the unum lab to discover where it was started from,
> >> and
> >> > then set the working directory to that location, rather than having
> the
> >> > user have to set the directory?
> >> >
> >> > Skip
> >> >
> >> > Skip Cave
> >> > Cave Consulting LLC
> >> >
> >> > On Wed, Aug 17, 2016 at 6:47 AM, roger stokes <
> rogerstokes811 at gmail.com
> >> >
> >> > wrote:
> >> >
> >> >> Dear All,
> >> >>
> >> >> Please accept my apologies for wasting your time, and my thanks
> >> >> for your patience, persistence and help.
> >> >>
> >> >> Skip, Raul, Vijay, you are quite right about 1 !: 44 .
> >> >> Instead of cd .... I should have said
> >> >>
> >> >> 1 !: 44 'yourdirectory' NB. full pathname is recommended
> >> >>
> >> >>
> >> >> Vijay, I made a correction following your mention of
> >> general/misc/fndef .
> >> >> This file should not be needed.
> >> >>
> >> >>
> >> >> Bob, thanks for the suggestion - it's a good way to get the lab
> >> started
> >> >> but there is still the need to find the other scripts. I will ponder
> >> this
> >> >> and see if there is a better way than as it is.
> >> >>
> >> >> Bill, thanks for the information about jconsole - I didn't know this
> >> >> and am very glad you mentioned it.
> >> >>
> >> >> I have now uploaded a corrected version to
> >> www.learningj.com/unumslab.zip
> >> >> .
> >> >> However, I hope, I believe, that the VERSION YOU ALREADY HAVE should
> >> run
> >> >> OK by doing this:
> >> >>
> >> >> 1 !: 44 'yourdirectory'
> >> >>
> >> >> first =: {. NB. workaround for Vijay's issues
> >> >> snd =: 1 & {
> >> >>
> >> >> load 'labs/labs'
> >> >>
> >> >> lab_jlab_ 'unums.ijt'
> >> >>
> >> >>
> >> >> Thanks again, everyone
> >> >>
> >> >> On Wed, Aug 17, 2016 at 4:12 AM, bill lam <bbill.lam at gmail.com>
> wrote:
> >> >>
> >> >> > In the readme, it said
> >> >> > ... jconsole doesn't support labs
> >> >> >
> >> >> > This is incorrect. One can run labs on jconsole
> >> >> > and type labrun_jlab_ '' (and up arrow to recall)
> >> >> > to advance.
> >> >> >
> >> >> > Вт, 16 авг 2016, roger stokes написал(а):
> >> >> > > Dear All,
> >> >> > >
> >> >> > > I've heard it said that you don't understand a subject
> >> >> > > unless you can explain it to a computer. With that in mind
> >> >> > > I've attempted a software implementation of Gustafson's Unums 2.0
> >> >> > >
> >> >> > > ( http://www.johngustafson.net/presentations/Unums2.0.pdf ).
> >> >> > >
> >> >> > > If anyone is interested, there is a demo available in the
> >> >> > > form of a J lab. To run the lab
> >> >> > >
> >> >> > > Download www.learningj.com/unumslab.zip
> >> >> > >
> >> >> > > Unzip into any convenient directory
> >> >> > >
> >> >> > > Follow directions in the readme file
> >> >> > >
> >> >> > > Comments and criticisms appreciated.
> >> >> > >
> >> >> > > Regards
> >> >> > > ------------------------------------------------------------
> >> >> ----------
> >> >> > > For information about J forums see
> http://www.jsoftware.com/forum
> >> >> s.htm
> >> >> >
> >> >> > --
> >> >> > regards,
> >> >> > ====================================================
> >> >> > GPG key 1024D/4434BAB3 2008-08-24
> >> >> > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> >> >> > gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
> >> >> > ------------------------------------------------------------
> >> ----------
> >> >> > For information about J forums see http://www.jsoftware.com/forum
> >> s.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
>
More information about the Programming
mailing list