This turned into a nice way to introduce explicit definiions with multiple
lines.
T is for top, S for side, and A for all the log mantissas.
T=: 0.01*i.10
s=: 13 :'y+0.1*i.50'
S=:s 0
A=: 10^.S+/T
(('10^.x+y');,.S),.(8j2":T);8j4":A
T=: 0.01*i.10
s=: 13 :'y+0.1*i.50'
S=:s 5
A=: 10^.S+/T
(('10^.x+y');,.S),.(8j2":T);8j4":A
Only one change in necessary to get a different page. A perfect example for
comining the two into a single definigion:
LOGS=: 3 : 0
T=: 0.01*i.10
s=: 13 :'y+0.1*i.50'
S=:s y
A=: 10^.S+/T
(('10^.x+y');,.S),.(8j2":T);8j4":A
)
(LOGS 0),.LOGS 5
Now you have the two pages side by side.
Thanks again, Raul! Linda
-----Original Message-----
From: Programming [mailto:[email protected]] On Behalf
Of Raul Miller
Sent: Wednesday, October 4, 2017 12:33 PM
To: Programming forum <[email protected]>
Subject: Re: [Jprogramming] log tables
If we rearrange this so that all assignments are on the left hand side (and
only one assignment per line), we can quickly see that A and H are the same
value, and that I is 50+B, that J and C are very similar, and that the
remainder of the assignments are all about formatting these results (and, also,
that this "almost the same sort of thing"
continues on down the line).
One simplification would be to re-use the variables (why have H? why not just
use A there?)
Another would be to define a reusable routine and to use it twice.
Another would be to define most of these things once (BI=: 0.1*i.100) and then
split things up when formatting. (But you still would need to do the same
formatting twice, which pushes more in the direction of using a routine.)
Probably any of these approaches should be guided by comments or clues for
identifying the purpose for each of these names.
So... for example, here's using a routine:
tblpage=:3 :0
colarg=. 0.01*i.10
rowarg=. y+0.1*i.50
tbldat=. 10^.rowarg +/ colarg
(('<10^.');":,.rowarg),.(8j2":colarg);8j4":tbldat
)
G-:tblpage 0
1
N-:tblpage 5
1
That said, I'd be tempted to make some minor changes. Maybe something like this:
tblpage=:3 :0
colarg=. 0.01*i.10
rowarg=. y+0.1*i.50
tbldat=. 10^.rowarg +/ colarg
(('10^.x+y');,.rowarg),.(8j2":colarg);8j4":tbldat
)
(tblpage 0),:tblpage 5
Or, if we can graduate from simple J:
0 ,:&tblpage 5
Anyways, a variety of options here...
Thanks,
--
Raul
On Wed, Oct 4, 2017 at 12:03 PM, Linda Alvord <[email protected]> wrote:
> Here's a way to create the 2 pages found in most high school Algebra 2
> texts.
>
> NB. log tables.ijs
> D=:8j4":10^.C=:(B=:0.1*i.50)+/A=:0.01*i.10
> E=:(<8j2":A),:<D
> F=:,.('<10^.');<":,.B
> G=:F,.E
> K=:8j4":10^.J=:(I=:0.1*50+i.50)+/H=:0.01*i.10
> L=:(<8j2":A),:<K
> M=:,.('<10^.');<":,.I
> N=:M,.L
> G,:N
>
> Simplifications in simple J are great
>
> Linda
>
> Sent from AOL Mobile Mail
> ----------------------------------------------------------------------
> 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