![]() |
|
Spaces home The Light Cone (Brian's ...ProfileFriendsFilesMore ![]() | ![]() |
The Light Cone (Brian's space-time) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Stuff I wrote
Filed and Issued
This friends list is empty. |
Public foldersFolders shared with the worldJuly 02 How to Type Matrices in Word 2007Insert -> Equation
then, type \matrix ( a & b @ c & d )
The ampersand separates elements on a line, the at-sign separates lines. Type as much as you want, it all gets laid out beautifully. Nest the whole thing inside brackets of various kinds. Very similar to LaTeX. I've found that most of the LaTeX backslash commands work in an intuitive way in Word 2007. Lovely! June 24 Tuval-Cain == Vulcan ?Tuval-Cain, in the seventh generation after Adam according to the book of Genesis: וְצִלָּה גַם-הִוא, יָלְדָה אֶת-תּוּבַל קַיִן--לֹטֵשׁ, כָּל-חֹרֵשׁ נְחֹשֶׁת וּבַרְזֶל "And Tzilla also gave birth to TUVAL-CAIN, forger of every sharp implement in brass and iron..." (4:22). His name and profession are much too similar to those of the forge-master of Romano-Greek mythology, Vulcan, to be coincidence. However, I've been unable to find any research on this. June 23 How About a Boxcar?A Boxcar Filter is a gadget that runs (or maps) a function of four arguments over a rectangular grid of points. A rectangular grid is a data structure where each point has a pair of integer indices, i and j, say, and i runs from, say, 1, through M and j runs from 1 through N. The data structure is best viewed as a function from i and j to some value, which can be anything. Even better, let it be a list of lists, in the usual Mathematica way. The function of four arguments that the Boxcar filter maps over the grid expects four, nearest-neighbor points:
h[p1, p2, p3, p4],
p1=grid[i, j], p2=[i+1, j], p3[i, j+1], p4[i+1, j+1] The Boxcar filter mapper, then, must intelligently skip the last row and column. Enjoy:
fRows[opOf2Rows_,{a_,b_,c___}]:= fRows[_,{a_}]:={};
gCols[op4_,{a_,b_,c___},{d_,e_,f___}]:= gCols[_,{a_},{d_}]:={};
boxCar[op4_,grid_]:= Here's an application that draws criss-crosses in each box of a grid. Ampersand converts the previous expression into a function (a lambda expression), in which #1, #2, ... denote positional arguments. Thus, {Line[{#1,#4}],Line[{#2,#3}]}& is a function of four arguments:
crissCross[grid_]:=boxCar[{Line[{#1,#4}],Line[{#2,#3}]}&,grid] The problem with MaxIs, of course, the recursive call on line 2:
Max[{x_, xs___}] := x if x > Max[{xs}];
While mathematically correct, it will cause recalculation over the tail, xs, for each element of the list, transforming a trivial linear algorithm into a quadratic. The solution, as usual, is to introduce another formal argument:
Max[l_] := MaxHelper[l, -Infinity];
MaxHelper[{}, a] := a;
MaxHelper[{x_, xs___}, a] := MaxHelper[{xs}, x] if x > a;
MaxHelper[{x_, xs___}, a] := MaxHelper[{xs}, a] otherwise;
June 15 Functional FunnyThe following is a correct implementation of Max over a list in a pattern-matching language like Mathematica. It has an amusing fault. Can you spot it? Max[{}] := -Infinity; Max[{x_, xs___}] := x if x > Max[{xs}]; Max[{x_, xs___}] := Max[{xs}] otherwise;
Papers that cite my stuff
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|