(* sample program to write out a file of html *)
(* by David@ColeCanada.com 2015 C Mar 21 *)
(* *)
(* always begin with *)
Remove[Global`*];
(* set t & f *)
isToPrint=True; isA=False;
(* Sqrt[3] does not compute *)
Print[Sqrt[3]]
(* But N[ ] does *)
Print[N[Sqrt[3]]
(* Use mathematica to *)
(* initialize a 2x2 matrix *)
(* where null is a small square *)
alist = 1 null ;
null 0
(* print out alist *)
Print[InputForm[alist]];
(* prints the following *)
(* where null is a small square *)
((1, null), (null, 1))
(* get an element *)
itemB=alist[[1,2]];
(* print out a number *)
Print["itemB:",itemB]
(* will have printed itemB:null *)
(* where null is a small square *)
(* initialize a string *)
a=".";
(* set vector length *)
nlines=6;
(* initialize a 1xn vector *)
pageA=Array[a,nlines];
(* convert to string *)
testG$=ToString[pageA[[4]]];
(* print out the string *)
Print["testG$:",testG$]
(* will have printed testG$:.[4] *)
(* now initialize 3 rows *)
pageA[[1]]="
";
pageA[[2]]="";
pageA[[3]]="Test
";
(* initialize filename *)
outfile$="testC.html";
(* create last 2 rows *)
pageA[[nlines - 1]] = "/" <> outfile$ <> "
";
pageA[[nlines]] = "";
(* Decide # of rows to print *)
nToPrint = If [isToPrint, nlines, 0];
(* print out the array *)
Do[Print[pageA[[j]]], {j, 1, nToPrint}]
(* prints the following *)
Test
.[4]
/testC.html
(* now export the array into /home/pi *)
Export[outfile$, pageA, "Text"]
(* that outputs the name of the file written *)
testC.html
(* ***************************************** *)
(* The only issue is: why does it show "[4]" *)
(* after the "." in row 4 of the file *)
(* Of course, the 4 means "row 4" *)
(* ***************************************** *)
(* 3 rows of 4 columns are defined as *)
a2D = {{a,b,c,d},{e, f, g, h},{i, j, k, l}};
(* and the item in the Ith row and Jth column is g *)
(* a2Dsubscript23 is *)
Print[a2D[[2,3]]]
(* Do NOT use If[N[x] < N[xmax], Print["x ":" <> ToString[c]
];
(* call as follows: pRint["e$",e$] *)
(* to print *)
(* e$:mmm *)
(* or pRint["e",e] *)
(* *)
(* *)
(* naming conventions *)
(* all user variables begin with lower case *)
(* integers begin with ijklm (no n ) *)
(* nWidth (float.) begins with n *)
(* bName$ string ends with $ *)
(* isEmpty condition begins with is *)
(* arrB array/vector begins with arr *)
(* zlist list ends with list *)
(* fPlus2 func def: 1st or 2nd letter of f *)
(* fPlus2[a_]:=a+2 *)
(* pPrin procedure has 1st letter of p *)
(* pPrin[b$_] proc returns True or False *)
/m_NotesA.txt