Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis15/src/tests/examples/unicode/unicode.diderot
ViewVC logotype

Diff of /branches/vis15/src/tests/examples/unicode/unicode.diderot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4177, Fri Jul 8 18:12:23 2016 UTC revision 4178, Fri Jul 8 18:47:11 2016 UTC
# Line 4  Line 4 
4    
5  This example program doesn't actually do anything; these comments  This example program doesn't actually do anything; these comments
6  list the Unicode characters that you can use in Diderot.  list the Unicode characters that you can use in Diderot.
7  After each character is the LaTeX equivalent, which might be  With each character we give the Unicode code point and name, the LaTeX equivalent (might be
8  useful for Diderot programs in LaTeX documents, and other comments.  useful for Diderot programs in LaTeX documents), and other comments.
9    
10  #### π means Pi, as in  Our basic philosophy behind indicating mathematical values and operators
11    in the most idiomatic way possible is similar to principles previously
12    articulated by other computer scientists.
13    
14    > First, we want to establish the idea that a computer language is not
15    > just a way of getting a computer to perform operations but rather that
16    > it is a novel formal medium for expressing ideas about methodology.
17    > Thus, programs must be written for people to read, and only
18    > incidentally for machines to execute. -- Abelson & Sussman & Sussman,
19    > Structure and Interpretation of Computer Programs (1985)
20    
21    > Let us change our traditional attitude to the construction of
22    > programs: instead of imagining that our main task is to instruct a
23    > computer what to do, let us concentrate rather on explaining to humans
24    > what we want the computer to do. -- Donald Knuth, Literate Programming (1984)
25    
26    These statements predate Unicode development, but that does not
27    undermine their continued relevance for Diderot or for programming in general.
28    See https://en.wikipedia.org/wiki/Unicode_input for information about
29    how best to input unicode in your OS.  Or, copy and paste from this file.
30    
31    
32    #### π means pi, as in
33    
34          real rad = degrees*π/180;          real rad = degrees*π/180;
35    * Unicode: U+03C0 (Greek Small Letter Pi)
36  * LaTeX: `\pi`  * LaTeX: `\pi`
37  * This is currently the only finite real constant in Diderot.  * This is currently the only finite real constant in Diderot.
38    
39  #### ∞ means Infinity, as in  #### ∞ means infinity, as in
40    
41          output real out = -∞;          output real out = -∞;
42    * Unicode: U+221E (Infinity)
43  * LaTeX: `\infty`  * LaTeX: `\infty`
44  * The above line of code is how the output of maximum-intensity projection might be intialized;  * The above line of code is how the output of maximum-intensity projection might be intialized;
45    from then on subsequent use might be like `out = max(out, F(pos))`.    from then on subsequent use might be like `out = max(out, F(pos))`.
# Line 23  Line 47 
47  #### ⊛ means convolution, as in  #### ⊛ means convolution, as in
48    
49          field#2(3)[] F = bspln3 ⊛ image("img.nrrd");          field#2(3)[] F = bspln3 ⊛ image("img.nrrd");
50    * Unicode: U+229B (Circled Asterisk Operator)
51  * LaTeX: `\circledast` is probably typical, but `\varoast` (with `\usepackage{stmaryrd}`)  * LaTeX: `\circledast` is probably typical, but `\varoast` (with `\usepackage{stmaryrd}`)
52    is slightly more legible    is slightly more legible
53  * This commutes; you could also write `image("img.nrrd") ⊛ bspln3`.  * This commutes; you could also write `image("img.nrrd") ⊛ bspln3`.
# Line 30  Line 55 
55  #### × means cross product, as in  #### × means cross product, as in
56    
57          vec3 camU = normalize(camN × camUp);          vec3 camU = normalize(camN × camUp);
58    * Unicode: U+00D7 (Multiplication Sign)
59  * LaTeX: `\times`  * LaTeX: `\times`
60  * As the cross-product, this is only defined for `vec3` variables.  * As the cross-product, this is only defined for `vec3` variables.
61    It also works for the curl of a vector field; see below.    It also works for the curl of a vector field; see below.
# Line 37  Line 63 
63  #### ⊗ means tensor product, as in  #### ⊗ means tensor product, as in
64    
65          tensor[3,3] Proj = identity[3] - norm⊗norm          tensor[3,3] Proj = identity[3] - norm⊗norm
66    * Unicode: U+2297 (Circled Times)
67  * LaTeX: `\otimes`.  * LaTeX: `\otimes`.
68  * As an operator on coordinate vectors, this is typically called the outer product.  * As an operator on coordinate vectors, this is typically called the outer product.
69    It is also used to define the Jacobian of a vector field; see below.    It is also used to define the Jacobian of a vector field; see below.
# Line 44  Line 71 
71  #### • means dot product and matrix multiplication, as in  #### • means dot product and matrix multiplication, as in
72    
73          real ld = norm • lightDir;          real ld = norm • lightDir;
74    * Unicode: U+2022 (Bullet)
75  * LaTeX: `\bullet`, which is more consistently visible than  * LaTeX: `\bullet`, which is more consistently visible than
76    the `\cdot` that more typical for dot products.    the `\cdot` that more typical for dot products.
77  * The meaning of `•` is really (in tensor-speak) "contract out the  * The meaning of `•` is really (in tensor-speak) "contract out the
# Line 64  Line 92 
92          field#1(3)[] divergence = ∇•V;          field#1(3)[] divergence = ∇•V;
93          field#2(2)[2] U = ...;          field#2(2)[2] U = ...;
94          field#1(2)[] vort = ∇×U;          field#1(2)[] vort = ∇×U;
95    * Unicode: U+2207 (Nabla)
96  * LaTeX: `\nabla`.  * LaTeX: `\nabla`.
97  * See above for the different uses of `∇`.  Note that `∇×` applied to a 2D vector field  * See above for the different uses of `∇`.  Note that `∇×` applied to a 2D vector field
98    gives you a scalar, but `∇×` applied to a 3D vector field gives you another 3D vector field.    gives you a scalar, but `∇×` applied to a 3D vector field gives you another 3D vector field.

Legend:
Removed from v.4177  
changed lines
  Added in v.4178

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0