Hi Linda !

Here yet another way, now with browser output.

I didn't manage to make it as simple. Maybe it's too difficult for your students.

Change the filename, run and open the resulting file in your browser.

tag=: '<',[,'>',],'</',[,'>'"_
FileWrite=: 4 : 0
try.
NB.Delete File if it exists
1!:55 <y
catch.
end.
NB. Open file
fh=: 1!:21 <y
NB. Write file
x 1!:2 fh
NB. Close file
1!:22 fh
)
StyleSheet=: 0 : 0
body {    font-family: sans-serif;
    font-size: 1rem;
    line-height: 1.5;}
table {    text-align: right;}
caption {    font-size: 1.5em;
    font-weight: bold;
    text-align: right;}
th ,td {    width: 4em;}
)
ColumnData=: 0.01*i.10
RowData=: 0.1*i.100
ContentData=: 10 ^. RowData +/ ColumnData
TableHeaderColumns=: , ('th' tag 8j2 ": ])"0 ColumnData
TableHeader=: 'tr' tag ('th' tag '<10^.   ') , TableHeaderColumns
TableRowHeader=: [: ,'th' tag 8j1 ": [
TableRowColumns=:[: , [: ('td' tag 8j4 ": ])"0 ]
TableRows=: RowData ('tr' tag  TableRowHeader , TableRowColumns )"0 1 ContentData
Caption=: 'caption' tag 'Log Table 10-log 0 to 10, 4 digits precision'
BlankSpace=: '&nbsp;&nbsp;&nbsp;'
Page1 =: 'div' tag BlankSpace, 'table' tag Caption,TableHeader,(, 50{. TableRows) Page2 =: 'div' tag BlankSpace, 'table' tag Caption,TableHeader,(, 50}. TableRows)
Body =: 'body' tag Page1 , Page2
Application =: '<!DOCTYPE html>','html' tag ('head' tag 'style' tag StyleSheet), Body
FileName=: 'c:\users\erling\documents\LindaLogTable.html'
Application FileWrite FileName

Cheers,

Erling Hellenäs




Den 2017-10-04 kl. 21:22, skrev Erling Hellenäs:
Hi Linda !

Here's another way to do it:

NB. Log 0 to 10, 4 decimals
a=: 0.01*i.10
b=: 0.1*i.100
ColumnHeader=:'<10^.   ';8j2": a
RowHeader=: 8j1": ,. b
TableContent=: 8j4": 10^. b + / a
Page1=:ColumnHeader ,: ( 50{.RowHeader ); 50{. TableContent
Page2=:ColumnHeader ,: ( 50}.RowHeader ); 50}. TableContent
Page1,:Page2

Cheers,
Erling Hellenäs



On 2017-10-04 18:03, Linda Alvord 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

Reply via email to